No (remote) JNDI binding for ejb in ear
kruddies Aug 11, 2006 4:52 PMHi,
i changed the slsb example from the ejb3 trailblazer and got some problems. After adding a remote interface to class StatelessCalculator there are not longer JNDI bindings.
Without the Remotecalculator interface i saw the JNDI Binding for the Bean and the local interface.
I Use jboss-4.0.4.GA installed with option ejb3
StatelessCalculator.java
package ejb3trail.ejb; import javax.ejb.*; @Stateless // @LocalBinding (jndiBinding="EJB3Trail/slsb/Calculator") public class StatelessCalculator implements Calculator, RemoteCalculator { public double calculate(int start, int end, double growthrate, double saving) { double tmp = Math.pow(1. + growthrate / 12., 12. * (end - start) + 1); return saving * 12. * (tmp - 1) / growthrate; } public String getServerInfo() { return "This is the JBoss EJB 3.0 Trail Blazer"; } }
Calculator.java
package ejb3trail.ejb; public interface Calculator { public double calculate(int start, int end, double growthrate, double saving); }
RemoteCalculator.java
package ejb3trail.ejb; public interface RemoteCalculator { public double calculate(int start, int end, double growthrate, double saving); public String getServerInfo(); }
ejb3trail.ear
META-INF/ META-INF/MANIFEST.MF avalon-framework-4.1.3.jar commons-logging-1.1.jar ejb3trail-ejb-0.0.1.jar jboss-annotations-ejb3-4.0.4.GA.jar jboss-ejb3x-4.0.4.GA.jar log4j-1.2.9.jar logkit-1.0.1.jar META-INF/application.xml META-INF/jboss-app.xml servlet-api-2.3.jar META-INF/maven/ META-INF/maven/ejb3trail/ META-INF/maven/ejb3trail/ejb3trail-ear/ META-INF/maven/ejb3trail/ejb3trail-ear/pom.xml META-INF/maven/ejb3trail/ejb3trail-ear/pom.properties
application.xml
<?xml version="1.0" encoding="UTF-8"?> <application xmlns="http://java.sun.com/xml/ns/j2ee" version="1.4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com /xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd"> <display-name>ejb3trail</display-name> <description>ejb3trail server</description> <module> <ejb>ejb3trail-ejb-0.0.1.jar</ejb> </module> </application>
jboss-app.xml
<!DOCTYPE jboss-app PUBLIC "-//JBoss//DTD J2EE Application 1.4//EN" "http://www.jboss.org/j2ee/dtd/jboss-app_4_0.dtd"> <jboss-app> <loader-repository> ejb3trail:app=ejb3 </loader-repository> </jboss-app>
ejb3trail-ejb-0.0.1.jar
META-INF/ META-INF/MANIFEST.MF ejb3trail/ ejb3trail/ejb/ ejb3trail/ejb/Calculator.class ejb3trail/ejb/LocalRemoteCalculator.class ejb3trail/ejb/RemoteCalculator.class ejb3trail/ejb/StatelessCalculator.class META-INF/ejb-jar.xml META-INF/maven/ META-INF/maven/ejb3trail/ META-INF/maven/ejb3trail/ejb3trail-ejb/ META-INF/maven/ejb3trail/ejb3trail-ejb/pom.xml META-INF/maven/ejb3trail/ejb3trail-ejb/pom.properties
ejb-jar.xml
<ejb-jar version="3.0"> </ejb-jar>
JBoss console
22:27:15,359 INFO [Server] JBoss (MX MicroKernel) [4.0.4.GA (build: CVSTag=JBoss_4_0_4_GA date=200605151000)] Started i n 15s:922ms 22:28:25,375 INFO [EARDeployer] Init J2EE application: file:/C:/jboss-4.0.4.GA/server/default/deploy/ejb3trail.ear 22:28:27,093 INFO [Ejb3Deployment] EJB3 deployment time took: 734 22:28:27,171 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:ear=ejb3trail.ear,jar=ejb3trail-ejb-0.0.1.jar,nam e=LocalRemoteCalculator,service=EJB3 with dependencies: 22:28:27,453 INFO [EJBContainer] STARTED EJB: ejb3trail.ejb.LocalRemoteCalculator ejbName: LocalRemoteCalculator 22:28:27,453 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:ear=ejb3trail.ear,jar=ejb3trail-ejb-0.0.1.jar,nam e=StatelessCalculator,service=EJB3 with dependencies: 22:28:27,468 INFO [EJBContainer] STARTED EJB: ejb3trail.ejb.StatelessCalculator ejbName: StatelessCalculator
jmx-console service=JNDIView shows
java: Namespace +- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory) +- DefaultDS (class: org.jboss.resource.adapter.jdbc.WrapperDataSource) +- SecurityProxyFactory (class: org.jboss.security.SubjectSecurityProxyFactory) +- DefaultJMSProvider (class: org.jboss.jms.jndi.JNDIProviderAdapter) +- comp (class: javax.naming.Context) +- JmsXA (class: org.jboss.resource.adapter.jms.JmsConnectionFactoryImpl) +- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory) +- jaas (class: javax.naming.Context) | +- other (class: org.jboss.security.plugins.SecurityDomainContext) | +- HsqlDbRealm (class: org.jboss.security.plugins.SecurityDomainContext) | +- jbossmq (class: org.jboss.security.plugins.SecurityDomainContext) | +- JmsXARealm (class: org.jboss.security.plugins.SecurityDomainContext) +- timedCacheFactory (class: javax.naming.Context) Failed to lookup: timedCacheFactory, errmsg=org.jboss.util.TimedCachePolicy +- TransactionPropagationContextExporter (class: org.jboss.tm.TransactionPropagationContextFactory) +- StdJMSPool (class: org.jboss.jms.asf.StdServerSessionPoolFactory) +- Mail (class: javax.mail.Session) +- comp.ejb3 (class: javax.naming.Context) | NonContext: null +- TransactionPropagationContextImporter (class: org.jboss.tm.TransactionPropagationContextImporter) +- TransactionManager (class: org.jboss.tm.TxManager) Global JNDI Namespace +- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory) +- TopicConnectionFactory (class: org.jboss.naming.LinkRefPair) +- EventDispatcher (class: org.jboss.ws.eventing.mgmt.DispatcherDelegate) +- UserTransactionSessionFactory (proxy: $Proxy42 implements interface org.jboss.tm.usertx.interfaces.UserTransactionSessionFactory) +- UIL2ConnectionFactory[link -> ConnectionFactory] (class: javax.naming.LinkRef) +- UIL2XAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef) +- QueueConnectionFactory (class: org.jboss.naming.LinkRefPair) +- topic (class: org.jnp.interfaces.NamingContext) | +- testDurableTopic (class: org.jboss.mq.SpyTopic) | +- testTopic (class: org.jboss.mq.SpyTopic) | +- securedTopic (class: org.jboss.mq.SpyTopic) +- queue (class: org.jnp.interfaces.NamingContext) | +- A (class: org.jboss.mq.SpyQueue) | +- testQueue (class: org.jboss.mq.SpyQueue) | +- ex (class: org.jboss.mq.SpyQueue) | +- DLQ (class: org.jboss.mq.SpyQueue) | +- D (class: org.jboss.mq.SpyQueue) | +- C (class: org.jboss.mq.SpyQueue) | +- B (class: org.jboss.mq.SpyQueue) +- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory) +- UserTransaction (class: org.jboss.tm.usertx.client.ClientUserTransaction) +- jmx (class: org.jnp.interfaces.NamingContext) | +- invoker (class: org.jnp.interfaces.NamingContext) | | +- RMIAdaptor (proxy: $Proxy36 implements interface org.jboss.jmx.adaptor.rmi.RMIAdaptor,interface org.jboss.jmx.adaptor.rmi.RMIAdaptorExt) | +- rmi (class: org.jnp.interfaces.NamingContext) | | +- RMIAdaptor[link -> jmx/invoker/RMIAdaptor] (class: javax.naming.LinkRef) +- UILXAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef) +- UILConnectionFactory[link -> ConnectionFactory] (class: javax.naming.LinkRef)
If deploy only the ejb.jar i see the JNDI Bindings
... +- EJB3Trail (class: org.jnp.interfaces.NamingContext) | +- LocalCalculator (proxy: $Proxy80 implements interface ejb3trail.ejb.Calculator,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBLocalObject) | +- RemoteCalculator (proxy: $Proxy79 implements interface ejb3trail.ejb.RemoteCalculator,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBObject) ...
What's wrong? Any ideas?
Regards Kai