• Post Reply Bookmark Topic Watch Topic
  • New Topic

ExceptionInInitializerError when Looking up context  RSS feed

 
Kris Reid
Ranch Hand
Posts: 247
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The story is I have an application running on Sun App Server.
It needs to look up an EJB that is running on a Web Logic server.

The code that is throwing the exception is the last line below



This maybe be weblogic specific but I don't think so.
The error message is:


10-Mar-2006 16:44:58 com.sun.enterprise.appclient.Main <init>
WARNING: ACC003: Application threw an exception.
java.lang.ExceptionInInitializerError
at weblogic.common.internal.TengahClassLoaders.registerURL(TengahClassLoaders.java:51)
at weblogic.rjvm.RJVMImpl.loadFromCluster(RJVMImpl.java:1106)
at weblogic.jndi.WLInitialContextFactoryDelegate.newContext(WLInitialContextFactoryDelegate.java:249)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:205)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:148)
at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:123)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:197)
at WhoisServer$TextResponseListener.getInitialContext(Unknown Source)
at WhoisServer$TextResponseListener.<init>(Unknown Source)
at WhoisServer.recieve(Unknown Source)
at WhoisServer.main(Unknown Source)
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:585)
at com.sun.enterprise.util.Utility.invokeApplicationMain(Utility.java:237)
at com.sun.enterprise.appclient.Main.<init>(Main.java:430)
at com.sun.enterprise.appclient.Main.main(Main.java:99)
Caused by: java.security.AccessControlException: access denied (java.util.PropertyPermission * read,write)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
at java.security.AccessController.checkPermission(AccessController.java:427)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at java.lang.SecurityManager.checkPropertiesAccess(SecurityManager.java:1252)
at java.lang.System.getProperties(System.java:560)
at weblogic.net.http.Handler.init(Handler.java:43)
at weblogic.utils.classloaders.ServletClassFinder.<clinit>(ServletClassFinder.java:19)
... 21 more



I have been bashing my head against the wall for hours
I have no idea what to do or really what the problem is.

Any ideas what so ever?

Thanks

Kris

[ March 10, 2006: Message edited by: Kris Reid ]
[ March 10, 2006: Message edited by: Kris Reid ]
 
Reid M. Pinchback
Ranch Hand
Posts: 775
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd get rid of the spaces between the host name and the port, but more fundamentally you need to have the necessary Weblogic jars in your app. You can try using the weblogic client jars first; keep your fingers crossed, because I don't know anybody who has had luck with them (however things can improve with each new release!). Typically you end up needing the entire weblogic.jar file to make JNDI work. And yes, I mean the big fat jar that is the implementation of the WebLogic server itself. I don't think using the entire jar will be an option for an EJB app deployed to another server the way you can for a stand-alone app, but what you may have to do is find all the other libraries weblogic distributes that you have to use in addition to the client jar in order to make that client jar really work.
[ March 10, 2006: Message edited by: Reid M. Pinchback ]
 
Kris Reid
Ranch Hand
Posts: 247
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had to add a space between hostname and port so that it didn't come out as a smiley face

I have added every damn weblogic jar that I can find and bundled it with my app on the Sun server. I'll go make sure that I'm not missing anything.

But isn't this error a security problem?

Thanks heaps!

Kris
 
Kris Reid
Ranch Hand
Posts: 247
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just wrote a stand alone version of my application




This works perfect!

But when I run it on the Sun Appserve it still goes bang!
I have been using the deployment tool to make a jar - that only contains this .class file.

I then run it
appclient -client myApp.jar

I edited the appclient.bat to include all required external jars.
set CLASSPATH="%JAXP_IMPL_JARS%";%JVM_CLASSPATH%;%APPCPATH%;C:myOtherJar.jar

Any ideas what the problem is?
Is it something to do with permissions? As it has this line
java.lang.SecurityManager.checkPermission(SecurityManager.java:532)

Thanks for any ideas or thoughts

Kris




13-Mar-2006 12:47:23 com.sun.enterprise.appclient.Main <init>
WARNING: ACC003: Application threw an exception.
java.lang.ExceptionInInitializerError
at weblogic.common.internal.TengahClassLoaders.registerURL(TengahClassLoaders.java:51)
at weblogic.rjvm.RJVMImpl.loadFromCluster(RJVMImpl.java:1106)
at weblogic.jndi.WLInitialContextFactoryDelegate.newContext(WLInitialContextFactoryDelegate.java:249)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:205)
at weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialContextFactoryDelegate.java:148)
at weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFactory.java:123)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:197)
at WhoisServer$TextResponseListener.getInitialContext(Unknown Source)
at WhoisServer$TextResponseListener.<init>(Unknown Source)
at WhoisServer.recieve(Unknown Source)
at WhoisServer.main(Unknown Source)
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:585)
at com.sun.enterprise.util.Utility.invokeApplicationMain(Utility.java:237)
at com.sun.enterprise.appclient.Main.<init>(Main.java:430)
at com.sun.enterprise.appclient.Main.main(Main.java:99)
Caused by: java.security.AccessControlException: access denied (java.util.PropertyPermission * read,write)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
at java.security.AccessController.checkPermission(AccessController.java:427)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at java.lang.SecurityManager.checkPropertiesAccess(SecurityManager.java:1252)
at java.lang.System.getProperties(System.java:560)
at weblogic.net.http.Handler.init(Handler.java:43)
at weblogic.utils.classloaders.ServletClassFinder.<clinit>(ServletClassFinder.java:19)
... 21 more
 
Kris Reid
Ranch Hand
Posts: 247
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


It was a security problem!!
I added
permission java.util.PropertyPermission "*", "read,write";
to
AppServer\lib\appclient\client.policy

And my problems are solved!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!