Skip to main content

Running command line appclient -client

6 replies [Last post]
haleh
Offline
Joined: 2012-09-14
Points: 0

Hallo,

We have stand alone client and glassfish is running on remote server. When we run client on our development envirnment (netbeans) application client is running. the
sun-acc.xml is rightly set to remote host and port number.
and gf-client.jar is added to jar file library.

When running application client with command line
appclient -client myapplication.jar
We get an error Any idea??
Exception in thread "main" java.lang.NoClassDefFoundError: org/glassfish/appclient/client/acc/UserError
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(Unknown Source)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.glassfish.appclient.client.acc.UserError
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 6 more

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
aacain
Offline
Joined: 2012-10-27
Points: 0

I'm having the same problem. Any solutions?

Nikita4000
Offline
Joined: 2012-10-28
Points: 0

Here is my example:
Properties properties = new Properties();

properties.setProperty("java.naming.factory.initial",
"com.sun.enterprise.naming.SerialInitContextFactory");

properties.setProperty(
"org.omg.CORBA.ORBInitialHost",
"172.16.1.192");

properties.setProperty(
"org.omg.CORBA.ORBInitialPort",
"3700");

InitialContext initialContext = new InitialContext(properties);

//TestConnectionMediator tcm = (TestConnectionMediator) initialContext.lookup("TestConnectionSessionBean");
//tcm.testConnect();

MailSessionBeanRemote ms=(MailSessionBeanRemote)initialContext.lookup("MailSessionBean");
//ms.testMail();
ms.testGetMail();

This is required list of libs:
C:\Program Files\glassfish-3.1.2\glassfish\lib\install\applications\__cp_jdbc_ra\ => "__cp_jdbc_ra.jar"

C:\Program Files\glassfish-3.1.2\glassfish\lib\install\applications\__dm_jdbc_ra\ => "__dm_jdbc_ra.jar"

C:\Program Files\glassfish-3.1.2\glassfish\lib\install\applications\__ds_jdbc_ra\ => "__ds_jdbc_ra.jar"

C:\Program Files\glassfish-3.1.2\glassfish\lib\install\applications\__xa_jdbc_ra\ => "__xa_jdbc_ra.jar"

C:\Program Files\glassfish-3.1.2\glassfish\lib\install\applications\jaxr-ra\ => "jaxr-ra.jar"

C:\Program Files\glassfish-3.1.2\glassfish\lib\install\applications\jmsra\ => "imqjmsra.jar"

C:\Program Files\glassfish-3.1.2\javadb\lib\ => "derby.jar" "derbyclient.jar" "derbynet.jar" "derbytools.jar" "derbyrun.jar"

C:\Program Files\glassfish-3.1.2\mq\lib\ => "imq.jar" "imqadmin.jar" "imqutil.jar" "fscontext.jar"

C:\Program Files\glassfish-3.1.2\glassfish\modules\endorsed\ => "jaxb-api-osgi.jar" "javax.annotation.jar" "webservices-api-osgi.jar"

C:\Program Files\glassfish-3.1.2\glassfish\modules\ => "tools.jar" "auto-depends.jar" "config.jar" "config-types.jar" "hk2.jar" "hk2-core.jar" "osgi-adapter.jar" "grizzly-comet.jar" "grizzly-config.jar" "grizzly-framework.jar" "grizzly-http.jar" "grizzly-http-ajp.jar" "grizzly-http-servlet.jar" "grizzly-lzma.jar" "grizzly-portunif.jar" "grizzly-rcm.jar" "grizzly-utils.jar" "grizzly-websockets.jar" "javax.mail.jar" "pkg-client.jar" "jaxb-osgi.jar" "jaxws-eclipselink-plugin.jar" "activation.jar" "javax.el-api.jar" "javax.servlet-api.jar" "javax.servlet.jsp-api.jar" "javax.servlet.jsp.jstl-api.jar" "jaxr-api-osgi.jar" "jaxrpc-api-osgi.jar" "endorsed\jaxb-api-osgi.jar" "stax-api.jar" "junit.jar" "stax2-api.jar" "woodstox-core-asl.jar" "javax.persistence.jar" "org.eclipse.persistence.antlr.jar" "org.eclipse.persistence.asm.jar" "org.eclipse.persistence.core.jar" "org.eclipse.persistence.jpa.jar" "org.eclipse.persistence.jpa.modelgen.jar" "org.eclipse.persistence.moxy.jar" "org.eclipse.persistence.oracle.jar" "bean-validator.jar" "javax.faces.jar" "glassfish-corba-asm.jar" "glassfish-corba-codegen.jar" "glassfish-corba-csiv2-idl.jar" "glassfish-corba-internal-api.jar" "glassfish-corba-newtimer.jar" "glassfish-corba-omgapi.jar" "glassfish-corba-orb.jar" "glassfish-corba-orbgeneric.jar" "management-api.jar" "gmbal.jar" "ha-api.jar" "auto-depends.jar" "class-model.jar" "config.jar" "config-types.jar" "hk2.jar" "hk2-core.jar" "asm-all-repackaged.jar" "bean-validator.jar" "admin-core.jar" "admin-util.jar" "config-api.jar" "javax.management.j2ee.jar" "monitoring-core.jar" "acc-config.jar" "gf-client-module.jar" "gms-bootstrap.jar" "amx-core.jar" "amx-j2ee.jar" "annotation-framework.jar" "common-util.jar" "container-common.jar" "glassfish-api.jar" "glassfish-ee-api.jar" "glassfish-naming.jar" "internal-api.jar" "scattered-archive-api.jar" "simple-glassfish-api.jar" "stats77.jar" "connectors-inbound-runtime.jar" "connectors-internal-api.jar" "connectors-runtime.jar" "javax.resource.jar" "work-management.jar" "glassfish.jar" "kernel.jar" "logging.jar" "deployment-common.jar" "deployment-javaee-core.jar" "dol.jar" "javax.enterprise.deploy.jar" "ejb-container.jar" "ejb-internal-api.jar" "gf-ejb-connector.jar" "javax.ejb.jar" "j-interop-repackaged.jar" "ldapbp-repackaged.jar" "libpam4j-repackaged.jar" "flashlight-framework.jar" "endorsed\javax.annotation.jar" "javax.jms.jar" "jms-core.jar" "orb-connector.jar" "orb-iiop.jar" "eclipselink-wrapper.pom" "jpa-connector.jar" "persistence-common.jar" "cmp-internal-api.jar" "appclient.security.jar" "ejb.security.jar" "jaspic.provider.framework.jar" "javax.security.auth.message.jar" "javax.security.jacc.jar" "security.jar" "ssl-impl.jar" "websecurity.jar" "webservices.security.jar" "javax.transaction.jar" "jta.jar" "jts.jar" "transaction-internal-api.jar" "war-util.jar" "web-cli.jar" "web-core.jar" "web-glue.jar" "web-gui-plugin-common.jar" "web-naming.jar" "web-embed-api.jar" "jsr109-impl.jar" "webservices-connector.jar" "endorsed\webservices-api-osgi.jar" "webservices-extra-jdk-packages.jar" "webservices-osgi.jar" "javax.el.jar" "javax.servlet.jsp.jar" "tiger-types.jar" "mimepull.jar" "shoal-gms-api.jar" "aixporting-repackaged.jar"

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

Can you please describe what projects you have in NetBeans for this app, and how they depend on each other?

I have described in quite a bit of detail what I think is the best way to organize an app that contains an app client. Here is the link to my reply, and that approach works:

http://www.java.net/forum/topic/glassfish/glassfish/runnging-application...

(Despite the title it does not apply only to launching with Java Web Start.)

- Tim

Nikita4000
Offline
Joined: 2012-10-28
Points: 0

At first time we doing it as you discribed.
asadmin ...get-client-stubs...
appclient ...
But it is not good, because we have not control under the application. We must install glassfish on client for this schem works.
In my case we compile client and can copy it to different computers and we need not any glassfishs on them.
My way is better than get-client-stubs and packing client into EAR.

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

Nikita4000,

It's good that you have a way that works for you. Some people want or need the services - security, logging, injection, etc. - that come with the app client container, even though as you point out it does require having parts of GlassFish on the client systems.

- Tim

Nikita4000
Offline
Joined: 2012-10-28
Points: 0

Tim,
In my opinion client must be independent application. Security and logging we can organize manually as we need without any container. We are using lookup instead of injection on client side, so we need not injection.
By the way, clien may be offline.
In your case we cannot create offline client that periodicaly calls some enterprise functions.
In my case I need fat client that can be offline.