Start enterprise application client outside Netbeans
I've created simple Enterprise Application. I have ejb, war and app-client. I'm able to deploy and run this using Netbeans. However I need to deploy and start it outside Netbeans. I'm also able to get .ear file and using Admin Console deploy it. However I have also start an application client somehow. I searched information about it and I get:http://docs.sun.com/app/docs/doc/821-1750/beaem?l=en&a=view
So I tried to input command into console: appclient -client RoadRunnerClient.jar
However I get Exception:
org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:3431) at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:3452) at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.(SocketOrChannelConnectionImpl.java:256) at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.(SocketOrChannelConnectionImpl.java:269) at com.sun.corba.ee.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:125) at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:188) at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:186) at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaClientDelegateImpl.java:352) at org.omg.CORBA.portable.ObjectImpl._is_a(Unknown Source) at org.omg.CosNaming.NamingContextHelper.narrow(Unknown Source) at com.sun.enterprise.naming.impl.SerialContext.narrowProvider(SerialContext.java:355) at com.sun.enterprise.naming.impl.SerialContext.getRemoteProvider(SerialContext.java:327) at com.sun.enterprise.naming.impl.SerialContext.getProvider(SerialContext.java:271) at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:430) at javax.naming.InitialContext.lookup(Unknown Source) at com.sun.ejb.EjbNamingReferenceManagerImpl.resolveEjbReference(EjbNamingReferenceManagerImpl.java:169) at com.sun.enterprise.container.common.impl.ComponentEnvManagerImpl$EjbReferenceProxy.create(ComponentEnvManagerImpl.java:1040) at com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.lookup(GlassfishNamingManagerImpl.java:688) at com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.lookup(GlassfishNamingManagerImpl.java:657) at com.sun.enterprise.naming.impl.JavaURLContext.lookup(JavaURLContext.java:148) at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:428) at javax.naming.InitialContext.lookup(Unknown Source) at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:513) at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.inject(InjectionManagerImpl.java:384) at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.injectClass(InjectionManagerImpl.java:210) at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.injectClass(InjectionManagerImpl.java:202) at org.glassfish.appclient.client.acc.AppClientContainer$ClientMainClassSetting.getClientMainClass(AppClientContainer.java:599) at org.glassfish.appclient.client.acc.AppClientContainer.getMainMethod(AppClientContainer.java:498) at org.glassfish.appclient.client.acc.AppClientContainer.completePreparation(AppClientContainer.java:397) at org.glassfish.appclient.client.acc.AppClientContainer.prepare(AppClientContainer.java:311) at org.glassfish.appclient.client.AppClientFacade.prepareACC(AppClientFacade.java:264) at org.glassfish.appclient.client.acc.agent.AppClientContainerAgent.premain(AppClientContainerAgent.java:75) 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 sun.instrument.InstrumentationImpl.loadClassAndStartAgent(Unknown Source) at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(Unknown Source) Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection refused: connect at org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:340) at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.(SocketOrChannelConnectionImpl.java:239) ... 35 more Caused by: java.net.ConnectException: Connection refused: connect at sun.nio.ch.Net.connect(Native Method) at sun.nio.ch.SocketChannelImpl.connect(Unknown Source) at com.sun.corba.ee.impl.orbutil.ORBUtility.openSocketChannel(ORBUtility.java:106) at org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:325) ... 36 more com.sun.enterprise.container.common.spi.util.InjectionException: Exception attempting to inject Remote ejb-ref name=roadrunner.Main/bean,Remote 3.x interface =common.NewSessionBeanLocal,ejb-link=RoadR unner-ejb.jar#NewSessionBean,lookup=null,mappedName=,jndi-name=java:global/RoadRunner/RoadRunner-ejb/NewSessionBean!common.NewSessionBeanLocal,refType=Session into class roadrunner.Main at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:614) at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.inject(InjectionManagerImpl.java:384) at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.injectClass(InjectionManagerImpl.java:210) at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.injectClass(InjectionManagerImpl.java:202) at org.glassfish.appclient.client.acc.AppClientContainer$ClientMainClassSetting.getClientMainClass(AppClientContainer.java:599) at org.glassfish.appclient.client.acc.AppClientContainer.getMainMethod(AppClientContainer.java:498) at org.glassfish.appclient.client.acc.AppClientContainer.completePreparation(AppClientContainer.java:397) at org.glassfish.appclient.client.acc.AppClientContainer.prepare(AppClientContainer.java:311) at org.glassfish.appclient.client.AppClientFacade.prepareACC(AppClientFacade.java:264) at org.glassfish.appclient.client.acc.agent.AppClientContainerAgent.premain(AppClientContainerAgent.java:75) 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 sun.instrument.InstrumentationImpl.loadClassAndStartAgent(Unknown Source) at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(Unknown Source) Caused by: javax.naming.NamingException: Lookup failed for 'java:comp/env/roadrunner.Main/bean' in SerialContext targetHost=localhost,targetPort=3700,orb'sInitialHost=localhost,orb'sInitialPort=3700 [ Root exception is javax.naming.NamingException: Exception resolving Ejb for 'Remote ejb-ref name=roadrunner.Main/bean,Remote 3.x interface =common.NewSessionBeanLocal,ejb-link=RoadRunner-ejb.jar#NewSe ssionBean,lookup=null,mappedName=,jndi-name=java:global/RoadRunner/RoadRunner-ejb/NewSessionBean!common.NewSessionBeanLocal,refType=Session' . Actual (possibly internal) Remote JNDI name used for loo kup is 'java:global/RoadRunner/RoadRunner-ejb/NewSessionBean!common.NewSessionBeanLocal' [Root exception is javax.naming.NamingException: Lookup failed for 'java:global/RoadRunner/RoadRunner-ejb/NewSe ssionBean!common.NewSessionBeanLocal' in SerialContext targetHost=localhost,targetPort=3700,orb'sInitialHost=localhost,orb'sInitialPort=3700 [Root exception is javax.naming.NamingException: Unable to acquire SerialContextProvider for SerialContext targetHost=localhost,targetPort=3700,orb'sInitialHost=localhost,orb'sInitialPort=3700 [Root exception is org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No]]]] at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:442) at javax.naming.InitialContext.lookup(Unknown Source) at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:513) ... 15 more Caused by: javax.naming.NamingException: Exception resolving Ejb for 'Remote ejb-ref name=roadrunner.Main/bean,Remote 3.x interface =common.NewSessionBeanLocal,ejb-link=RoadRunner-ejb.jar#NewSessionBe an,lookup=null,mappedName=,jndi-name=java:global/RoadRunner/RoadRunner-ejb/NewSessionBean!common.NewSessionBeanLocal,refType=Session' . Actual (possibly internal) Remote JNDI name used for lookup is 'java:global/RoadRunner/RoadRunner-ejb/NewSessionBean!common.NewSessionBeanLocal' [Root exception is javax.naming.NamingException: Lookup failed for 'java:global/RoadRunner/RoadRunner-ejb/NewSessionBe an!common.NewSessionBeanLocal' in SerialContext targetHost=localhost,targetPort=3700,orb'sInitialHost=localhost,orb'sInitialPort=3700 [Root exception is javax.naming.NamingException: Unable to acquire SerialContextProvider for SerialContext targetHost=localhost,targetPort=3700,orb'sInitialHost=localhost,orb'sInitialPort=3700 [Root exception is org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No]]] at com.sun.ejb.EjbNamingReferenceManagerImpl.resolveEjbReference(EjbNamingReferenceManagerImpl.java:174) at com.sun.enterprise.container.common.impl.ComponentEnvManagerImpl$EjbReferenceProxy.create(ComponentEnvManagerImpl.java:1040) at com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.lookup(GlassfishNamingManagerImpl.java:688) at com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.lookup(GlassfishNamingManagerImpl.java:657) at com.sun.enterprise.naming.impl.JavaURLContext.lookup(JavaURLContext.java:148) at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:428) ... 17 more Caused by: javax.naming.NamingException: Lookup failed for 'java:global/RoadRunner/RoadRunner-ejb/NewSessionBean!common.NewSessionBeanLocal' in SerialContext targetHost=localhost,targetPort=3700,orb's InitialHost=localhost,orb'sInitialPort=3700 [Root exception is javax.naming.NamingException: Unable to acquire SerialContextProvider for SerialContext targetHost=localhost,targetPort=3700,orb'sInitial Host=localhost,orb'sInitialPort=3700 [Root exception is org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No]] at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:442) at javax.naming.InitialContext.lookup(Unknown Source) at com.sun.ejb.EjbNamingReferenceManagerImpl.resolveEjbReference(EjbNamingReferenceManagerImpl.java:169) ... 22 more Caused by: javax.naming.NamingException: Unable to acquire SerialContextProvider for SerialContext targetHost=localhost,targetPort=3700,orb'sInitialHost=localhost,orb'sInitialPort=3700 [Root exception is org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No] at com.sun.enterprise.naming.impl.SerialContext.getProvider(SerialContext.java:276) at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:430) ... 24 more Caused by: org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:3431) at com.sun.corba.ee.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:3452) at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.(SocketOrChannelConnectionImpl.java:256) at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.(SocketOrChannelConnectionImpl.java:269) at com.sun.corba.ee.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:125) at com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:188) at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:186) at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaClientDelegateImpl.java:352) at org.omg.CORBA.portable.ObjectImpl._is_a(Unknown Source) at org.omg.CosNaming.NamingContextHelper.narrow(Unknown Source) at com.sun.enterprise.naming.impl.SerialContext.narrowProvider(SerialContext.java:355) at com.sun.enterprise.naming.impl.SerialContext.getRemoteProvider(SerialContext.java:327) at com.sun.enterprise.naming.impl.SerialContext.getProvider(SerialContext.java:271) ... 25 more Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection refused: connect at org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:340) at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.(SocketOrChannelConnectionImpl.java:239) ... 35 more Caused by: java.net.ConnectException: Connection refused: connect at sun.nio.ch.Net.connect(Native Method) at sun.nio.ch.SocketChannelImpl.connect(Unknown Source) at com.sun.corba.ee.impl.orbutil.ORBUtility.openSocketChannel(ORBUtility.java:106) at org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:325) ... 36 more
>
I tried also enable Java Web Start in application RoadRunner in admin console. Then download it and run, however then I get: Exception:
com.sun.deploy.net.FailedDownloadException: Unable to load resource: [localhost]/_JWSappclient/_system/_dyn/_system_s1as.jnlp at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source) at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source) at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source) at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source) at com.sun.deploy.net.DownloadEngine.getCachedFile(Unknown Source) at com.sun.javaws.LaunchDownload.downloadExtensionsHelper(Unknown Source) at com.sun.javaws.LaunchDownload.downloadExtensions(Unknown Source) at com.sun.javaws.Launcher.prepareLaunchFile(Unknown Source) at com.sun.javaws.Launcher.prepareAllResources(Unknown Source) at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source) at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source) at com.sun.javaws.Launcher.launch(Unknown Source) at com.sun.javaws.Main.launchApp(Unknown Source) at com.sun.javaws.Main.continueInSecureThread(Unknown Source) at com.sun.javaws.Main$1.run(Unknown Source) at java.lang.Thread.run(Unknown Source)
and Wrapped Exception:
java.io.FileNotFoundException: [localhost]/_JWSappclient/_system/_dyn/_system_s1as.jnlp at sun.reflect.GeneratedConstructorAccessor1.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection$6.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at sun.net.www.protocol.http.HttpURLConnection.getChainedException(Unknown So开发者_JAVA技巧urce) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at com.sun.deploy.net.BasicHttpRequest.doRequest(Unknown Source) at com.sun.deploy.net.BasicHttpRequest.doRequest(Unknown Source) at com.sun.deploy.net.BasicHttpRequest.doGetRequest(Unknown Source) at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source) at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source) at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source) at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source) at com.sun.deploy.net.DownloadEngine.getCachedFile(Unknown Source) at com.sun.javaws.LaunchDownload.downloadExtensionsHelper(Unknown Source) at com.sun.javaws.LaunchDownload.downloadExtensions(Unknown Source) at com.sun.javaws.Launcher.prepareLaunchFile(Unknown Source) at com.sun.javaws.Launcher.prepareAllResources(Unknown Source) at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source) at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source) at com.sun.javaws.Launcher.launch(Unknown Source) at com.sun.javaws.Main.launchApp(Unknown Source) at com.sun.javaws.Main.continueInSecureThread(Unknown Source) at com.sun.javaws.Main$1.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.io.FileNotFoundException: [localhost]/_JWSappclient/_system/_dyn/_system_s1as.jnlp at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at java.net.HttpURLConnection.getResponseCode(Unknown Source) ... 19 more
I have no idea what next?
I had to change port which I use to connect:
appclient -client RoadRunnerClient.jar -targetserver localhost:[port]
I had to look which port I need to use in admin console: ORB -> IIOP Listeners
There seems to be a configuration problem with Netbeans 6.8 with the integrated Personal Glassfish v3 server. The server installs its IIOP service by default at 40833 but the default IIOP for JNDI is 3700. Hence you get the error:
javax.naming.NamingException: Lookup failed for 'java:global/RoadRunner/RoadRunner-ejb/NewSessionBean!common.NewSessionBeanLocal' in SerialContext targetHost=localhost,targetPort=3700,orb's InitialHost=localhost,orb'sInitialPort=3700 [Root exception is javax.naming.NamingException: Unable to acquire SerialContextProvider for SerialContext targetHost=localhost,targetPort=3700,orb'sInitial Host=localhost,orb'sInitialPort=3700 [Root exception is org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No]]
The solution is to add a little code to your JNDI context lookup. Where normally you might say:
Context ctx = new InitialContext();
instead do the following:
Properties jndiProps = new Properties();
jndiProps.put("java.naming.factory.initial", "com.sun.enterprise.naming.impl.SerialInitContextFactory");
jndiProps.put("java.naming.factory.url.pkgs", "com.sun.enterprise.naming");
jndiProps.put("java.naming.factory.state", "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
jndiProps.put("java.naming.provider.url", "iiop://localhost:40833");
jndiProps.setProperty("org.omg.CORBA.ORBInitialHost", "127.0.0.1");
jndiProps.setProperty("org.omg.CORBA.ORBInitialPort", "40833");
InitialContext ctx = new InitialContext(jndiProps);
精彩评论