ClassNotFoundException with WrapperSimpleApp

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

ClassNotFoundException with WrapperSimpleApp

Lin Zhao
My previous post didn't get through so I'm reposting.

I've been trying to use WrapperSimpleApp and have a ClassNotFoundException that I can't explain.

The .conf has the jar that includes the main class, and you can see from the wrapper debug log that it's included to -classpath. But the wrapper fails to find it.

Attaching the wrapper debug log.

In the log, you can see:

DEBUG  | wrapper  | 2014/08/18 15:19:08 |   Command[7] : ../lib/martini.jar:../lib/wrapper.jar


martini.jar has  com.exabeam.martini.Martini, yet the wrapper can't find it.

INFO   | jvm 1    | 2014/08/18 15:19:08 | WrapperSimpleApp Error: Unable to locate the class com.exabeam.martini.Martini : java.lang.ClassNotFoundException: com.exabeam.martini.Martini

When the wrapper repeatedly retries, I captured the task command (via ps) as:

 501 44180 44168   0  9:57PM ttys008    0:00.47 /usr/bin/java -d64 -Dlog4j.configuration=file:///Users/lin/git/exabeam/martini/src/main/resources/log4j.properties -Dspark.cleaner.ttl=300 -Xmx14000m -Djava.library.path=../lib -classpath ../lib/martini.jar:../lib/wrapper.jar -Dwrapper.key=JXisZluSb14SpUBv -Dwrapper.port=32000 -Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -Dwrapper.debug=TRUE -Dwrapper.pid=44168 -Dwrapper.version=3.5.25 -Dwrapper.native_library=wrapper -Dwrapper.arch=universal -Dwrapper.cpu.timeout=10 -Dwrapper.jvmid=3 org.tanukisoftware.wrapper.WrapperSimpleApp com.exabeam.martini.Martini /Users/lin/git/exabeam/martini/config/custom/exabeam_config_imperva.conf


If I run below command directly, WrapperSimpleApp is able to find and launch my main method, after which it failed for application specific reason.

java -classpath ../lib/martini.jar:../lib/wrapper.jar org.tanukisoftware.wrapper.WrapperSimpleApp com.exabeam.martini.Martini /Users/lin/git/exabeam/martini/config/custom/exabeam_config_imperva.conf

Output:

WrapperManager: Initializing...

WrapperManager: WARNING - The version of the Wrapper which launched this JVM is

WrapperManager:           "unknown" while the version of the native library

WrapperManager:           is "3.5.25".

WrapperManager:           The Wrapper may appear to work correctly but some features may

WrapperManager:           not function correctly.  This configuration has not been tested

WrapperManager:           and is not supported.

WrapperManager: 

2014-08-18 22:00:11.924 INFO  ***********************

2014-08-18 22:00:11.925 INFO    Martini started.

Attaching the log and the conf. Thanks for the help.

------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Wrapper-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wrapper-user

martini.conf (11K) Download Attachment
martini (88K) Download Attachment
wrapper.log (16K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: ClassNotFoundException with WrapperSimpleApp

Leif Mortenson-3
Lin,
I am sorry for the very slow reply.  We somehow missed that this mail was stuck in moderation.

I think this is a problem with your working directory.   Remember that when the Wrapper runs, it ALWAYS forces the current working directory to be the location of the wrapper binary.
This is done so that the Wrapper runs consistently regardless of how the Wrapper is launched.
In your case, when running with the Wrapper, the working directory is:
/Users/lin/git/exabeam/martini/java-wrapper/bin

I am not 100% sure what it is when you are running directly with your command line.
In both cases, your classpath looks like this:
../lib/martini.jar:../lib/wrapper.jar

In the case of running with the Wrapper, this would mean that these files are both located in the following directory:
/Users/lin/git/exabeam/martini/java-wrapper/lib

A couple things that are confusing to me:

1) If the jar files had not been found, you would be seeing a message like the following in the logs just before the JVM is launched:
DEBUG  | wrapper  | 2014/09/01 16:02:40.255 |          | Classpath element, wrapper.java.classpath.3, does not exist: ../lib/foo.jar
DEBUG  | wrapper  | 2014/09/01 16:02:40.255 |          | Classpath element, wrapper.java.classpath.4, does not exist: ../xxx/bar.jar
The lack of these messages in the log makes it look like both files exist

2) How are you launching the Wrapper?  Is this on system startup?  The working directory of the parent that launched the Wrapper was the root directory:
DEBUG  | wrapper  | 2014/08/18 22:06:42 |   P--W- | WRAPPER_INIT_DIR=/
This should not matter as the working directory was correctly changed to the location of the Wrapper binary:
DEBUG  | wrapper  | 2014/08/18 22:06:42 |   ---W- | WRAPPER_WORKING_DIR=/Users/lin/git/exabeam/martini/java-wrapper/bin

In both cases, the WrapperSimpleApp class is being located and loaded correctly.  That class simply locates the "com.exabeam.martini.Martini" class by name in the same ClassLoader without doing anything special.

If none of these hints help, would it be possible to get a tar of your application sent to [hidden email]?  We should only need the martini.jar to be able to see if it locates your main class.  But I am also interested in seeing the relative location of files.

Cheers,
Leif






On Tue, Aug 19, 2014 at 2:13 PM, Lin Zhao <[hidden email]> wrote:
My previous post didn't get through so I'm reposting.

I've been trying to use WrapperSimpleApp and have a ClassNotFoundException that I can't explain.

The .conf has the jar that includes the main class, and you can see from the wrapper debug log that it's included to -classpath. But the wrapper fails to find it.

Attaching the wrapper debug log.

In the log, you can see:

DEBUG  | wrapper  | 2014/08/18 15:19:08 |   Command[7] : ../lib/martini.jar:../lib/wrapper.jar


martini.jar has  com.exabeam.martini.Martini, yet the wrapper can't find it.

INFO   | jvm 1    | 2014/08/18 15:19:08 | WrapperSimpleApp Error: Unable to locate the class com.exabeam.martini.Martini : java.lang.ClassNotFoundException: com.exabeam.martini.Martini

When the wrapper repeatedly retries, I captured the task command (via ps) as:

 501 44180 44168   0  9:57PM ttys008    0:00.47 /usr/bin/java -d64 -Dlog4j.configuration=file:///Users/lin/git/exabeam/martini/src/main/resources/log4j.properties -Dspark.cleaner.ttl=300 -Xmx14000m -Djava.library.path=../lib -classpath ../lib/martini.jar:../lib/wrapper.jar -Dwrapper.key=JXisZluSb14SpUBv -Dwrapper.port=32000 -Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -Dwrapper.debug=TRUE -Dwrapper.pid=44168 -Dwrapper.version=3.5.25 -Dwrapper.native_library=wrapper -Dwrapper.arch=universal -Dwrapper.cpu.timeout=10 -Dwrapper.jvmid=3 org.tanukisoftware.wrapper.WrapperSimpleApp com.exabeam.martini.Martini /Users/lin/git/exabeam/martini/config/custom/exabeam_config_imperva.conf


If I run below command directly, WrapperSimpleApp is able to find and launch my main method, after which it failed for application specific reason.

java -classpath ../lib/martini.jar:../lib/wrapper.jar org.tanukisoftware.wrapper.WrapperSimpleApp com.exabeam.martini.Martini /Users/lin/git/exabeam/martini/config/custom/exabeam_config_imperva.conf

Output:

WrapperManager: Initializing...

WrapperManager: WARNING - The version of the Wrapper which launched this JVM is

WrapperManager:           "unknown" while the version of the native library

WrapperManager:           is "3.5.25".

WrapperManager:           The Wrapper may appear to work correctly but some features may

WrapperManager:           not function correctly.  This configuration has not been tested

WrapperManager:           and is not supported.

WrapperManager: 

2014-08-18 22:00:11.924 INFO  ***********************

2014-08-18 22:00:11.925 INFO    Martini started.

Attaching the log and the conf. Thanks for the help.


------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Wrapper-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wrapper-user
Reply | Threaded
Open this post in threaded view
|

Re: ClassNotFoundException with WrapperSimpleApp

Lin Zhao

Leif,

Thanks for the reply. We already had it figured out. It's the java version. My jar is built with sbt, and somehow the java 6 jvm can't find the main class. Once I ensure the right java 7 JAVA_HOME it works.

On Sep 1, 2014 12:58 AM, "Leif Mortenson" <[hidden email]> wrote:
Lin,
I am sorry for the very slow reply.  We somehow missed that this mail was stuck in moderation.

I think this is a problem with your working directory.   Remember that when the Wrapper runs, it ALWAYS forces the current working directory to be the location of the wrapper binary.
This is done so that the Wrapper runs consistently regardless of how the Wrapper is launched.
In your case, when running with the Wrapper, the working directory is:
/Users/lin/git/exabeam/martini/java-wrapper/bin

I am not 100% sure what it is when you are running directly with your command line.
In both cases, your classpath looks like this:
../lib/martini.jar:../lib/wrapper.jar

In the case of running with the Wrapper, this would mean that these files are both located in the following directory:
/Users/lin/git/exabeam/martini/java-wrapper/lib

A couple things that are confusing to me:

1) If the jar files had not been found, you would be seeing a message like the following in the logs just before the JVM is launched:
DEBUG  | wrapper  | 2014/09/01 16:02:40.255 |          | Classpath element, wrapper.java.classpath.3, does not exist: ../lib/foo.jar
DEBUG  | wrapper  | 2014/09/01 16:02:40.255 |          | Classpath element, wrapper.java.classpath.4, does not exist: ../xxx/bar.jar
The lack of these messages in the log makes it look like both files exist

2) How are you launching the Wrapper?  Is this on system startup?  The working directory of the parent that launched the Wrapper was the root directory:
DEBUG  | wrapper  | 2014/08/18 22:06:42 |   P--W- | WRAPPER_INIT_DIR=/
This should not matter as the working directory was correctly changed to the location of the Wrapper binary:
DEBUG  | wrapper  | 2014/08/18 22:06:42 |   ---W- | WRAPPER_WORKING_DIR=/Users/lin/git/exabeam/martini/java-wrapper/bin

In both cases, the WrapperSimpleApp class is being located and loaded correctly.  That class simply locates the "com.exabeam.martini.Martini" class by name in the same ClassLoader without doing anything special.

If none of these hints help, would it be possible to get a tar of your application sent to [hidden email]?  We should only need the martini.jar to be able to see if it locates your main class.  But I am also interested in seeing the relative location of files.

Cheers,
Leif






On Tue, Aug 19, 2014 at 2:13 PM, Lin Zhao <[hidden email]> wrote:
My previous post didn't get through so I'm reposting.

I've been trying to use WrapperSimpleApp and have a ClassNotFoundException that I can't explain.

The .conf has the jar that includes the main class, and you can see from the wrapper debug log that it's included to -classpath. But the wrapper fails to find it.

Attaching the wrapper debug log.

In the log, you can see:

DEBUG  | wrapper  | 2014/08/18 15:19:08 |   Command[7] : ../lib/martini.jar:../lib/wrapper.jar


martini.jar has  com.exabeam.martini.Martini, yet the wrapper can't find it.

INFO   | jvm 1    | 2014/08/18 15:19:08 | WrapperSimpleApp Error: Unable to locate the class com.exabeam.martini.Martini : java.lang.ClassNotFoundException: com.exabeam.martini.Martini

When the wrapper repeatedly retries, I captured the task command (via ps) as:

 501 44180 44168   0  9:57PM ttys008    0:00.47 /usr/bin/java -d64 -Dlog4j.configuration=file:///Users/lin/git/exabeam/martini/src/main/resources/log4j.properties -Dspark.cleaner.ttl=300 -Xmx14000m -Djava.library.path=../lib -classpath ../lib/martini.jar:../lib/wrapper.jar -Dwrapper.key=JXisZluSb14SpUBv -Dwrapper.port=32000 -Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -Dwrapper.debug=TRUE -Dwrapper.pid=44168 -Dwrapper.version=3.5.25 -Dwrapper.native_library=wrapper -Dwrapper.arch=universal -Dwrapper.cpu.timeout=10 -Dwrapper.jvmid=3 org.tanukisoftware.wrapper.WrapperSimpleApp com.exabeam.martini.Martini /Users/lin/git/exabeam/martini/config/custom/exabeam_config_imperva.conf


If I run below command directly, WrapperSimpleApp is able to find and launch my main method, after which it failed for application specific reason.

java -classpath ../lib/martini.jar:../lib/wrapper.jar org.tanukisoftware.wrapper.WrapperSimpleApp com.exabeam.martini.Martini /Users/lin/git/exabeam/martini/config/custom/exabeam_config_imperva.conf

Output:

WrapperManager: Initializing...

WrapperManager: WARNING - The version of the Wrapper which launched this JVM is

WrapperManager:           "unknown" while the version of the native library

WrapperManager:           is "3.5.25".

WrapperManager:           The Wrapper may appear to work correctly but some features may

WrapperManager:           not function correctly.  This configuration has not been tested

WrapperManager:           and is not supported.

WrapperManager: 

2014-08-18 22:00:11.924 INFO  ***********************

2014-08-18 22:00:11.925 INFO    Martini started.

Attaching the log and the conf. Thanks for the help.


------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Wrapper-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wrapper-user


------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Wrapper-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wrapper-user
Reply | Threaded
Open this post in threaded view
|

Re: ClassNotFoundException with WrapperSimpleApp

Leif Mortenson-3
Lin,
Thank you for the update.  I am glad you got it working.
I am curious what it was about the jar that was causing java 6 to fail to open it.
If it was problem with the class being compiled for Java 7 (which is too new) then that would have been a different exception.
We will try to look into this on this end as I don't like the way that error was misleading.  But I would appreciate it if you have any ideas from what you found.

Cheers,
Leif


On Tue, Sep 2, 2014 at 7:40 AM, Lin Zhao <[hidden email]> wrote:

Leif,

Thanks for the reply. We already had it figured out. It's the java version. My jar is built with sbt, and somehow the java 6 jvm can't find the main class. Once I ensure the right java 7 JAVA_HOME it works.

On Sep 1, 2014 12:58 AM, "Leif Mortenson" <[hidden email]> wrote:
Lin,
I am sorry for the very slow reply.  We somehow missed that this mail was stuck in moderation.

I think this is a problem with your working directory.   Remember that when the Wrapper runs, it ALWAYS forces the current working directory to be the location of the wrapper binary.
This is done so that the Wrapper runs consistently regardless of how the Wrapper is launched.
In your case, when running with the Wrapper, the working directory is:
/Users/lin/git/exabeam/martini/java-wrapper/bin

I am not 100% sure what it is when you are running directly with your command line.
In both cases, your classpath looks like this:
../lib/martini.jar:../lib/wrapper.jar

In the case of running with the Wrapper, this would mean that these files are both located in the following directory:
/Users/lin/git/exabeam/martini/java-wrapper/lib

A couple things that are confusing to me:

1) If the jar files had not been found, you would be seeing a message like the following in the logs just before the JVM is launched:
DEBUG  | wrapper  | 2014/09/01 16:02:40.255 |          | Classpath element, wrapper.java.classpath.3, does not exist: ../lib/foo.jar
DEBUG  | wrapper  | 2014/09/01 16:02:40.255 |          | Classpath element, wrapper.java.classpath.4, does not exist: ../xxx/bar.jar
The lack of these messages in the log makes it look like both files exist

2) How are you launching the Wrapper?  Is this on system startup?  The working directory of the parent that launched the Wrapper was the root directory:
DEBUG  | wrapper  | 2014/08/18 22:06:42 |   P--W- | WRAPPER_INIT_DIR=/
This should not matter as the working directory was correctly changed to the location of the Wrapper binary:
DEBUG  | wrapper  | 2014/08/18 22:06:42 |   ---W- | WRAPPER_WORKING_DIR=/Users/lin/git/exabeam/martini/java-wrapper/bin

In both cases, the WrapperSimpleApp class is being located and loaded correctly.  That class simply locates the "com.exabeam.martini.Martini" class by name in the same ClassLoader without doing anything special.

If none of these hints help, would it be possible to get a tar of your application sent to [hidden email]?  We should only need the martini.jar to be able to see if it locates your main class.  But I am also interested in seeing the relative location of files.

Cheers,
Leif






On Tue, Aug 19, 2014 at 2:13 PM, Lin Zhao <[hidden email]> wrote:
My previous post didn't get through so I'm reposting.

I've been trying to use WrapperSimpleApp and have a ClassNotFoundException that I can't explain.

The .conf has the jar that includes the main class, and you can see from the wrapper debug log that it's included to -classpath. But the wrapper fails to find it.

Attaching the wrapper debug log.

In the log, you can see:

DEBUG  | wrapper  | 2014/08/18 15:19:08 |   Command[7] : ../lib/martini.jar:../lib/wrapper.jar


martini.jar has  com.exabeam.martini.Martini, yet the wrapper can't find it.

INFO   | jvm 1    | 2014/08/18 15:19:08 | WrapperSimpleApp Error: Unable to locate the class com.exabeam.martini.Martini : java.lang.ClassNotFoundException: com.exabeam.martini.Martini

When the wrapper repeatedly retries, I captured the task command (via ps) as:

 501 44180 44168   0  9:57PM ttys008    0:00.47 /usr/bin/java -d64 -Dlog4j.configuration=file:///Users/lin/git/exabeam/martini/src/main/resources/log4j.properties -Dspark.cleaner.ttl=300 -Xmx14000m -Djava.library.path=../lib -classpath ../lib/martini.jar:../lib/wrapper.jar -Dwrapper.key=JXisZluSb14SpUBv -Dwrapper.port=32000 -Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -Dwrapper.debug=TRUE -Dwrapper.pid=44168 -Dwrapper.version=3.5.25 -Dwrapper.native_library=wrapper -Dwrapper.arch=universal -Dwrapper.cpu.timeout=10 -Dwrapper.jvmid=3 org.tanukisoftware.wrapper.WrapperSimpleApp com.exabeam.martini.Martini /Users/lin/git/exabeam/martini/config/custom/exabeam_config_imperva.conf


If I run below command directly, WrapperSimpleApp is able to find and launch my main method, after which it failed for application specific reason.

java -classpath ../lib/martini.jar:../lib/wrapper.jar org.tanukisoftware.wrapper.WrapperSimpleApp com.exabeam.martini.Martini /Users/lin/git/exabeam/martini/config/custom/exabeam_config_imperva.conf

Output:

WrapperManager: Initializing...

WrapperManager: WARNING - The version of the Wrapper which launched this JVM is

WrapperManager:           "unknown" while the version of the native library

WrapperManager:           is "3.5.25".

WrapperManager:           The Wrapper may appear to work correctly but some features may

WrapperManager:           not function correctly.  This configuration has not been tested

WrapperManager:           and is not supported.

WrapperManager: 

2014-08-18 22:00:11.924 INFO  ***********************

2014-08-18 22:00:11.925 INFO    Martini started.

Attaching the log and the conf. Thanks for the help.



------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Wrapper-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/wrapper-user