Skip to main content

Problem running standalone Glassfish client as Eclipse plugin

20 replies [Last post]
dmt_
Offline
Joined: 2009-12-22
Points: 0

Hello,

I'm developing a standalone client that invokes some EJB methods on Glassfish v3. This works well until I'm integrating the client into an Eclipse plugin for running in our RCP application. In this setting there seems to be a classloader problem on initializing the naming context and I get the exception listed below. (The client has gf-client.jar and all its dependencies on its classpath.)

Has anybody an idea how to solve this problem?

Thanks,
Dominik

java.lang.NoSuchMethodException: org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findResources(java.lang.String)
at java.lang.Class.getMethod(Class.java:1605)
at com.sun.enterprise.module.single.ManifestProxy.(ManifestProxy.java:34)
at com.sun.enterprise.module.single.ProxyModuleDefinition.(ProxyModuleDefinition.java:78)
at com.sun.enterprise.module.single.ProxyModuleDefinition.(ProxyModuleDefinition.java:73)
at com.sun.enterprise.module.single.SingleModulesRegistry.(SingleModulesRegistry.java:42)
at com.sun.enterprise.module.single.SingleModulesRegistry.(SingleModulesRegistry.java:30)
at com.sun.enterprise.module.single.StaticModulesRegistry.(StaticModulesRegistry.java:60)
at org.glassfish.internal.api.Globals.getStaticHabitat(Globals.java:67)
at com.sun.enterprise.naming.impl.SerialContext.(SerialContext.java:183)
at com.sun.enterprise.naming.impl.SerialContext.(SerialContext.java:253)
at com.sun.enterprise.naming.impl.SerialInitContextFactory.createInitialContext(SerialInitContextFactory.java:121)
at com.sun.enterprise.naming.impl.SerialInitContextFactory.getInitialContext(SerialInitContextFactory.java:116)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.(InitialContext.java:175)

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
ansis
Offline
Joined: 2006-08-11
Points: 0

Dear Stephan

we are also developing an Eclipse RCP client on 3.5.2 and would like to move from GFv2.1.1 to GFv3. We're hitting slightly different problems: the lookup for the first session bean succeeds, but the second fails with the following exception:

+++++++++++++++++++++++++++++++++++

javax.naming.NamingException: Lookup failed for 'com.ansis.timetracker.server.session.remote.DashboardFacadeBeanRemote' in SerialContext targetHost=localhost,targetPort=30037,orb'sInitialHost=localhost,orb'sInitialPort=3700 [Root exception is javax.naming.NamingException: ejb ref resolution error for remote business interfacecom.ansis.timetracker.server.session.remote.DashboardFacadeBeanRemote [Root exception is java.lang.RuntimeException: Could not invoke defineClass!]]
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:442)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at com.ansis.timetracker.client.ClientActivator.getDashboardFacadeBean(ClientActivator.java:940)
... 3 more
Caused by: javax.naming.NamingException: ejb ref resolution error for remote business interfacecom.ansis.timetracker.server.session.remote.DashboardFacadeBeanRemote [Root exception is java.lang.RuntimeException: Could not invoke defineClass!]
at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:430)
at com.sun.ejb.containers.RemoteBusinessObjectFactory.getObjectInstance(RemoteBusinessObjectFactory.java:70)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
at com.sun.enterprise.naming.impl.SerialContext.getObjectInstance(SerialContext.java:472)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:437)
... 5 more
Caused by: java.lang.RuntimeException: Could not invoke defineClass!
at com.sun.corba.ee.impl.orbutil.codegen.CodeGeneratorUtil.makeClass(CodeGeneratorUtil.java:98)
at com.sun.corba.ee.spi.orbutil.codegen.Wrapper._generate(Wrapper.java:1102)
at com.sun.corba.ee.spi.orbutil.codegen.Wrapper._generate(Wrapper.java:1086)
at com.sun.ejb.EJBUtils.generateAndLoad(EJBUtils.java:586)
at com.sun.ejb.EJBUtils.loadGeneratedGenericEJBHomeClass(EJBUtils.java:538)
at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:399)
... 9 more
Caused by: java.lang.reflect.InvocationTargetException
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.sun.corba.ee.impl.orbutil.codegen.CodeGeneratorUtil.makeClass(CodeGeneratorUtil.java:95)
... 14 more
Caused by: java.lang.LinkageError: loader (instance of org/eclipse/core/runtime/internal/adaptor/ContextFinder): attempted duplicate class definition for name: "com/sun/ejb/codegen/GenericEJBHome_Generated"
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:698)
... 19 more

+++++++++++++++++++++++++++

It seems you solved the problem. Could you perhaps post the MANIFEST.MF files of your various plugins? I attach mine, which currently includes all Jars from the modules dir.

Also, did you manage to reduce the number of included Jar files? I think it is very inconvenient to include all Jars from the modules dir (a full 55MB), when in GF2.1.1 we only needed to include a handful of jars.

Thanks

yetanotherone
Offline
Joined: 2006-11-14
Points: 0

Hi,

unfortunately I have some bad news for you. My earlier post was a little premature, the solution I posted didn't work reliable enough, so we switched back to V2.1.1. That is also why I don't have my original manifest files anymore. I took a look at your manifest and from what I remember it looks similar to mine, only I had this line included:
Eclipse-BuddyPolicy: dependent.
I had to change the classloading policy because my glassfish plugin needed to access classes that were defined in a different plugin.
Anyway, your exception looks a bit different, although it appears to be a classloading issue, too.

As for the jars, I tried to add fewer jars, but at some point there was always one jar missing and I ended up including all.

Sorry, I couldn't really help you.
Stephan

ansis
Offline
Joined: 2006-08-11
Points: 0

Thanks for your reply, Stephan - this is really a shame.

Is anybody out there, who succeeded in running an Eclipse RCP app with GFv3 server over RMI? Is this such a rare thing?

Oracle/developers of GFv3: please provide the user community with a tried-and-tested solution, which allows us to include only the necessary Jars, not the entire kitchen sink in our Eclipse plugins (for example, I find it hard to believe that for RMI-based communication we need Grizzly and Web Services Jars).

This is currently a blocking issue for starting to migrate to GFv3 for us. I'm sure we're not alone with this (see also this related thread: http://forums.java.net/jive/thread.jspa?messageID=470777)

Anybody?

Many thanks, Andreas

tjquinn
Offline
Joined: 2005-03-30
Points: 0

Maybe the tools folks can add something about building an Eclipse RCP app.

About the long list of JARs required...

We don't have anything that maps the features a client needs to the JARs that must be present (for example, which JARs are needed for a client that accesses web services only). The list of JARs provided by the package-appclient script is designed to support [i]all[/i] possible client requirements. Indeed, that will normally be a longer list than is required by any one client.

Maybe some day we will have such a map that can help optimize the JAR list, but until then I'm afraid we have to live with the long list of JARs.

- Tim

ansis
Offline
Joined: 2006-08-11
Points: 0

OK, fine. Having 60MB of Jars instead of about 5MB is at least not a blocker.

But right now, even with all Jars included, we cannot lookup more than one Session bean from an Eclipse plugin (see earlier posts), so that is unfortunately a blocker.

Tim, can you perhaps forward this problem to the relevant folks? Maybe they already have a solution, or it's much easier for them to find it. As you see, there is quite a number of people with the same problem.

Thanks,
- Andreas

aszomor
Offline
Joined: 2009-08-06
Points: 0

Dear Andreas and Tim,

We would like to use Eclipse RCP client too thus if you find a solution for it (standalone or embedded ACC) I please you to public a short guide to us.

Thanks a lot, Attila.

tjquinn
Offline
Joined: 2005-03-30
Points: 0

I am not at all familiar with the mechanics of Eclipse RCP, so I apologize in advance if this is of no help.

The gf-client.jar is not an OSGi module. It has a long manifest Class-Path which identifies all the JARs on which it depends. Many developers have already discovered this for one reason or another.

There are actually very few classes in gf-client.jar. Most of the classes and resources related to the app client container are in gf-client-module.jar which is an OSGi module. The items in gf-client.jar should be needed only when a user launches an app client using the appclient script.

Again, apologies for not being more familiar with this, but would it help to somehow use the gf-client-module.jar (given that it's an OSGi module) in the Eclipse RCP process?

- Tim

ansis
Offline
Joined: 2006-08-11
Points: 0

Dear Tim,

as per your suggestion, I tried two things:

1.) take the list of Jars on the ClassPath setting of the gf-client-module.jar and use it in our own Eclipse plugin's MANIFEST.MF. The entire solution is documented under: http://ansis.com/know-how/software-development/glassfish/eclipse-rcp-sta...

Unfortunately, it keeps throwing the usual "java.lang.LinkageError: loader (instance of org/eclipse/core/runtime/internal/adaptor/ContextFinder): attempted duplicate class definition for name: "com/sun/ejb/codegen/GenericEJBHome_Generated", but only WHEN I ATTEMPT TO LOOKUP THE SECOND SESSION BEAN!!!

Could it be that this is NOT a classpath issue, but another sort of bug? Please use the sample code listed in above link to reproduce this error. What could be the source of this problem?

2.) I tried to reference the gf-client-module.jar as an OSGI plugin from my Eclipse client plugin, by adding to the MANIFEST.MF:

Require-Bundle: org.eclipse.core.runtime;bundle-version="3.4.0",
org.glassfish.appclient.gf-client-module;bundle-version="3.0.1"

I was careful to reference the Jar from its original location in the Glassfish/modules directory, so that it could see its upstream Jars. Here, I had the error message attached in the screen shot: two packages could not be imported (javax.xml.bind and com.sun.enterprise.deployment.node) In which Jars should these packages be found?

Using the gf-client-module.jar as an Eclipse plugin seems like a great idea, but it seems like it is either not working properly or some non-obvious instructions must be followed.

Please let us know if you could reproduce any of these problems or how we should continue searching for a solution.

Thanks,
- Andreas

tjquinn
Offline
Joined: 2005-03-30
Points: 0

Hi, Andreas.

Many thanks for your thorough update.

Unfortunately, I do not think I have much more to add at this point.

Could you please open an issue:

https://glassfish.dev.java.net/issues/enter_bug.cgi?issue_type=DEFECT&su...

There's no need to duplicate there all the background information that's already here. Please include a link to this topic in the write-up of the issue, though.

I'm sorry I could not be more help.

- Tim

Ludo

glassfish@javadesktop.org wrote:
> Hello,
>
> Sorry to sneak in but:
> I've just downloaded SGES 2.1.1 patch02 and installed it.
> I've also installed Eclipse 3.5.
>
> What will happen now if I "install" the Eclipse Glassfish plugin ?
> Will this plugin only configure Eclipse for integration with a Glassfish server,
yes
> and can I then configure Eclipse/the plugin to point it to my existing V211P02 installation ?
>
yes
> Or is the above impossible and will the plugin install its own Glassfish V2 ánd V3 server and can it only be used with those ?
>
no

> I hope not, because I need to use that particular SJES version/patch.
>
> Please advice.
> Thanks
> EDH
> [Message sent by forum member 'edwindhondt' (edwin.dhondt@hp.com)]
>
> http://forums.java.net/jive/thread.jspa?messageID=384564
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
> For additional commands, e-mail: users-help@glassfish.dev.java.net
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

yetanotherone
Offline
Joined: 2006-11-14
Points: 0

Hi Dominik,

thanks for the reply. I'm sorry to hear you couldn't make it work either.
As to your question, I have no idea how to change the classloader in Eclipse, not even for a single plugin. Actually I'm fairly sure there is no [b]proper[/b] way to do it. So what I did was to directly modify the DefaultClassloader in the org.eclipse.osgi plugin and start the RCP with this version.

The exception that I got then was:

org.jvnet.hk2.component.UnsatisfiedDepedencyException: Unsatisfied dependency exception : private org.glassfish.enterprise.iiop.api.GlassFishORBHelper org.glassfish.enterprise.iiop.api.ORBNamingProxy.orbHelper
at org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:102)
at com.sun.hk2.component.AbstractWombImpl.inject(AbstractWombImpl.java:170)
at com.sun.hk2.component.ConstructorWomb$1.run(ConstructorWomb.java:87)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.hk2.component.ConstructorWomb.initialize(ConstructorWomb.java:84)
at com.sun.hk2.component.AbstractWombImpl.get(AbstractWombImpl.java:77)
at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:58)
at com.sun.hk2.component.LazyInhabitant.get(LazyInhabitant.java:107)
at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:60)
at org.jvnet.hk2.component.Habitat$1.get(Habitat.java:276)
at java.util.AbstractList$Itr.next(AbstractList.java:345)
at com.sun.enterprise.naming.impl.NamedNamingObjectManager.checkAndLoadProxies(NamedNamingObjectManager.java:68)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:397)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

Caused by: org.jvnet.hk2.component.ComponentException: Failed to create class org.glassfish.enterprise.iiop.impl.GlassFishORBFactoryImpl
at com.sun.hk2.component.ConstructorWomb.create(ConstructorWomb.java:74)
at com.sun.hk2.component.AbstractWombImpl.get(AbstractWombImpl.java:71)
at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:58)
at com.sun.hk2.component.LazyInhabitant.get(LazyInhabitant.java:107)
at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:60)
at org.jvnet.hk2.component.Habitat.getByContract(Habitat.java:594)
at org.glassfish.enterprise.iiop.api.GlassFishORBHelper.postConstruct(GlassFishORBHelper.java:88)
at com.sun.hk2.component.AbstractWombImpl.inject(AbstractWombImpl.java:174)
at com.sun.hk2.component.ConstructorWomb$1.run(ConstructorWomb.java:87)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.hk2.component.ConstructorWomb.initialize(ConstructorWomb.java:84)
at com.sun.hk2.component.AbstractWombImpl.get(AbstractWombImpl.java:77)
at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:58)
at com.sun.hk2.component.LazyInhabitant.get(LazyInhabitant.java:107)
at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:60)
at org.jvnet.hk2.component.Habitat.getBy(Habitat.java:600)
at org.jvnet.hk2.component.Habitat.getByType(Habitat.java:581)
at com.sun.hk2.component.AbstractWombImpl$1.getValue(AbstractWombImpl.java:149)
at org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:81)
... 16 more

Caused by: java.lang.VerifyError: (class: org/glassfish/enterprise/iiop/impl/GlassFishORBFactoryImpl, method: createORB signature: (Ljava/util/Properties;)Lorg/omg/CORBA/ORB;) Wrong return type in function
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
at java.lang.Class.getConstructor0(Class.java:2699)
at java.lang.Class.newInstance0(Class.java:326)
at java.lang.Class.newInstance(Class.java:308)
at com.sun.hk2.component.ConstructorWomb.create(ConstructorWomb.java:68)
... 34 more

Except for the NoSuchMethodException part it's pretty much the same as before.

Well, I guess I'm gonne take your advice and go back to Glassfish v2 until they work the kicks out in v3. The sad thing is I was counting on some nice EJB 3.1 features, but looks like that's gonne have to wait.

Stephan

aszomor
Offline
Joined: 2009-08-06
Points: 0

Dear Security Team,

I just reintroduce my question.

Thanks, Attila.

yetanotherone
Offline
Joined: 2006-11-14
Points: 0

Hi Dominik,

I figured out how to get glassfish v3 working with Eclipse 3.5.

First of all this was my initial setup:
I had essentially 2 plugins the first one contained the application code that invoked the EJB's, the second plugin contained both the EJB client jars and the server jars. With the first depending on the second.

I then split the second plugin into a client jar plugin and a server jar plugin, exported all packages and very importantly set the buddy class loading policy in the manifest file to dependent for both.

In my case that was all it took. You will still get a NoSuchMethodException but that doesn't seem to interfere with the Bean invocation. If you don't want that Exception to be thrown you'll also have to modify the org.eclipse.osgi plugin.

Anyhow, let me know if that worked for you, too.
Stephan

dmt_
Offline
Joined: 2009-12-22
Points: 0

Hi Stephan,

it's great to hear that it now works for you!
We were struggling with similar issues with Glassfish v2.1 as well and finally ended up in adding buddy policy entries. Glassfish classloading seems to be very picky about classloader issues and not to cooperate very well with the Eclipse plugin exporting mechanisms. But at least we got it running with v2.1 without any error messages now.

Thanks for your hint! But I guess we will be staying with Glassfish v2.1 for now until they got these problems fixed. Encountering such exceptions is always a bad feeling even though it seems to work in the end.

Best regards,
Dominik

dmt_
Offline
Joined: 2009-12-22
Points: 0

Further investigation of the Problem has shown, that Glassfishv3 relies on a public method `findResources(java.lang.String)` of the `java.lang.Classloader`.

package com.sun.enterprise.module.single;
[...]
public class ManifestProxy extends Manifest {
[...]
public ManifestProxy(ClassLoader cl, List mappings) throws IOException {
try {
[...]
Method met = cl.getClass().getMethod("findResources", String.class);
Enumeration urls=null;
try {
met.setAccessible(true);
urls = (Enumeration) met.invoke(cl, JarFile.MANIFEST_NAME);

But this method is protected in the Classloader class itself. When running the client as standalone java application the derived classloader `sun.misc.Launcher$AppClassLoader` is used which overrides this method and declares it public.
But when running as Eclipse plugin the classloader `org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader` does not override the `findResource`-Method which leaves it protected and inaccessible in the ManifestProxy class.

Has anyone successfully connected from a Eclipse plugin as standalone client to a EJB on Glassfishv3?

yetanotherone
Offline
Joined: 2006-11-14
Points: 0

Hi Dominik,

you haven't happened to find a solution by any chance?
I'm having the same setup as you do, i.e. an RCP (3.5) with a stand-alone eclipse plugin that needs to invoke some EJB's on a glassfish v3 and annoyingly I get the same exception too.
Everything worked perfectly fine when I tried it with the EJBs running on my old glassfish v2 and using it's jar's in the plugin. Now that I migrated to v3 I can only connect to the glassfish from a non-Eclipse based application.

Anyways, I take it you didn't post the whole exception though because mine is considerably longer and in the end seams to be caused by a java.lang.VerifyError.

So for comparison, here is what I get:

java.lang.NoSuchMethodException: org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findResources(java.lang.String)
at java.lang.Class.getMethod(Class.java:1605)
at com.sun.enterprise.module.single.ManifestProxy.(ManifestProxy.java:34)
at com.sun.enterprise.module.single.ProxyModuleDefinition.(ProxyModuleDefinition.java:78)
at com.sun.enterprise.module.single.ProxyModuleDefinition.(ProxyModuleDefinition.java:73)
at com.sun.enterprise.module.single.SingleModulesRegistry.(SingleModulesRegistry.java:42)
at com.sun.enterprise.module.single.SingleModulesRegistry.(SingleModulesRegistry.java:30)
at com.sun.enterprise.module.single.StaticModulesRegistry.(StaticModulesRegistry.java:60)
at org.glassfish.internal.api.Globals.getStaticHabitat(Globals.java:67)
at com.sun.enterprise.naming.impl.SerialContext.(SerialContext.java:183)
at com.sun.enterprise.naming.impl.SerialContext.(SerialContext.java:253)
at com.sun.enterprise.naming.impl.SerialInitContextFactory.createInitialContext(SerialInitContextFactory.java:121)
at com.sun.enterprise.naming.impl.SerialInitContextFactory.getInitialContext(SerialInitContextFactory.java:116)
at com.sun.enterprise.naming.SerialInitContextFactory.getInitialContext(SerialInitContextFactory.java:65)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.(InitialContext.java:197)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

org.jvnet.hk2.component.UnsatisfiedDepedencyException: Unsatisfied dependency exception : private org.glassfish.enterprise.iiop.api.GlassFishORBHelper org.glassfish.enterprise.iiop.api.ORBNamingProxy.orbHelper
at org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:102)
at com.sun.hk2.component.AbstractWombImpl.inject(AbstractWombImpl.java:170)
at com.sun.hk2.component.ConstructorWomb$1.run(ConstructorWomb.java:87)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.hk2.component.ConstructorWomb.initialize(ConstructorWomb.java:84)
at com.sun.hk2.component.AbstractWombImpl.get(AbstractWombImpl.java:77)
at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:58)
at com.sun.hk2.component.LazyInhabitant.get(LazyInhabitant.java:107)
at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:60)
at org.jvnet.hk2.component.Habitat$1.get(Habitat.java:276)
at java.util.AbstractList$Itr.next(AbstractList.java:345)
at com.sun.enterprise.naming.impl.NamedNamingObjectManager.checkAndLoadProxies(NamedNamingObjectManager.java:68)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:397)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

Caused by: org.jvnet.hk2.component.ComponentException: Failed to create class org.glassfish.enterprise.iiop.impl.GlassFishORBFactoryImpl
at com.sun.hk2.component.ConstructorWomb.create(ConstructorWomb.java:74)
at com.sun.hk2.component.AbstractWombImpl.get(AbstractWombImpl.java:71)
at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:58)
at com.sun.hk2.component.LazyInhabitant.get(LazyInhabitant.java:107)
at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:60)
at org.jvnet.hk2.component.Habitat.getByContract(Habitat.java:594)
at org.glassfish.enterprise.iiop.api.GlassFishORBHelper.postConstruct(GlassFishORBHelper.java:88)
at com.sun.hk2.component.AbstractWombImpl.inject(AbstractWombImpl.java:174)
at com.sun.hk2.component.ConstructorWomb$1.run(ConstructorWomb.java:87)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.hk2.component.ConstructorWomb.initialize(ConstructorWomb.java:84)
at com.sun.hk2.component.AbstractWombImpl.get(AbstractWombImpl.java:77)
at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:58)
at com.sun.hk2.component.LazyInhabitant.get(LazyInhabitant.java:107)
at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:60)
at org.jvnet.hk2.component.Habitat.getBy(Habitat.java:600)
at org.jvnet.hk2.component.Habitat.getByType(Habitat.java:581)
at com.sun.hk2.component.AbstractWombImpl$1.getValue(AbstractWombImpl.java:149)
at org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:81)
... 16 more

Caused by: java.lang.VerifyError: (class: org/glassfish/enterprise/iiop/impl/GlassFishORBFactoryImpl, method: createORB signature: (Ljava/util/Properties;)Lorg/omg/CORBA/ORB;) Wrong return type in function
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
at java.lang.Class.getConstructor0(Class.java:2699)
at java.lang.Class.newInstance0(Class.java:326)
at java.lang.Class.newInstance(Class.java:308)
at com.sun.hk2.component.ConstructorWomb.create(ConstructorWomb.java:68)
... 34 more

I also played a little bit with the DefaultClassLoader class from Eclipse but even after changing the visibility of the 'findResources' method I got more or less the same result.

Any help or suggestions for a workaround would be greatly appreciated.

Stephan

dmt_
Offline
Joined: 2009-12-22
Points: 0

Hi Stephan,

unfortunately we could not find a solution for the problem. We tried several approaches (including to set the expected sun.misc.Launcher$AppClassLoader manually as Classloader in Globals), but just ran into other problems afterwards. Consequently we switched back to Glassfish v2 where our client works seemlessly without any hacks as Eclipse Plugin.

I'm afraid we have to stay with Glassfish v2 until they resolve the classloader issues with v3 (see the following bugs https://glassfish.dev.java.net/issues/show_bug.cgi?id=11505 , https://glassfish.dev.java.net/issues/show_bug.cgi?id=11506 ).

We also tried to change the Eclipse default classloader. Can you tell me how to specify which classloader is used for a Eclipse plugin? What was your error message after changing the visibility of the 'findResources' method?

Dominik

honi78
Offline
Joined: 2012-12-07
Points: 0

Hi a solution is described here

http://www.ansis.com/know-how/software-development/eclipse-rcp/

For me, the trick was to change the classloader before creating the InitialContext

final ClassLoader ejbUtilsClassLoader = getClass().getClassLoader();
Thread.currentThread().setContextClassLoader(ejbUtilsClassLoader);
Properties props = new Properties();
props.setProperty("java.naming.factory.initial", "com.sun.enterprise.naming.SerialInitContextFactory");
ctx = new InitialContext(props);
edwindhondt
Offline
Joined: 2006-08-23
Points: 0

Hello,

Sorry to sneak in but:
I've just downloaded SGES 2.1.1 patch02 and installed it.
I've also installed Eclipse 3.5.

What will happen now if I "install" the Eclipse Glassfish plugin ?
Will this plugin only configure Eclipse for integration with a Glassfish server, and can I then configure Eclipse/the plugin to point it to my existing V211P02 installation ?

Or is the above impossible and will the plugin install its own Glassfish V2 ánd V3 server and can it only be used with those ?
I hope not, because I need to use that particular SJES version/patch.

Please advice.
Thanks
EDH

yetanotherone
Offline
Joined: 2006-11-14
Points: 0

Hi EDH,

seems to me like you've got a usability issue with Eclipse as a development environment, this thread is actually about an entirely different problem. We use Eclipse as a rich client platform, the plugins we refer to are [b]not[/b] the web tools platform or the glassfish connectors but our own implementation of an application inside the RCP.

Now let me cut to the chase, here is a good description of how to use Eclipse in combination with glassfish https://glassfishplugins.dev.java.net/eclipse34/index.html.
The glassfish plugin does not come with an application server as far as I know.
So in my opinion you're good. For any details see the link above.

Bye Stephan