Hallo!
Ich bin auf der Suche nach einer geeigneten Remoting Technik zum Aufruf von Methoden von Session Beans in einem Glassfish 3 JEE6 Container. Mein Client ist eine Netbeans 6.9 Rich Client Platform Applikation auf Java Standard Edition 6.
Mein erster Ansatz war, die Standardvariante CORBA/RMI wie von Glassfish als Application Client zur Verfügung gestellt zu verwenden. Leider scheitert dieser meiner Meinung nach sehr komfortable Ansatz in der Netbeans RCP an einem Classloading Problem (Der selbe Code funktioniert in Java SE 6 ausserhalb der Rich Client Platform ohne Probleme). Siehe hierzu mein Posting in der Netbeans Mailinglist [1], sowie die beiden Bugreports zum Thema [2] [3]. Es sieht nicht so aus, als würden die Bugs in naher Zukunft gefixt werden.
Ansatz Nr. 2 war die Umstellung auf JAX-WS, dies scheitert allerdings daran, dass Glassfish Metro 2.2 as WS Implementierung verwendet, in Java SE 6 allerdings nur Metro 2.0 mitgeliefert wird. Sobald Methoden checked Exceptions deklarieren, tritt eine Inkompatibilität zw. 2.0 und 2.2 zu tage. Das Upgrade des Clients auf Metro 2.2 kann nur durch die Platzierung der Metro 2.2 JAR Files im endorsed Verzeichnis von Java SE 6 erfolgen, dies finde ich aus Deployment-Sicht allerdings problematisch, das möchte ich meinen Benutzern nicht zumuten.
Da Ansatz 1 und 2 für meinen Anwendungsfall nicht in Frage kommen, bzw. massive Schwierigkeiten aufwerfen, bin ich nun also auf der Suche nach einem geeigneten Weg um von meinem Netbeans RCP Client auf Session Bean Methoden am Glassfish zuzugreifen. Ich habe bereits Hessian [4] ins Auge gefasst, jedoch scheint hier die Authentifzierung zu fehlen.
Meine Anforderungen sind:
- Zugriff aus Netbeans RCP unter Java SE 6 auf Glassfish 3 Session Beans muss möglich sein
- Authentifizierung ist zwingend erforderlich
- Verschlüsselung ist wünschenswert, aber nicht zwingend notwendig
- Ideal wäre es meine API am Client und am Server zu verwenden können
Welchen Remoting Ansatz würdet ihr empfehlen?
Vielen Dank für Eure Anregungen!
Code Client-Seite
System.setProperty("java.security.auth.login.config", "D:\\appclientlogin.conf");
GreeterBeanRemote greeterRemote = null;
Properties props = new Properties();
props.setProperty("org.omg.CORBA.ORBInitialHost", "10.1.1.13"); // default!
props.setProperty("org.omg.CORBA.ORBInitialPort", "3700"); // default!
InitialContext context = new InitialContext(props);
ProgrammaticLogin login = new ProgrammaticLogin();
login.login("john.doe", "xxxxx");
greeterRemote = (GreeterBeanRemote) context.lookup("foo.bar.blubb.GreeterBeanRemote");
String output = greeterRemote.greetMe("John Doe");
System.out.printf("Got Answer:%ngreeting=%s%n", output);
Alles anzeigen
Code Exception
WARNING [javax.enterprise.resource.corba.Util]: IOP01211205: Exception in loadStub
java.lang.ClassNotFoundException: com.sun.ejb.codegen.GenericEJBHome_Generated
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at org.netbeans.ProxyClassLoader.loadClass(ProxyClassLoader.java:262)
Caused: java.lang.ClassNotFoundException: com.sun.ejb.codegen.GenericEJBHome_Generated starting from SystemClassLoader[53 modules] with possible defining loaders [ModuleCL@196e136[com.vendidata.gollum.thirdpartylibraries]] and declared parents [ModuleCL@864e43[com.vendidata.gollum.businesslogic], ModuleCL@17f1841[de.centigrade.vendidata.branding], ModuleCL@185ad79[org.openide.loaders], ModuleCL@cbd8dc[org.netbeans.core.io.ui], org.netbeans.MainImpl$BootClassLoader@aeffdf, ModuleCL@1c6e818[org.netbeans.swing.plaf], ModuleCL@4b82d2[com.vendidata.gollum.entitymanagerprovider], ModuleCL@92668c[org.netbeans.modules.keyring], ModuleCL@5b675e[org.openide.explorer], ModuleCL@15b0e2c[org.netbeans.swing.tabcontrol], ModuleCL@12b19c5[org.netbeans.modules.settings], ModuleCL@17e4dee[org.openide.awt], ModuleCL@238016[org.netbeans.modules.javahelp], ModuleCL@2515[org.netbeans.core], ModuleCL@63a721[org.netbeans.modules.queries], ModuleCL@18041e0[at.percom.netbeansmodules.explorerstarter], ModuleCL@159d510[org.netbeans.modules.options.api], ModuleCL@4c6320[org.netbeans.modules.editor.mimelookup], ModuleCL@ea5461[org.netbeans.api.progress], ModuleCL@74cb02[com.vendidata.gollum.legacy.importer], ModuleCL@1000bcf[org.openide.text], ModuleCL@15f4a7f[org.netbeans.modules.keyring.impl], ModuleCL@14e4e31[org.netbeans.modules.editor.mimelookup.impl], ModuleCL@979f67[org.netbeans.modules.autoupdate.services], ModuleCL@1541147[com.vendidata.gollum.databasemanager], ModuleCL@104e28b[org.netbeans.spi.quicksearch], ModuleCL@166f9b9[org.netbeans.core.windows], ModuleCL@1de0b5e[org.openide.dialogs], ModuleCL@1d38b87[org.netbeans.core.output2], ModuleCL@5dfaf1[org.netbeans.core.ui], ModuleCL@970c0e[org.openide.nodes], ModuleCL@670479[org.netbeans.modules.options.keymap], ModuleCL@4d41e2[org.netbeans.modules.masterfs], ModuleCL@166bfd8[org.netbeans.libs.jna], ModuleCL@d58ce2[org.netbeans.core.nativeaccess], ModuleCL@3228a1[org.netbeans.modules.autoupdate.ui], ModuleCL@278e83[org.netbeans.modules.progress.ui], ModuleCL@1dafbaf[org.netbeans.libs.osgi], ModuleCL@91f005[org.openide.io], ModuleCL@98350a[org.netbeans.core.netigso], ModuleCL@739f3f[org.netbeans.libs.felix], ModuleCL@9b6220[org.openide.actions], ModuleCL@1b5391b[com.vendidata.gollum.gollumbase], ModuleCL@497904[org.openide.windows], ModuleCL@196e136[com.vendidata.gollum.thirdpartylibraries], ModuleCL@69a4cb[org.netbeans.modules.sendopts], ModuleCL@5c7734[org.netbeans.swing.outline], ModuleCL@1fb3211[org.jdesktop.layout]]
at org.netbeans.ProxyClassLoader.loadClass(ProxyClassLoader.java:264)
at org.netbeans.ModuleManager$SystemClassLoader.loadClass(ModuleManager.java:530)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at com.sun.corba.ee.impl.util.JDKBridge.loadClass(JDKBridge.java:234)
at com.sun.corba.ee.impl.javax.rmi.CORBA.Util.loadClass(Util.java:640)
at com.sun.corba.ee.impl.presentation.rmi.StubFactoryFactoryDynamicBase.createStubFactory(StubFactoryFactoryDynamicBase.java:73)
Caused: org.omg.CORBA.BAD_OPERATION: FEIN: IOP01210035: ClassNotFoundException while attempting to load interface com.sun.ejb.codegen.GenericEJBHome_Generated vmcid: OMG minor code: 35 completed: Maybe
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.sun.corba.ee.spi.orbutil.logex.corba.CorbaExtension.makeException(CorbaExtension.java:248)
at com.sun.corba.ee.spi.orbutil.logex.corba.CorbaExtension.makeException(CorbaExtension.java:95)
at com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator.handleFullLogging(WrapperGenerator.java:387)
at com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator.access$400(WrapperGenerator.java:107)
at com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator$2.invoke(WrapperGenerator.java:511)
at com.sun.corba.ee.spi.orbutil.proxy.CompositeInvocationHandlerImpl.invoke(CompositeInvocationHandlerImpl.java:99)
at $Proxy68.classNotFound3(Unknown Source)
at com.sun.corba.ee.impl.presentation.rmi.StubFactoryFactoryDynamicBase.createStubFactory(StubFactoryFactoryDynamicBase.java:76)
at com.sun.corba.ee.impl.util.Utility.loadStub(Utility.java:835)
Caused: org.omg.CORBA.BAD_OPERATION: WARNUNG: IOP01211205: Exception in loadStub vmcid: OMG minor code: 1205 completed: No
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.sun.corba.ee.spi.orbutil.logex.corba.CorbaExtension.makeException(CorbaExtension.java:248)
at com.sun.corba.ee.spi.orbutil.logex.corba.CorbaExtension.makeException(CorbaExtension.java:95)
at com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator.handleFullLogging(WrapperGenerator.java:387)
at com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator.access$400(WrapperGenerator.java:107)
at com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator$2.invoke(WrapperGenerator.java:511)
at com.sun.corba.ee.spi.orbutil.proxy.CompositeInvocationHandlerImpl.invoke(CompositeInvocationHandlerImpl.java:99)
at $Proxy91.exceptionInLoadStub(Unknown Source)
at com.sun.corba.ee.impl.util.Utility.loadStub(Utility.java:842)
at com.sun.corba.ee.impl.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:252)
at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:406)
at com.sun.ejb.containers.RemoteBusinessObjectFactory.getObjectInstance(RemoteBusinessObjectFactory.java:75)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
at com.sun.enterprise.naming.impl.SerialContext.getObjectInstance(SerialContext.java:556)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:514)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:455)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at com.vendidata.gollum.server.dataexchange.ServerConnectionTest.testConnection(ServerConnectionTest.java:48)
at com.vendidata.gollum.gollumbase.DebugChriReiTopComponent.jButton1ActionPerformed(DebugChriReiTopComponent.java:71)
at com.vendidata.gollum.gollumbase.DebugChriReiTopComponent.access$000(DebugChriReiTopComponent.java:20)
at com.vendidata.gollum.gollumbase.DebugChriReiTopComponent$1.actionPerformed(DebugChriReiTopComponent.java:48)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.Component.processMouseEvent(Component.java:6267)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6032)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4630)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:137)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
[catch] at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
WARNING [org.netbeans.ProxyClassLoader]: Will not load class com.vendidata.gollum.server.GreeterBeanRemote arbitrarily from one of ModuleCL@196e136[com.vendidata.gollum.thirdpartylibraries] and ModuleCL@864e43[com.vendidata.gollum.businesslogic] starting from SystemClassLoader[53 modules]; see http://wiki.netbeans.org/DevFaqModuleCCE
WARNING [org.netbeans.core.TimableEventQueue]: too much time in AWT thread org.netbeans.core.ui.sampler.SelfSamplerAction$Controller@31f737
WARNING [org.netbeans.core.TimableEventQueue]: no snapshot taken
javax.naming.NamingException: Lookup failed for 'com.vendidata.gollum.server.GreeterBeanRemote' in SerialContext[myEnv={org.omg.CORBA.ORBInitialPort=3700, java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, org.omg.CORBA.ORBInitialHost=10.1.1.13, java.naming.factory.url.pkgs=com.sun.enterprise.naming, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl} [Root exception is javax.naming.NamingException: ejb ref resolution error for remote business interfacecom.vendidata.gollum.server.GreeterBeanRemote [Root exception is java.lang.ClassNotFoundException: Will not load class com.vendidata.gollum.server.GreeterBeanRemote arbitrarily from one of ModuleCL@196e136[com.vendidata.gollum.thirdpartylibraries] and ModuleCL@864e43[com.vendidata.gollum.businesslogic] starting from SystemClassLoader[53 modules]; see http://wiki.netbeans.org/DevFaqModuleCCE]]
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(InitialContext.java:392)
at com.vendidata.gollum.server.dataexchange.ServerConnectionTest.testConnection(ServerConnectionTest.java:48)
at com.vendidata.gollum.gollumbase.DebugChriReiTopComponent.jButton1ActionPerformed(DebugChriReiTopComponent.java:71)
at com.vendidata.gollum.gollumbase.DebugChriReiTopComponent.access$000(DebugChriReiTopComponent.java:20)
at com.vendidata.gollum.gollumbase.DebugChriReiTopComponent$1.actionPerformed(DebugChriReiTopComponent.java:48)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
at java.awt.Component.processMouseEvent(Component.java:6267)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
at java.awt.Component.processEvent(Component.java:6032)
at java.awt.Container.processEvent(Container.java:2041)
at java.awt.Component.dispatchEventImpl(Component.java:4630)
at java.awt.Container.dispatchEventImpl(Container.java:2099)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
at java.awt.Container.dispatchEventImpl(Container.java:2085)
at java.awt.Window.dispatchEventImpl(Window.java:2478)
at java.awt.Component.dispatchEvent(Component.java:4460)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:137)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: javax.naming.NamingException: ejb ref resolution error for remote business interfacecom.vendidata.gollum.server.GreeterBeanRemote [Root exception is java.lang.ClassNotFoundException: Will not load class com.vendidata.gollum.server.GreeterBeanRemote arbitrarily from one of ModuleCL@196e136[com.vendidata.gollum.thirdpartylibraries] and ModuleCL@864e43[com.vendidata.gollum.businesslogic] starting from SystemClassLoader[53 modules]; see http://wiki.netbeans.org/DevFaqModuleCCE]
at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:434)
at com.sun.ejb.containers.RemoteBusinessObjectFactory.getObjectInstance(RemoteBusinessObjectFactory.java:75)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
at com.sun.enterprise.naming.impl.SerialContext.getObjectInstance(SerialContext.java:556)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:514)
... 32 more
Caused by: java.lang.ClassNotFoundException: Will not load class com.vendidata.gollum.server.GreeterBeanRemote arbitrarily from one of ModuleCL@196e136[com.vendidata.gollum.thirdpartylibraries] and ModuleCL@864e43[com.vendidata.gollum.businesslogic] starting from SystemClassLoader[53 modules]; see http://wiki.netbeans.org/DevFaqModuleCCE
at org.netbeans.ProxyClassLoader.loadClass(ProxyClassLoader.java:244)
at org.netbeans.ModuleManager$SystemClassLoader.loadClass(ModuleManager.java:530)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at com.sun.ejb.EJBUtils.getBusinessIntfClassLoader(EJBUtils.java:688)
at com.sun.ejb.EJBUtils.loadGeneratedRemoteBusinessClasses(EJBUtils.java:463)
at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:414)
... 36 more
Alles anzeigen