Skip to main content

deploy and distibuting standalone client application

2 replies [Last post]
haleh
Offline
Joined: 2012-09-14

Hi,

I have a standalone client and my glassfish running on remote server(unix/linux).
I copy appclient folder from server to my client and change the sun-acc.xml to give the right server and port number and run my standalone client with command line
appclient -client mystandaloneclient.jar
This works fine!
My question is that now I have lots of clients
I know now that appclient folder needs to copy on each clients.
What I do not know is that how I deploy and distribute my client application between many clients.
do I need to copy my applicationclient.jar file each time on many clients?

How can I deploy my client application to the server and each client run it as web start
How is it possible when my client application points to gf-client.jar in appclient folder how I have to address my libraries if I run my client application as web start.

Thanks,
h.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
tjquinn
Offline
Joined: 2005-03-30

Hi.

Have you read this documentation?

http://docs.oracle.com/cd/E26576_01/doc.312/e24930/java-clients.htm#gavmf

It describes how GlassFish automatically lets you launch app clients using Java Web Start. As a developer, you don't need to do anything different as you develop your application.

As for library files that the client needs, the GlassFish Java Web Start support automatically makes the required library files available to the client. This includes JARs in the EAR's library directory (/lib by default) and also any JARs referenced from the app client JAR's manifest Class-Path setting.

Be aware that the first time you launch a client using Java Web Start on a system Java Web Start has to download quite a few files from the server, but these are cached on the client system so later launches happen much faster.

- Tim

haleh
Offline
Joined: 2012-09-14

Hi,

Thanks for your reply.

ok my application works fine with command line appclient -client myapplicationclient.jar
also in netbean environment.
I deploy my client application on glassfish and try to launch it
I get the error ....
java.lang.RuntimeException: Error launching or running the application
at org.glassfish.appclient.client.JWSAppClientContainerMain.main(JWSAppClientContainerMain.java:144)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.sun.javaws.Launcher.executeApplication(Unknown Source)
at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
at com.sun.javaws.Launcher.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at org.glassfish.appclient.client.JWSAppClientContainerMain$ClientRunner.run(JWSAppClientContainerMain.java:179)
at org.glassfish.appclient.client.JWSAppClientContainerMain.main(JWSAppClientContainerMain.java:138)
... 9 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.glassfish.appclient.client.acc.AppClientContainer.launch(AppClientContainer.java:438)
at org.glassfish.appclient.client.AppClientFacade.launch(AppClientFacade.java:182)
at org.glassfish.appclient.client.JWSAppClientContainerMain$ClientRunner.run(JWSAppClientContainerMain.java:169)
... 10 more
Caused by: javax.naming.NamingException: Lookup failed for 'java:global/myEAR1/myEAR1-ejb/myServices!mypackage.myServicesRemote' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is javax.naming.NamingException: ejb ref resolution error for remote business interfaceraus.myServicesRemote [Root exception is sun.misc.InvalidJarIndexException: Invalid index]]
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:518)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:455)
at javax.naming.InitialContext.lookup(Unknown Source)
at mymainpackage.myclass.main(myclass.java:52)
... 17 more
Caused by: javax.naming.NamingException: ejb ref resolution error for remote business interfaceraus.myServicesRemote [Root exception is sun.misc.InvalidJarIndexException: Invalid index]
at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:433)
at com.sun.ejb.containers.RemoteBusinessObjectFactory.getObjectInstance(RemoteBusinessObjectFactory.java:75)
at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
at com.sun.enterprise.naming.impl.SerialContext.getObjectInstance(SerialContext.java:556)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:514)
... 20 more
Caused by: sun.misc.InvalidJarIndexException: Invalid index
at com.sun.deploy.security.DeployURLClassPath$JarLoader.getResource(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath$JarLoader.getResource(Unknown Source)
at com.sun.deploy.security.DeployURLClassPath.getResource(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.glassfish.appclient.client.MaskingClassLoader.loadClass(MaskingClassLoader.java:95)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at com.sun.ejb.EJBUtils.getBusinessIntfClassLoader(EJBUtils.java:687)
at com.sun.ejb.EJBUtils.loadGeneratedRemoteBusinessClasses(EJBUtils.java:462)
at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:413)
... 24 more

Could you please help this issue?

Thanks,
h.