dominik-tylczynski / mfs-plc-sim

Free, open source, platform independent PLC emulator for SAP EWM MFS
GNU Affero General Public License v3.0
25 stars 0 forks source link

The Sim can not run #14

Closed IvanXuHui closed 1 year ago

IvanXuHui commented 1 year ago

Hi After executing the command bridge,the message is as follow:

11:57:08.918 DEBUG - Loading properites file: MFS.properties - [main] Configurator 48 11:57:08.934 DEBUG - jcoServer specified directly: MFSPLC - [main] Configurator 63 11:57:08.934 DEBUG - handshakeConfirmation = A - [main] Configurator 68 11:57:08.934 DEBUG - handshakeRequest = R - [main] Configurator 68 11:57:08.934 DEBUG - jcoDestination = S4H - [main] Configurator 68 11:57:08.934 DEBUG - jcoServer = MFSPLC - [main] Configurator 68 11:57:08.934 DEBUG - sendingFM = - [main] Configurator 68 11:57:08.934 DEBUG - startingFM = - [main] Configurator 68 11:57:08.934 DEBUG - statusFM = - [main] Configurator 68 11:57:08.934 DEBUG - stoppingFM = - [main] Configurator 68 11:57:08.934 DEBUG - style.-A = 0,0,0,I - [main] Configurator 68 11:57:08.949 DEBUG - style.-R = 0,0,0,B - [main] Configurator 68 11:57:08.949 DEBUG - style.LIFE-A = 255,0,0,I - [main] Configurator 68 11:57:08.949 DEBUG - style.LIFE-R = 255,0,0,B - [main] Configurator 68 11:57:08.949 DEBUG - style.SYBE-A = 255,153,0,I - [main] Configurator 68 11:57:08.949 DEBUG - style.SYBE-R = 255,153,0,B - [main] Configurator 68 11:57:08.949 DEBUG - style.SYEN-A = 0,153,51,I - [main] Configurator 68 11:57:08.949 DEBUG - style.SYEN-R = 0,153,51,B - [main] Configurator 68 11:57:08.949 DEBUG - style.SYES-A = 255,153,0,I - [main] Configurator 68 11:57:08.949 DEBUG - style.SYES-R = 255,153,0,B - [main] Configurator 68 11:57:08.949 DEBUG - switchSenderReceiver = false - [main] Configurator 68 11:57:08.949 DEBUG - telegramStructure = ZMFS_S_MFS_TELETOTAL - [main] Configurator 68 11:57:08.949 DEBUG - telegramType.LIFE = LIFE - [main] Configurator 68 11:57:09.843 INFO - Starting RFC server - [main] Bridge startRFCServer 66 11:57:09.849 INFO - RFC server state changed from STOPPED to STARTED - [main] Bridge serverStateChangeOccurred 389 11:57:09.856 INFO - RFC server started - [main] Bridge startRFCServer 68 11:57:09.998 INFO - RFC server state changed from STARTED to ALIVE - [JCoServerControllerThread] Bridge serverStateChangeOccurred 389

But when i run the Sim,the message is:

D:\STUDY\EWM\MFS\How to setup and run PLC emulator for SAP EWM MFS\mfs-plc-sim-master\mfs-plc-sim-master>java -Dlog4j.configurationFile=log4j2.xml -cp sapjco3.jar;log4j-api-2.19.0.jar;log4j-core-2.19.0.jar;mfsplc.jar pl.sapusers.mfsplc.sim.Sim S4H MFS.properties Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/apache/logging/log4j/LogManager at pl.sapusers.mfsplc.Configurator.(Configurator.java:41) at pl.sapusers.mfsplc.sim.Sim$1.run(Sim.java:125) at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318) at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720) at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714) at java.base/java.security.AccessController.doPrivileged(AccessController.java:400) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87) at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:742) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90) Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.LogManager at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ... 15 more

What is the problem ,and how can i sovle this problem. Thank you.

dominik-tylczynski commented 1 year ago

Hi, thank you for raising this issue. The problem is that the Sim class when run cannot find the LogManager manager class from the log4j2 library. It all boils down to specifying the required classes correctly with -cp parameter when running java. In my opinion the easiest way is to put all 4 jars i.e.

Let me know if that works for you.

IvanXuHui commented 1 year ago

Thank you for your help,now both bridge and Sim are working well.I have ran the Bridge and Sim succesfully,But i meet a new problem now,When I start the channel using /scwm/mon,the error happens in the console,as it is follow:

IvanXuHui commented 1 year ago

This problem has been sovled,the reason is that the access of port 7000 is not permited in my operating system. Now i cant start the channel succcesfully. Next, i will test the transmission and confirmation of wt. Thank you very much.

dominik-tylczynski commented 1 year ago

I'm glad the issue is resolved. Next time please open individual issues for each problem, i.e. one Github issue - one problem. This way it's easier for other users to follow the issues and their resolutions.