SFSB problem with a SAR
markley Jan 21, 2009 4:35 AM
Im using Jboss 4.2.1.GA and jdk 1.5.0_15.
Im trying to deploy two "applications" (EAR and SAR) in the same jboss. First of all, when i deploy this two apps in different jboss it work.
Ok. There is an ejb-jar module in EAR. In this module i deploy 3 ejbs 3.0, 2 stateless and 1 stateful.
@Stateful(name="MyService") @Remote(IMyService.class) public class IngestionService implements IMyService { .... }
SAR project is a client of this stateful bean. the Jndi lookup code :
Properties prop = new Properties(); prop.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); prop.setProperty(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interface"); prop.put(Context.PROVIDER_URL, "jnp://localhost" + ":" + "1099"); InitialContext jndiContext = new InitialContext(prop); IMyService ms = (IMyService)jndiContext.lookup("MYAPP/MyService/remote");
This lookup cause a classcast exception. Like this :
java.lang.ClassCastException: $Proxy80 at schedule.TestScheduler.perform(TestScheduler.java:48) at org.jboss.varia.scheduler.Scheduler$Listener.handleNotification(Scheduler.java:1251) at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.jboss.mx.notification.NotificationListenerProxy.invoke(NotificationListenerProxy.java:153) at $Proxy11.handleNotification(Unknown Source) at javax.management.NotificationBroadcasterSupport.handleNotification(NotificationBroadcasterSupport.java:221) at javax.management.NotificationBroadcasterSupport.sendNotification(NotificationBroadcasterSupport.java:184) at javax.management.timer.Timer.sendNotification(Timer.java:1295) at javax.management.timer.Timer.notifyAlarmClock(Timer.java:1264) at javax.management.timer.TimerAlarmClock.run(Timer.java:1347) at java.util.TimerThread.mainLoop(Timer.java:512) at java.util.TimerThread.run(Timer.java:462)
In any other case i get a IMyService reference, but when the same lookup is done in a SAR i get this excepcion. The $Proxy80 is an instance of StatefulRemoteProxy and this proxy does not implement ejb remote interface.
The global JNDI namespace :
+- MYAPP (class: org.jnp.interfaces.NamingContext) | +- AdminService (class: org.jnp.interfaces.NamingContext) | | +- local (proxy: $Proxy73 implements interface admin.IAdminService,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBLocalObject) | | +- remote (proxy: $Proxy71 implements interface admin.IAdminService,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBObject) | +- MyService (class: org.jnp.interfaces.NamingContext) | | +- remote (class: java.lang.Object) | | +- remoteStatefulProxyFactory (proxy: $Proxy81 implements interface org.jboss.ejb3.ProxyFactory) | +- XMLSerializer (class: org.jnp.interfaces.NamingContext) | | +- local (proxy: $Proxy77 implements interface jaxb.xmlserializer.ISerializer,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBLocalObject)
I need ideas.