ivanrc wrote: > > Hi, > > I want to connect EJB CMP deployed in geronimo-tomcat6-jee5-2.0.1 using > remote interface. EJB named EstadoAlarmaBean is well deployed (it appear > in Installed EJB JARs), and JNDI name is "ejb/EstadoAlarma". > > My remote client source code is this: > > public static void main(String[] args) { > Context ctx; > try { > ctx = new InitialContext(); > Object ref = ctx.lookup("ejb/EstadoAlarma"); > EstadoAlarma h = > (EstadoAlarma)PortableRemoteObject.narrow(ref,EstadoAlarma.class); > // String result = h.sayHello(); > System.out.println("ok"); > } catch (NamingException e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } > } > > when I run the client I obtain this exception: > > javax.naming.NameNotFoundException: /ejb/EstadoAlarma does not exist in > the > system. Check that the app was successfully deployed. > at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:239) > at javax.naming.InitialContext.lookup(InitialContext.java:351) > at ClientMain.main(ClientMain.java:23) > > > I think /ejb/EstadoAlarma must exist, because I defined into openejb-jar, > inside <entity> tag this: <jndi-name>ejb/EstadoAlarma</jndi-name> > > > Can anyone help me?.thanks > > attachments: > > openejb-jar: > > <?xml version="1.0" encoding="UTF-8"?> > <openejb-jar > xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.1" > xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.1" > xmlns:pkgen="http://www.openejb.org/xml/ns/pkgen-2.0" > xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1" > xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2"> > > <sys:environment> > <sys:moduleId> > <sys:groupId>default</sys:groupId> > <sys:artifactId>EstadoAlarmaBean</sys:artifactId> > <sys:version>1.21</sys:version> > <sys:type>jar</sys:type> > </sys:moduleId> > </sys:environment> > > <enterprise-beans> > <entity> > <ejb-name>EstadoAlarmaBean</ejb-name> > <jndi-name>ejb/EstadoAlarma</jndi-name> > <table-name>CRC_GSE_ALAR_ESTADO_ALARMA</table-name> > <cmp-field-mapping> > <cmp-field-name>estadoAlarma</cmp-field-name> > <table-column>ESTADO_ALARMA_TP</table-column> > </cmp-field-mapping> > <cmp-field-mapping> > <cmp-field-name>estadoAlarmaGIA</cmp-field-name> > <table-column>ESTADO_ALARMA_GIA_NU</table-column> > </cmp-field-mapping> > <resource-ref> > <ref-name>jdbc/mysqlPool</ref-name> > <resource-link>mysqlPool</resource-link> > </resource-ref> > </entity> > </enterprise-beans> > </openejb-jar> > > ejb-jar: > > <?xml version="1.0" encoding="UTF-8"?> > <ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee" > 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/ejb-jar_2_1.xsd" version="2.1"> > <enterprise-beans> > <entity> > <display-name></display-name> > <ejb-name>EstadoAlarmaBean</ejb-name> > > <home>com.indra.gse.server.ejb.estadoalarma.EstadoAlarmaHome</home> > > <remote>com.indra.gse.server.ejb.estadoalarma.EstadoAlarma</remote> > > <local-home>com.indra.gse.server.ejb.estadoalarma.EstadoAlarmaLocalHome</local-home> > > <local>com.indra.gse.server.ejb.estadoalarma.EstadoAlarmaLocal</local> > > <ejb-class>com.indra.gse.server.ejb.estadoalarma.EstadoAlarmaBean</ejb-class> > <persistence-type>Container</persistence-type> > <prim-key-class>java.lang.String</prim-key-class> > <reentrant>False</reentrant> > <cmp-version>2.x</cmp-version> > <abstract-schema-name>EstadoAlarmaBean</abstract-schema-name> > <cmp-field> > <field-name>estadoAlarma</field-name> > </cmp-field> > <cmp-field> > <field-name>estadoAlarmaGIA</field-name> > </cmp-field> > <primkey-field>estadoAlarma</primkey-field> > <query> > <query-method> > <method-name>findAll</method-name> > <method-params/> > </query-method> > <ejb-ql>SELECT OBJECT(o) FROM EstadoAlarmaBean as o > ORDERBY > o.estadoAlarma</ejb-ql> > </query> > </entity> > </enterprise-beans> > </ejb-jar> > > Hello,
as far as I know You must put the name of the JAR before the given JNDI name: xxx.jar/EstadoAlarmaBean There was an in depth explanation of the naming mechanism in this group some weeks ago, perhaps You can still find it... And just have a look at: http://cwiki.apache.org/GMOxDEV/client-jndi-names.html Daniel