Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » RAP in Geronimo/EJB lookups(Looking up EJBs in RAP within Geronimo App Server)
RAP in Geronimo/EJB lookups [message #1257645] Wed, 26 February 2014 17:05 Go to next message
Roland Welker is currently offline Roland WelkerFriend
Messages: 13
Registered: October 2013
Junior Member
Hi,

I have been trying for a while to get a RAP applications to work within Geronimo and consume EJBs.

So far I have used a Jetty frontend to the application server, however I would like to be able to deploy the RAP application with the rest of EAR without seperating it into 2 servers.

I have setup a simple test program to demostrate the issue. A simple ejb, returning a string.
And a simple RAP application with a view and a button. Once the button is clicked, the InitialContext is created, the EJB looked up and the business method invoked.
The EJB project and the RAP war are deployed as part of a EAR.

This is the relevant (and failing) code in the view:
					Properties prop = new Properties();
					prop.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.RemoteInitialContextFactory");
					prop.put("java.naming.provider.url", "ejbd://localhost:4201");
					
					prop.setProperty(Context.SECURITY_PRINCIPAL, "system");
					prop.setProperty(Context.SECURITY_CREDENTIALS, "manager");
					prop.setProperty("openejb.authentication.realmName", "geronimo-admin"); 
					InitialContext ServerConnection = new InitialContext(prop);
										
					ITestMe remote = (ITestMe)ServerConnection.lookup("TestMeRemote");
					
					System.out.println("Client: " + remote.sayHello("Hello"));


The web.xml contains an ejb reference as such:
Quote:

<ejb-ref>
<ejb-ref-name>TestMeRemote</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<remote>com.switchedonsystems.test.interfaces.ITestMe</remote>
</ejb-ref>



The code execution fails with the lookup call on the InitialContext with the following exception:
Quote:

java.lang.IllegalArgumentException: interface org.apache.openejb.client.EJBObjectProxy is not visible from class loader
at java.lang.reflect.Proxy.getProxyClass(Proxy.java:370)
at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:598)
at org.apache.openejb.client.proxy.Jdk13ProxyFactory.newProxyInstance(Jdk13ProxyFactory.java:118)
at org.apache.openejb.client.proxy.ProxyManager.newProxyInstance(ProxyManager.java:107)
at org.apache.openejb.client.EJBObjectHandler.createEJBObjectProxy(EJBObjectHandler.java:134)
at org.apache.openejb.client.JNDIContext.createBusinessObject(JNDIContext.java:193)
at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:234)
at org.apache.aries.jndi.DelegateContext.lookup(DelegateContext.java:161)
at javax.naming.InitialContext.lookup(InitialContext.java:409)
at com.switchedonsystems.test.ui.View$1.widgetSelected(View.java:147)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:262)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:85)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:700)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:602)
at org.eclipse.swt.widgets.Display.executeNextEvent(Display.java:1205)
at org.eclipse.swt.widgets.Display.runPendingMessages(Display.java:1186)
at org.eclipse.swt.widgets.Display.safeReadAndDispatch(Display.java:1169)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1161)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2733)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2694)
at org.eclipse.ui.internal.Workbench.access$5(Workbench.java:2530)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:701)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:684)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:157)
at com.switchedonsystems.test.ui.SOSEntryPoint.createUI(SOSEntryPoint.java:15)
at org.eclipse.rap.rwt.internal.lifecycle.RWTLifeCycle.createUI(RWTLifeCycle.java:186)
at org.eclipse.rap.rwt.internal.lifecycle.RWTLifeCycle$UIThreadController.run(RWTLifeCycle.java:298)
at java.lang.Thread.run(Thread.java:636)
at org.eclipse.rap.rwt.internal.lifecycle.UIThread.run(UIThread.java:104)


If I wrap the whole remote section of the code into RWT.requestThreadExec, it fails with the same error.

Any help would be appreciated.

Thank you,
Roland
Re: RAP in Geronimo/EJB lookups [message #1257655 is a reply to message #1257645] Wed, 26 February 2014 17:17 Go to previous messageGo to next message
Roland Welker is currently offline Roland WelkerFriend
Messages: 13
Registered: October 2013
Junior Member
Small additon. the ejb spec, openejb client implementation and geronimo security are included in my plugin as jar files
Re: RAP in Geronimo/EJB lookups [message #1258315 is a reply to message #1257655] Thu, 27 February 2014 09:02 Go to previous messageGo to next message
Arnaud MERGEY is currently offline Arnaud MERGEYFriend
Messages: 243
Registered: March 2010
Location: France
Senior Member
Hello,

are you using WAR product and Equinox Servlet Bridge ? if yes,
you can change your launch.ini like this

osgi.parentClassloader=app
osgi.contextClassLoaderParent=ccl

It should solve the issue

Also you should not need properties to instanciate your initialContext if your web app is in the EAR, this should work:


InitialContext ServerConnection = new InitialContext();

ITestMe remote = (ITestMe)ServerConnection.lookup("TestMeRemote");

System.out.println("Client: " + remote.sayHello("Hello"));

Regards,
Arnaud
Re: RAP in Geronimo/EJB lookups [message #1258749 is a reply to message #1258315] Thu, 27 February 2014 18:19 Go to previous message
Roland Welker is currently offline Roland WelkerFriend
Messages: 13
Registered: October 2013
Junior Member
Thank you very much for your reply.

Yes, I am using the equinox bridge. And I have figured out my mistake.

I added my app server related jars to the library section of the war deployment tool and added the following to the launch.ini file:

org.osgi.framework.system.packages.extra=

with the exported packages of the jars in it.

And that did do the trick.

Roland
Previous Topic:Traverse listener not firing on Arrow-Keys
Next Topic:Redirecting Requests to Root Path Entry Point
Goto Forum:
  


Current Time: Thu Mar 28 11:46:42 GMT 2024

Powered by FUDForum. Page generated in 0.03472 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top