Menu ▾ ▴

#197 Application don't run with wrapper

v3.3.0
open
JNI (8)
5
2014-08-26
2008-05-10
SOPC
No

My application runs when run in command prompt
java -cp "resources;GlobasysLogger.jar" -Djava.library.path=lib com.globasyslogger.startup.StartGLogger

Above command works perfectly (It also has some dll )

When the same configured with wrapper, with following configuration

################################################
wrapper.java.command=java.exe

wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp

# Java Classpath (include wrapper.jar) Add class path elements as
wrapper.java.classpath.1=../lib/wrapper.jar
wrapper.java.classpath.2=../../resources
wrapper.java.classpath.3=../../lib
wrapper.java.classpath.4=../../GlobasysLogger.jar

# Java Library Path (location of Wrapper.DLL or libwrapper.so)
wrapper.java.library.path.1=../lib
wrapper.java.library.path.2=../../lib

# Application parameters. Add parameters as needed starting from 1
wrapper.app.parameter.1=com.globasyslogger.startup.StartGLogger

wrapper.ntservice.account=.\Administrator
wrapper.ntservice.password=123123
wrapper.debug=true
##################################################

when i run the command
wrapper.exe -c ..\conf\wrapper.conf

It gives following log

#################################################
wrapper | --> Wrapper Started as Console
wrapper | Java Service Wrapper Community Edition 3.3.0
wrapper | Copyright (C) 1999-2008 Tanuki Software, Inc. All Rights Reserved.

wrapper | http://wrapper.tanukisoftware.org
wrapper |
wrapper | Using tick timer.
wrapperp | server listening on port 32000.
wrapper | Ping settings: wrapper.ping.interval=5, wrapper.ping.interval.logged=
1, wrapper.ping.timeout=30
wrapper | Launching a JVM...
wrapper | command: "D:\Program Files\Java\jre1.6.0\bin\java.exe" -Djava.library
.path="../lib;../../lib" -classpath "../lib/wrapper.jar;../../resources;../../li
b;../../GlobasysLogger.jar" -Dwrapper.key="oQ78ujCGsmQnJYkE" -Dwrapper.port=3200
0 -Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -Dwrapper.debug="TRU
E" -Dwrapper.pid=2400 -Dwrapper.version="3.3.0" -Dwrapper.native_library="wrappe
r" -Dwrapper.cpu.timeout="10" -Dwrapper.jvmid=1 org.tanukisoftware.wrapper.Wrapp
erSimpleApp com.globasyslogger.startup.StartGLogger
wrapper | JVM started (PID=6676)
jvm 1 | WrapperManager Debug: WrapperManager class initialized by thread: mai
n Using classloader: sun.misc.Launcher$AppClassLoader@11b86e7
jvm 1 | WrapperManager: Initializing...
jvm 1 | WrapperManager Debug: JVM #1
jvm 1 | WrapperManager Debug: Running a 32-bit JVM.
jvm 1 | WrapperManager Debug: Registering shutdown hook
jvm 1 | WrapperManager Debug: Using wrapper
jvm 1 | WrapperManager Debug: Load native library. One or more attempts may
fail if platform specific libraries do not exist. This is NORMAL and is only a
problem if they all fail.
jvm 1 | WrapperManager Debug: Loaded native library: wrapper-windows-x86-32
.dll
jvm 1 | WrapperManager Debug: Calling native initialization method.
jvm 1 | WrapperJNI Debug: Initializing WrapperManager native library.
jvm 1 | WrapperJNI Debug: Java Executable: D:\Program Files\Java\jre1.6.0\bin
\java.exe
jvm 1 | WrapperJNI Debug: Windows version: 5.1.2600
jvm 1 | WrapperManager Debug: Java Version : 1.6.0-b105 Java HotSpot(TM) Cl
ient VM
jvm 1 | WrapperManager Debug: Java VM Vendor : Sun Microsystems Inc.
jvm 1 | WrapperManager Debug:
jvm 1 | WrapperManager Debug: Control event monitor thread started.
jvm 1 | WrapperManager Debug: Startup runner thread started.
jvm 1 | WrapperManager Debug: WrapperManager.start(org.tanukisoftware.wrapper
.WrapperSimpleApp@bb6ab6, args[]) called by thread: main
jvm 1 | WrapperManager Debug: Communications runner thread started.
jvm 1 | WrapperManager Debug: Open socket to wrapper...Wrapper-Connection
jvm 1 | WrapperManager Debug: Opened Socket from 31000 to 32000
jvm 1 | WrapperManager Debug: Send a packet KEY : oQ78ujCGsmQnJYkE
jvm 1 | WrapperManager Debug: handleSocket(Socket[addr=/127.0.0.1,port=32000,
localport=31000])
wrapperp | accepted a socket from 127.0.0.1 on port 31000
wrapperp | read a packet KEY : oQ78ujCGsmQnJYkE
wrapper | Got key from JVM: oQ78ujCGsmQnJYkE
wrapperp | send a packet LOW_LOG_LEVEL : 1
wrapperp | send a packet PING_TIMEOUT : 30
wrapperp | send a packet PROPERTIES : (Property Values)
wrapper | Start Application.
wrapperp | send a packet START : start
jvm 1 | WrapperManager Debug: Received a packet LOW_LOG_LEVEL : 1
jvm 1 | WrapperManager Debug: LowLogLevel from Wrapper is 1
jvm 1 | WrapperManager Debug: Received a packet PING_TIMEOUT : 30
jvm 1 | WrapperManager Debug: PingTimeout from Wrapper is 30000
jvm 1 | WrapperManager Debug: Received a packet PROPERTIES : (Property Values
)
jvm 1 | WrapperManager Debug: Received a packet START : start
jvm 1 | WrapperManager Debug: calling WrapperListener.start()
jvm 1 | WrapperManager Debug: Waiting for WrapperListener.start runner thread
to complete.
jvm 1 | WrapperManager Debug: WrapperListener.start runner thread started.
jvm 1 | WrapperSimpleApp Debug: start(args) Will wait up to 2 seconds for the
main method to complete.
jvm 1 | WrapperSimpleApp Debug: invoking main method
jvm 1 | WrapperManager Debug: Send a packet START_PENDING : 5000
wrapperp | read a packet START_PENDING : 5000
wrapper | JVM signalled a start pending with waitHint of 5000 millis.
jvm 1 | WrapperManager Debug: Send a packet START_PENDING : 5000
jvm 1 | WrapperSimpleApp Debug: start(args) end. Main Completed=false, exitC
ode=null
jvm 1 | WrapperManager Debug: WrapperListener.start runner thread stopped.
jvm 1 | WrapperManager Debug: returned from WrapperListener.start()
jvm 1 | WrapperManager Debug: Send a packet STARTED :
wrapperp | read a packet START_PENDING : 5000
wrapper | JVM signalled a start pending with waitHint of 5000 millis.
wrapperp | read a packet STARTED :
wrapper | JVM signalled that it was started.
jvm 1 | WrapperManager Debug: Startup runner thread stopped.
wrapperp | send a packet PING : ping
jvm 1 | WrapperManager Debug: Received a packet PING : ping
jvm 1 | WrapperManager Debug: Send a packet PING : ping
wrapperp | read a packet PING : ping
jvm 1 | WrapperSimpleApp Debug: main method completed
jvm 1 | [thread 7196 also had an error]
jvm 1 | #
jvm 1 | # An unexpected error has been detected by Java Runtime Environment:
jvm 1 | #
jvm 1 | # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x77ea4d3a, pid=6676
, tid=4196
jvm 1 | #
jvm 1 | # Java VM: Java HotSpot(TM) Client VM (1.6.0-b105 mixed mode, sharing
)
jvm 1 | # Problematic frame:
jvm 1 | # C [RPCRT4.dll+0x34d3a]
jvm 1 | #
jvm 1 | # An error report file with more information is saved as hs_err_pid66
76.log
jvm 1 | #
jvm 1 | # If you would like to submit a bug report, please visit:
jvm 1 | # http://java.sun.com/webapps/bugreport/crash.jsp
jvm 1 | #
wrapper | JVM process exited with a code of 1, setting the wrapper exit code to
1.
wrapper | JVM exited unexpectedly.
wrapperp | server listening on port 32000.
wrapper | JVM was only running for 6 seconds leading to a failed restart count
of 1.
wrapper | Waiting 5 seconds before launching another JVM.
wrapper | CTRL-C trapped. Shutting down.
wrapper | wrapperStopProcess(0) called.
wrapper | <-- Wrapper Stopped

###################################################

I have also attached the pid file

Discussion

  • SOPC

    SOPC - 2008-05-10

    PID file

     
  • Leif Mortenson

    Leif Mortenson - 2008-05-12
    • assigned_to: nobody --> mortenson
     
  • Leif Mortenson

    Leif Mortenson - 2008-05-12

    Logged In: YES
    user_id=228081
    Originator: NO

    From the error, it looks like the RPCRT4.dll DLL is causing an access violation. Is that DLL a JNI library?
    Are there any other DLLs which the RPCRT4.dll library requires?

    Java locates its direct JNI DLLs by searching the specified java.library.path But those JNI DLLs locate any required DLLs using the following search path. 1) working directory. 2) Windows directory. 3) Windows system directory. 4) PATH.

    Is it possible that another DLL is not being located correctly? If so you might be able to resolve this by adding the following to your wrapper.conf:
    set.PATH=lib;..\lib;%PATH%

    You are running in Console mode, so the environment should be otherwise identical.

    You can remove the Wrapper from the equation completely by doing the following.
    1) Copy the full java command from the wrapper.log into a batch file.
    2) Remove the -Dwrapper.key=NNN system property from the command line.
    3) Run the batch file.
    4) The JVM will run in a standalone mode without the Wrapper.exe, Can you still reproduce the problem?

    Cheers,
    Leif

     
  • SOPC

    SOPC - 2008-05-14

    Logged In: YES
    user_id=1821955
    Originator: YES

    I have set set.PATH=lib;..\lib;%PATH% and then run the service in console mode. Still it gives the problem.
    Then i have -Dwrapper.key=NNN and run following command

    "D:\Program Files\Java\jre1.6.0\bin\java.exe" -Djava.library.path="../lib;../../lib" -classpath "../lib/wrapper.jar;../../resources;../../lib;../../GlobasysLogger.jar" -Dwrapper.port=32000 -Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -Dwrapper.debug="TRUE" -Dwrapper.pid=4820 -Dwrapper.version="3.3.0" -Dwrapper.native_library="wrapper" -Dwrapper.cpu.timeout="10" -Dwrapper.jvmid=1 org.tanukisoftware.wrapper.WrapperSimpleApp com.globasyslogger.startup.StartGLogger

    Still it gives problem
    Then i implemented wrapperListener in com.globasyslogger.startup.StartGLogger and tried it instead of org.tanukisoftware.wrapper.WrapperSimpleApp and set following properties

    wrapper.java.mainclass=com.globasyslogger.startup.StartGLogger
    and commented following line
    #wrapper.app.parameter.1=com.globasyslogger.startup.StartGLogger

    As a service it run but still have problem. Then i run the same using command prompt removing -Dwrapper.key=NNN

    "D:\Program Files\Java\jre1.6.0\bin\java.exe" -Djava.library.path="../lib;../../lib" -classpath "../lib/wrapper.jar;../../resources;../../lib;../../GlobasysLogger.jar" -Dwrapper.port=32000 -Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -Dwrapper.debug="TRUE" -Dwrapper.pid=4820 -Dwrapper.version="3.3.0" -Dwrapper.native_library="wrapper" -Dwrapper.cpu.timeout="10" -Dwrapper.jvmid=1 com.globasyslogger.startup.StartGLogger

    And it works
    I implemented WrapperListener because on service start i need to initialize some params and on stop i need to uninitialise (release) the resources. It is working in command prompt but not as a service
    wrapper.conf file is
    #********************************************************************
    # Wrapper License Properties (Ignored by Community Edition)
    #********************************************************************
    #include ../conf/wrapper-license.conf
    # version 3.3.0 32 bit
    #********************************************************************
    # Wrapper Java Properties
    #********************************************************************
    # Java Application
    wrapper.java.command=D:\Program Files\Java\jre1.6.0\bin\java.exe

    # Java Main class. This class must implement the WrapperListener interface
    # or guarantee that the WrapperManager class is initialized. Helper
    # classes are provided to do this for you. See the Integration section
    # of the documentation for details.
    #wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp
    wrapper.java.mainclass=com.globasyslogger.startup.StartGLogger

    # Java Classpath (include wrapper.jar) Add class path elements as
    # needed starting from 1
    wrapper.java.classpath.1=../lib/wrapper.jar
    wrapper.java.classpath.2=../../resources
    wrapper.java.classpath.3=../../lib
    wrapper.java.classpath.4=../../GlobasysLogger.jar

    # Java Library Path (location of Wrapper.DLL or libwrapper.so)
    wrapper.java.library.path.1=../lib
    wrapper.java.library.path.2=../../lib

    # Java Additional Parameters
    #wrapper.java.additional.1=

    # Initial Java Heap Size (in MB)
    #wrapper.java.initmemory=3

    # Maximum Java Heap Size (in MB)
    #wrapper.java.maxmemory=64

    # Application parameters. Add parameters as needed starting from 1
    #wrapper.app.parameter.1=com.globasyslogger.startup.StartGLogger

    #********************************************************************
    # Wrapper Logging Properties
    #********************************************************************
    # Format of output for the console. (See docs for formats)
    wrapper.console.format=PM

    # Log Level for console output. (See docs for log levels)
    wrapper.console.loglevel=INFO

    # Log file to use for wrapper output logging.
    wrapper.logfile=../logs/wrapper.log

    # Format of output for the log file. (See docs for formats)
    wrapper.logfile.format=LPTM

    # Log Level for log file output. (See docs for log levels)
    wrapper.logfile.loglevel=INFO

    # Maximum size that the log file will be allowed to grow to before
    # the log is rolled. Size is specified in bytes. The default value
    # of 0, disables log rolling. May abbreviate with the 'k' (kb) or
    # 'm' (mb) suffix. For example: 10m = 10 megabytes.
    wrapper.logfile.maxsize=0

    # Maximum number of rolled log files which will be allowed before old
    # files are deleted. The default value of 0 implies no limit.
    wrapper.logfile.maxfiles=0

    # Log Level for sys/event log output. (See docs for log levels)
    wrapper.syslog.loglevel=NONE

    #********************************************************************
    # Wrapper Windows Properties
    #********************************************************************
    # Title to use when running as a console
    wrapper.console.title=Globasys Logger

    #********************************************************************
    # Wrapper Windows NT/2000/XP Service Properties
    #********************************************************************
    # WARNING - Do not modify any of these properties when an application
    # using this configuration file has been installed as a service.
    # Please uninstall the service before modifying this section. The
    # service can then be reinstalled.

    # Name of the service
    wrapper.ntservice.name=Globasys Logger

    # Display name of the service
    wrapper.ntservice.displayname=Globasys Logger

    # Description of the service
    wrapper.ntservice.description=Service installed by Globasys Logger application

    # Service dependencies. Add dependencies as needed starting from 1
    wrapper.ntservice.dependency.1=

    # Mode in which the service is installed. AUTO_START or DEMAND_START
    wrapper.ntservice.starttype=AUTO_START

    # Allow the service to interact with the desktop.
    #wrapper.ntservice.interactive=true
    #wrapper.ntservice.console=true
    wrapper.ntservice.account=.\Administrator
    wrapper.ntservice.password=123123
    wrapper.debug=true

     
  • SOPC

    SOPC - 2008-05-17

    Logged In: YES
    user_id=1821955
    Originator: YES

    Please help,

    I have a question, Why following command don't work

    "D:\Program Files\Java\jre1.6.0\bin\java.exe" -Djava.library.path="C:\Program Files\GlobasysLogger\Java Service Wrapper\lib;C:\Program Files\Globasys Logger\lib" -classpath "C:\Program Files\Globasys Logger\Java Service Wrapper\lib\wrapper.jar;C:\Program Files\Globasys Logger\resources;C:\Program Files\Globasys Logger\lib;C:\Program Files\Globasys Logger\GlobasysLogger.jar;C:\Program Files\Globasys Logger\tools.jar" -Dwrapper.port=32000 -Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -Dwrapper.debug="TRUE" -Dwrapper.pid=7576 -Dwrapper.version="3.3.0" -Dwrapper.native_library="wrapper" -Dwrapper.cpu.timeout="10" -Dwrapper.jvmid=1 org.tanukisoftware.wrapper.WrapperSimpleApp com.globasyslogger.startup.StartGLogger

    And Following command works perfectly
    "D:\Program Files\Java\jre1.6.0\bin\java.exe" -Djava.library.path="C:\Program Files\Globasys Logger\lib" -classpath "C:\Program Files\Globasys Logger\resources;C:\Program Files\Globasys Logger\lib;C:\Program Files\Globasys Logger\GlobasysLogger.jar;C:\Program Files\Globasys Logger\tools.jar" com.globasyslogger.startup.StartGLogger

    What is the difference?
    The error i get in the back end is

    javafish.clients.opc.exception.ConnectivityException: The connection to the OPC Server has failed: localhost->OPCServer.WinCC
    at javafish.clients.opc.JCustomOpc.connect(JCustomOpc.java:204)
    at com.globasyslogger.logger.OPCMap.connectAndRegisterGroupsOfAllOpcs(OPCMap.java:90)
    at com.globasyslogger.logger.SynchronousGroupReader.run(SynchronousGroupReader.java:147)
    at java.lang.Thread.run(Unknown Source)

    In first command if i replace org.tanukisoftware.wrapper.WrapperSimpleApp with com.globasyslogger.startup.StartGLogger it also works but then it restarts the JVM again and again

    Everything is same (except in first case i use WrapperSimpleApp to launch and in second case i launched directly)then why is the error?

    Please find the code for startLogger class below
    public class StartGLogger {
    private static Logger logger = Logger.getLogger(StartGLogger.class.getName());

    public static void main\(String\[\] args\) \{
        try \{
            if \(\!LicenseObj.getLicenseObject\(\).isValidLicence\(\)\) \{
                logger.error\("INVALID LICENSE"\);
                return;
            \}
            logger.error\("coinitilize JOPC"\);
            JOpc.coInitialize\(\);
            logger.error\("after coinitilize JOPC"\);
        \} catch \(CoInitializeException e\) \{
            logger.error\(e\);
        \}
        try \{
            Runtime.getRuntime\(\).addShutdownHook\(new Thread\(\) \{
                public void run\(\) \{
                    endApp\(\);
                \}
            \}\);
            Thread t = new Thread\(new LoggerJob\(\)\);
            t.start\(\);
            logger.error\("main finished"\);
        \} catch \(Exception e\) \{
            logger.error\(e\);
        \}
    \}
    
    public static void endApp\(\) \{
        try \{
            logger.error\("in shutdown hook"\);
            JOpc.coUninitialize\(\);
        \} catch \(Exception e\) \{
            logger.error\(e\);
        \}
    \}
    

    }

    Thanks
    SOPC

     
  • Leif Mortenson

    Leif Mortenson - 2008-05-19

    Logged In: YES
    user_id=228081
    Originator: NO

    The addition of the wrapper.jar to the classpath and the lib directory to the library path appear to be the only changes.
    The WrapperSimpleApp class does nothing special re class loaders so I can think of nothing that might be caused by that.

    What about the port? The Wrapper process has allocated port 32000 and the WrapperManager from java most likely allocated port 31000.
    I was trying to figure out what the javafish.clients.opc.JCustomOpc class was? But didn't find much and am not sure what the jar does.

    As an experiment, you can try changing the ports the wrapper uses like this:
    wrapper.port=16123
    wrapper.jvm.port=16124

    Can't think of anything else that would be causing any problems for your application. If I knew what was happening in the source where that stack trace took place I might have more ideas.

    Cheers,
    Leif

     
  • SOPC

    SOPC - 2008-05-20

    EasyOPC

     
  • SOPC

    SOPC - 2008-05-20

    Logged In: YES
    user_id=1821955
    Originator: YES

    I have tried changing the port. Still gives the same error.
    I am also attaching the source files for OPC which is opensource and it needs JCustomOpc.dll which is placed in lib file.

    If i replace
    org.tanukisoftware.wrapper.WrapperSimpleApp
    with
    com.globasyslogger.startup.StartGLogger
    The command run and don't throw this exception.
    I am wondering what might be the problem?

    File Added: javafish.zip

     
  • Leif Mortenson

    Leif Mortenson - 2008-05-22

    Logged In: YES
    user_id=228081
    Originator: NO

    Looking at the source for the JCustomOPC class, it looks like the native method connectServer is making a COMM call.

    There have been other COM related problems in the past. See this page:
    http://wrapper.tanukisoftware.org/doc/english/faq.html#4

    Note the comment about the JAVA_HOME environment variable and javax.comm.properties file.

    Try doing a Google search on javax.comm.properties

    I do not have any experience personally with COMM so sorry if I am not directly helpful.

    If you get it figured out or have more information, be sure to post back here.

    Cheers,
    Leif

     

Log in to post a comment.