users@glassfish.java.net

Migrating standalone client from GFv2 to GFv3 (or the classpath hell)

From: Antonio Goncalves <antonio.mailing_at_gmail.com>
Date: Thu, 30 Sep 2010 14:31:04 +0200

Hi,

I have an application that uses a Swing client with JNDI lookups to access
remote stateless EJBs. Everything works fine. I'm trying now to go from an
Ant build (with explicit classpath setting) that runs on GlassFish 2.1 to a
Maven build with the latest GlassFish v3.0.1

With Ant on GlassFish v2.1 this is what I explicitely declare in my
classpath :
appserv-deployment-client.jar
appserv-rt.jar
webservices-rt.jar
appserv-admin.jar
javaee.jar

I know things have changed in GFv3 so I'm now using
the org.glassfish.appclient.*gf-client-3.0.1-b20* (instead of
the appserv-rt.jar). When I run my Swing app with the gf-client I have the
following exception :

java.lang.NoClassDefFoundError: com/sun/corba/ee/spi/osgi/ORBFactory

Indeed. This class is in com.sun.corba.glassfish-corba-orb*-3.1.0-b006* but
not in the *3.0.0-b001* that gf-client depends on. So I've added
the com.sun.corba.glassfish-corba-orb*-3.1.0-b006* to my dependencies and
now have the following exception :

java.lang.NoClassDefFoundError:
org/glassfish/enterprise/iiop/impl/CSIv2SSLTaggedComponentHandlerImpl

It looks like I could spend the day looking for NoClassDefFoundError, so I
might be doing something wrong. I gave a try and used a 3.0 version
(org.glassfish.appclient.*gf-client-3.0-b74b*) but I still
have java.lang.NoClassDefFoundError: com/sun/corba/ee/spi/osgi/ORBFactory.

There must be an easier way, any idea ?
Thanks,
Antonio