Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Classloader issue when using WOBootstrap.jar #9

Open
alextu opened this issue Jul 4, 2013 · 8 comments
Open

Classloader issue when using WOBootstrap.jar #9

alextu opened this issue Jul 4, 2013 · 8 comments
Assignees
Labels

Comments

@alextu
Copy link

alextu commented Jul 4, 2013

When building a woa with wobootstrap.jar embedded, we get the following exception :

Caused by: javassist.NotFoundException: com.webobjects.foundation._NSUtilities
at javassist.ClassPool.get(ClassPool.java:450)
at com.woinject.WOInject.init(WOInject.java:66)
... 6 more

The current workaround is to build without wobootstrap.jar, but the launching generates a huge command line with the whole classpath appended

@hprange
Copy link
Owner

hprange commented Jul 5, 2013

Do you have a sample project that I could use to reproduce the problem?

@alextu
Copy link
Author

alextu commented Jul 5, 2013

Yes Henrique, here's a simple project that reproduces the problem :
https://docs.google.com/file/d/0B8bOJyPBBuTmdXdFeGxDS2pTSXM/edit?usp=sharing
I've only created a new Wonder project, added woinject libraries and modified the Application class.

@hprange
Copy link
Owner

hprange commented Jul 5, 2013

Thank you Alexis. I'll take a look during the weekend.

@mbits
Copy link

mbits commented Sep 6, 2013

Hi Henrique, has there been any progress with this issue, as I am unable to use WOInject because of this ? I'm really impressed with the current work on WOInject, and would like to use it in my applications, please let me know if it is still possible to use it without removing WOBootstrap.jar ?

@hprange
Copy link
Owner

hprange commented Sep 8, 2013

Hey guys,

Sorry for taking so long to solve this problem. I tried a lot of things, including a completely new solution using Java agents. In the end, one line of code seems to solve the problem. Could you try this [1] version of WOInject in your projects? Does it work?

[1] https://dl.dropboxusercontent.com/u/9599580/woinject-possible-wobootstrap-fix.jar

@mbits
Copy link

mbits commented Sep 9, 2013

Hi Henrique, your efforts are appreciated, however startup failed with the following exception. I tested with a new empty Wonder Application.

Exception encountered while loading zoneinfo from archive during NSTimeZone class initialization: Unable to get input stream for the timezone archive, "com/webobjects/foundation/TimeZoneInfo/zoneinfo.zip".
java.lang.IllegalStateException: Unable to get input stream for the timezone archive, "com/webobjects/foundation/TimeZoneInfo/zoneinfo.zip".
at com.webobjects.foundation.NSTimeZone.__loadZipEntriesFromZoneArchive(NSTimeZone.java:509)
at com.webobjects.foundation.NSTimeZone.(NSTimeZone.java:147)
at com.webobjects.foundation._NSUtilities.(_NSUtilities.java:178)
at com.webobjects.appserver.WOApplication.(WOApplication.java:323)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.woinject.WOInject.init(WOInject.java:92)
at your.app.Application.main(Application.java:11)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.webobjects._bootstrap.WOBootstrap.main(WOBootstrap.java:87)
Exception encountered while initializing NSTimeZone class: Unable to load timezone abbreviations table, "com/webobjects/foundation/TimeZoneInfo/Abbreviations.table".
java.lang.IllegalStateException: Unable to load timezone abbreviations table, "com/webobjects/foundation/TimeZoneInfo/Abbreviations.table".
at com.webobjects.foundation.NSTimeZone.__initTimeZoneVariables(NSTimeZone.java:388)
at com.webobjects.foundation.NSTimeZone.(NSTimeZone.java:154)
at com.webobjects.foundation._NSUtilities.(_NSUtilities.java:178)
at com.webobjects.appserver.WOApplication.(WOApplication.java:323)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.woinject.WOInject.init(WOInject.java:92)
at your.app.Application.main(Application.java:11)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.webobjects._bootstrap.WOBootstrap.main(WOBootstrap.java:87)
[2013-9-9 11:43:26 EST]

Initialized : er.extensions.ERXExtensions
WARN 11:43:27 NSLog - A fatal exception occurred: null
[2013-9-9 11:43:27 EST] java.lang.ExceptionInInitializerError
at com.webobjects.appserver.WOResourceManager.__getJavaWebObjectsResourceAsStream(WOResourceManager.java:116)
at com.webobjects.appserver._private.WOProperties.initUserDefaultsKeys(WOProperties.java:317)
at com.webobjects.appserver.WOApplication._initWOApp(WOApplication.java:5743)
at com.webobjects.appserver.WOApplication.(WOApplication.java:779)
at er.extensions.appserver.ajax.ERXAjaxApplication.(ERXAjaxApplication.java:24)
at er.extensions.appserver.ERXApplication.(ERXApplication.java:1036)
at com.woinject.InjectableApplication.(InjectableApplication.java:61)
at your.app.Application.(Application.java:14)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at com.webobjects.appserver.WOApplication.main(WOApplication.java:547)
at er.extensions.appserver.ERXApplication.main(ERXApplication.java:820)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.woinject.WOInject.init(WOInject.java:92)
at your.app.Application.main(Application.java:11)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.webobjects._bootstrap.WOBootstrap.main(WOBootstrap.java:87)
Caused by: com.webobjects.foundation.NSForwardException [java.lang.ExceptionInInitializerError] null:java.lang.ExceptionInInitializerError
at com.webobjects.foundation.NSForwardException._runtimeExceptionForThrowable(NSForwardException.java:39)
at com.webobjects.foundation.NSSelector._safeInvokeMethod(NSSelector.java:124)
at com.webobjects.foundation.NSNotificationCenter$_Entry.invokeMethod(NSNotificationCenter.java:588)
at com.webobjects.foundation.NSNotificationCenter.postNotification(NSNotificationCenter.java:532)
at er.extensions.appserver.ERXApplication$Loader.bundleDidLoad(ERXApplication.java:667)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.webobjects.foundation.NSSelector._safeInvokeMethod(NSSelector.java:122)
at com.webobjects.foundation.NSNotificationCenter$_Entry.invokeMethod(NSNotificationCenter.java:588)
at com.webobjects.foundation.NSNotificationCenter.postNotification(NSNotificationCenter.java:532)
at com.webobjects.foundation.NSNotificationCenter.postNotification(NSNotificationCenter.java:562)
at com.webobjects.foundation.NSBundle.postNotification(NSBundle.java:2546)
at com.webobjects.foundation.NSBundle.LoadBundlesFromClassPath(NSBundle.java:748)
at com.webobjects.foundation.NSBundle.(NSBundle.java:373)
... 27 more
Caused by: java.lang.ExceptionInInitializerError
at com.webobjects.eocontrol.EOClassDescription.(EOClassDescription.java:149)
at er.extensions.ERXExtensions.bundleDidLoad(ERXExtensions.java:230)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.webobjects.foundation.NSSelector._safeInvokeMethod(NSSelector.java:122)
... 41 more
Caused by: java.lang.NullPointerException
at com.webobjects.foundation.NSTimeZone.knownTimeZoneNames(NSTimeZone.java:875)
at com.webobjects.foundation.NSTimestampFormatter._getDefaultZoneStrings(NSTimestampFormatter.java:334)
at com.webobjects.foundation.NSTimestampFormatter.(NSTimestampFormatter.java:254)
... 48 more

@alextu
Copy link
Author

alextu commented Dec 1, 2013

Thanks for your work Henrique, but I got the same error as mbits :
Exception encountered while loading zoneinfo from archive during NSTimeZone class initialization: Unable to get input stream for the timezone archive, "com/webobjects/foundation/TimeZoneInfo/zoneinfo.zip".
java.lang.IllegalStateException: Unable to get input stream for the timezone archive, "com/webobjects/foundation/TimeZoneInfo/zoneinfo.zip".
at com.webobjects.foundation.NSTimeZone.__loadZipEntriesFromZoneArchive(NSTimeZone.java:509)
at com.webobjects.foundation.NSTimeZone.(NSTimeZone.java:147)
at com.webobjects.foundation._NSUtilities.(_NSUtilities.java:179)
at com.webobjects.appserver.WOApplication.(WOApplication.java:323)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.woinject.WOInject.init(WOInject.java:92)
at org.cocktail.appvalidationcenter.Application.main(Application.java:56)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.webobjects._bootstrap.WOBootstrap.main(WOBootstrap.java:87)

Looks like a classloader problem :

ZipInputStream zis = null;
is = NSTimeZone.class.getClassLoader().getResourceAsStream("com/webobjects/foundation/TimeZoneInfo/zoneinfo.zip");
if (is == null) {
is = ClassLoader.getSystemClassLoader().getResourceAsStream("com/webobjects/foundation/TimeZoneInfo/zoneinfo.zip");
}
if (is == null)
throw new IllegalStateException("Unable to get input stream for the timezone archive, "com/webobjects/foundation/TimeZoneInfo/zoneinfo.zip".");

@hprange
Copy link
Owner

hprange commented Dec 4, 2013

Hi Alexis,

You're right. It's a class loader problem. Unfortunately, the problem can't be fixed unless we create a custom version of the WOBootstrap.jar.

If no one has an alternative to this problem, I'd like to document this as a WOInject restriction and ask users to build their projects without the WOBootstrap.jar.

Sorry about that.

@hprange hprange modified the milestone: woinject-1.1.1 Feb 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants