Skip to main content



      Home
Home » Eclipse Projects » e(fx)clipse » Classloader Problem with e4fx
Classloader Problem with e4fx [message #1371372] Wed, 21 May 2014 06:43 Go to next message
Eclipse UserFriend
Hello

we build rich client applications which connect to a JBoss application server (wildfly). This is succesfully implemented using equinox and basic e4 SWT.

Using the e4fx runtime I get the following error when trying to create the InitialContext for the connection:

Caused by: javax.naming.NoInitialContextException: Cannot instantiate class: org.jboss.naming.remote.client.InitialContextFactory [Root exception is java.lang.ClassNotFoundException: org.jboss.naming.remote.client.InitialContextFactory]
	at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:674)
	at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:313)
	at javax.naming.InitialContext.init(InitialContext.java:244)
	at javax.naming.InitialContext.<init>(InitialContext.java:216)
	at de.emsw.gosa.service.as.InitialContextFactory.getInitialContext(InitialContextFactory.java:21)
	... 34 more
Caused by: java.lang.ClassNotFoundException: org.jboss.naming.remote.client.InitialContextFactory
	at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:340)
	at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:72)
	at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:61)
	at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:672)
	... 38 more

The class org.jboss.naming.remote.client.InitialContextFactory is in a wrapper plug-in for the jboss-client.jar. The class javax.naming.InitialContext is in the JDK 8.

On a whim I deactivated the setting of the ContextClassLoader in E4Application line 97, since the comment states, that this is only needed on OS-X (and we are developing for Windows):

Thread.currentThread().setContextClassLoader(Application.class.getClassLoader());

And now it works. Surprised

I admit, that I'm not 100% sure of how to handle this. Should the setting of the classloader only be done when running on OS-X? Or is there a another way to handle this, maybe by using the Eclipse-BuddyPolicy (register the jboss-client plugin to use the same classloader as org.eclipse.fx.ui.workbenach.fx)? Or am I missing something all together?

Thanks for your time!
Re: Classloader Problem with e4fx [message #1371390 is a reply to message #1371372] Wed, 21 May 2014 06:52 Go to previous messageGo to next message
Eclipse UserFriend
I think the context-classloader trick is not needed anymore on Java8!
File a bug and we will remove it!

Tom

On 21.05.14 12:43, Christoph Keimel wrote:
> Hello
>
> we build rich client applications which connect to a JBoss application
> server (wildfly). This is succesfully implemented using equinox and
> basic e4 SWT.
>
> Using the e4fx runtime I get the following error when trying to create
> the InitialContext for the connection:
>
> Caused by: javax.naming.NoInitialContextException: Cannot instantiate
> class: org.jboss.naming.remote.client.InitialContextFactory [Root
> exception is java.lang.ClassNotFoundException:
> org.jboss.naming.remote.client.InitialContextFactory]
> at
> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:674)
> at
> javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:313)
> at javax.naming.InitialContext.init(InitialContext.java:244)
> at javax.naming.InitialContext.<init>(InitialContext.java:216)
> at
> de.emsw.gosa.service.as.InitialContextFactory.getInitialContext(InitialContextFactory.java:21)
>
> ... 34 more
> Caused by: java.lang.ClassNotFoundException:
> org.jboss.naming.remote.client.InitialContextFactory
> at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
> at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> at java.lang.Class.forName0(Native Method)
> at java.lang.Class.forName(Class.java:340)
> at
> com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:72)
> at
> com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:61)
> at
> javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:672)
> ... 38 more
> The class org.jboss.naming.remote.client.InitialContextFactory is in a
> wrapper plug-in for the jboss-client.jar. The class
> javax.naming.InitialContext is in the JDK 8.
>
> On a whim I deactivated the setting of the ContextClassLoader in
> E4Application line 97, since the comment states, that this is only
> needed on OS-X (and we are developing for Windows):
>
> Thread.currentThread().setContextClassLoader(Application.class.getClassLoader());
>
> And now it works. :o
> I admit, that I'm not 100% sure of how to handle this. Should the
> setting of the classloader only be done when running on OS-X? Or is
> there a another way to handle this, maybe by using the
> Eclipse-BuddyPolicy (register the jboss-client plugin to use the same
> classloader as org.eclipse.fx.ui.workbenach.fx)? Or am I missing
> something all together?
>
> Thanks for your time!
Re: Classloader Problem with e4fx [message #1371609 is a reply to message #1371390] Wed, 21 May 2014 09:03 Go to previous message
Eclipse UserFriend
Bug 435392: https://bugs.eclipse.org/bugs/show_bug.cgi?id=435392
Previous Topic:How to retrieve a Scene in an e4 application?
Next Topic:Activation of the window context
Goto Forum:
  


Current Time: Fri Apr 18 10:36:12 EDT 2025

Powered by FUDForum. Page generated in 0.23983 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top