geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Cavalcanti (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GERONIMO-6273) Remote EJB-JNDI lookup fails
Date Thu, 16 Feb 2012 16:01:00 GMT

    [ https://issues.apache.org/jira/browse/GERONIMO-6273?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13209466#comment-13209466
] 

Daniel Cavalcanti commented on GERONIMO-6273:
---------------------------------------------

Those links refer to accessing a remote EJB from a remote client (or a client running from
a different JVM for that matter); thus, having to initialize the InitialContext with the properties
required to connect to the EJB container. However, isn't that when running within the EJB
container context that when you create the initial context, those properties are already initialized
there?
                
> Remote EJB-JNDI lookup fails
> ----------------------------
>
>                 Key: GERONIMO-6273
>                 URL: https://issues.apache.org/jira/browse/GERONIMO-6273
>             Project: Geronimo
>          Issue Type: Bug
>      Security Level: public(Regular issues) 
>          Components: OpenEJB
>    Affects Versions: 2.2.1
>         Environment: Windows 7
>            Reporter: Daniel Cavalcanti
>            Priority: Critical
>         Attachments: multiple-ejbs.zip
>
>
> I have created a simple project that defines a Remote Stateless EJB:
> @Remote
> public interface BeanService {
>     public String hello(String name);
> }
> @Stateless
> public class BeanImpl implements BeanService {
>     @Resource(name="who")
>     private String who;
>     public String hello(String name) {
>         return MessageFormat.format("Hello {0} from {1}.", name, who);
>     }
> }
> I also created the deployment descriptor and plan files:
> ejb-jar.xml:
> <?xml version="1.0" encoding="UTF-8"?>
> <ejb-jar
>     version="3.0" 
>     xmlns="http://java.sun.com/xml/ns/javaee" 
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
>     xsi:schemaLocation="
>         http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd">
>     
>     <enterprise-beans>
>         
>         <session>
>             <ejb-name>BeanImplA</ejb-name>
>             <mapped-name>BeanImplA</mapped-name>
>             <business-remote>sample.BeanService</business-remote>
>             <ejb-class>sample.BeanImpl</ejb-class>
>             <env-entry>
>                 <env-entry-name>who</env-entry-name>
>                 <env-entry-type>java.lang.String</env-entry-type>
>                 <env-entry-value>BeanImplA</env-entry-value>
>             </env-entry>
>         </session>
>         
>         <session>
>             <ejb-name>BeanImplB</ejb-name>
>             <mapped-name>BeanImplBB</mapped-name>
>             <business-remote>sample.BeanService</business-remote>
>             <ejb-class>sample.BeanImpl</ejb-class>
>             <env-entry>
>                 <env-entry-name>who</env-entry-name>
>                 <env-entry-type>java.lang.String</env-entry-type>
>                 <env-entry-value>BeanImplBB</env-entry-value>
>             </env-entry>
>         </session>
>         
>     </enterprise-beans>
>     
> </ejb-jar>
> openejb-jar.xml:
> <?xml version="1.0" encoding="windows-1252"?>
> <openejb-jar
>     xmlns="http://openejb.apache.org/xml/ns/openejb-jar-2.2"
>     xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2"
>     xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.2"
>     xmlns:app="http://geronimo.apache.org/xml/ns/j2ee/application-2.0"
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     xsi:schemaLocation="
>         http://openejb.apache.org/xml/ns/openejb-jar-2.2 http://geronimo.apache.org/schemas-2.2/openejb-jar-2.2.xsd">
>     <sys:environment>
>         <sys:moduleId>
>             <sys:groupId>sample</sys:groupId>
>             <sys:artifactId>multiple-ejbs</sys:artifactId>
>             <sys:version>1.0.0</sys:version>
>             <sys:type>jar</sys:type>
>         </sys:moduleId>
>     </sys:environment>
>     
>     <enterprise-beans>
>         <session>
>             <ejb-name>MyBeanA</ejb-name>
>             <jndi-name>MyBeanA</jndi-name>
>         </session>
>         <session>
>             <ejb-name>MyBeanB</ejb-name>
>             <jndi-name>MyBeanBB</jndi-name>
>         </session>
>     </enterprise-beans>
> </openejb-jar>
> And a simple web service class to test the deployed EJB:
> @WebService(
>     name="SampleWS",
>     portName="SampleWS",
>     serviceName="SampleWS")
> @Stateless()
> public class SampleWS {
>     
>     private InitialContext ic;
>     
>     @PostConstruct
>     protected void postConstruct() {
>         try {
>             ic = new InitialContext();
>         } catch (NamingException ex) {
>             ex.printStackTrace();
>         }
>     }
>     
>     @WebMethod
>     public void lookup(@WebParam String name) {
>         try {
>             System.out.println("Looking up " + name);
>             BeanService bean = (BeanService) ic.lookup(name);
>             System.out.println(bean.hello(name));
>         } catch (Exception ex) {
>             System.err.println("Error: " + ex.getMessage());
>         }
>     }
>     
> }
> I start geronimo with debug level logging and deploy the application:
> 2012-02-14 18:12:39,855 INFO  [startup] Undeploying app: C:\Users\204071044\AppData\Local\Temp\geronimo-deployer983143051956019168.tmpdir\multiple-ejbs-1.0.0.jar
> 2012-02-14 18:12:39,903 INFO  [DirectoryMonitor] Hot deployer notified that an artifact
was removed: sample/multiple-ejbs/1.0.0/jar
> 2012-02-14 18:12:40,683 INFO  [config] Configuring Service(id=DefaultStatelessContainer,
type=Container, provider-id=Default Stateless Container)
> 2012-02-14 18:12:40,683 INFO  [config] Configuring Service(id=DefaultStatefulContainer,
type=Container, provider-id=Default Stateful Container)
> 2012-02-14 18:12:40,683 INFO  [config] Configuring Service(id=DefaultSingletonContainer,
type=Container, provider-id=Default Singleton Container)
> 2012-02-14 18:12:40,683 INFO  [config] Configuring Service(id=DefaultBMPContainer, type=Container,
provider-id=Default BMP Container)
> 2012-02-14 18:12:40,683 INFO  [config] Configuring Service(id=DefaultCMPContainer, type=Container,
provider-id=Default CMP Container)
> 2012-02-14 18:12:40,683 INFO  [config] Configuring enterprise application: sample/multiple-ejbs/1.0.0/jar
> 2012-02-14 18:12:40,761 INFO  [OpenEJB] Auto-deploying ejb BeanImplA: EjbDeployment(deployment-id=multiple-ejbs/BeanImplA)
> 2012-02-14 18:12:40,761 INFO  [OpenEJB] Auto-deploying ejb BeanImplB: EjbDeployment(deployment-id=multiple-ejbs/BeanImplB)
> 2012-02-14 18:12:40,761 INFO  [OpenEJB] Auto-deploying ejb BeanImpl: EjbDeployment(deployment-id=multiple-ejbs/BeanImpl)
> 2012-02-14 18:12:40,761 INFO  [OpenEJB] Auto-deploying ejb SampleWS: EjbDeployment(deployment-id=multiple-ejbs/SampleWS)
> 2012-02-14 18:12:40,761 INFO  [config] Enterprise application "sample/multiple-ejbs/1.0.0/jar"
loaded.
> 2012-02-14 18:12:41,416 INFO  [JAXWSServiceBuilder] Configuring EJB JAX-WS Web Service:
SampleWS at /SampleWS/SampleWS
> 2012-02-14 18:12:43,601 INFO  [startup] Assembling app: C:\Users\204071044\AppData\Local\Temp\geronimo-deployer2964695379050213700.tmpdir\multiple-ejbs-1.0.0.jar
> 2012-02-14 18:12:43,805 INFO  [startup] Jndi(name=BeanImplA) --> Ejb(deployment-id=multiple-ejbs/BeanImplA)
> 2012-02-14 18:12:43,805 INFO  [startup] Jndi(name=BeanImplBB) --> Ejb(deployment-id=multiple-ejbs/BeanImplB)
> 2012-02-14 18:12:43,805 INFO  [startup] Jndi(name=BeanImplRemote) --> Ejb(deployment-id=multiple-ejbs/BeanImpl)
> 2012-02-14 18:12:43,805 INFO  [startup] Jndi(name=SampleWSLocalBean) --> Ejb(deployment-id=multiple-ejbs/SampleWS)
> 2012-02-14 18:12:43,805 INFO  [startup] Created Ejb(deployment-id=multiple-ejbs/BeanImplB,
ejb-name=BeanImplB, container=DefaultStatelessContainer)
> 2012-02-14 18:12:43,820 INFO  [startup] Created Ejb(deployment-id=multiple-ejbs/BeanImplA,
ejb-name=BeanImplA, container=DefaultStatelessContainer)
> 2012-02-14 18:12:43,836 INFO  [startup] Created Ejb(deployment-id=multiple-ejbs/BeanImpl,
ejb-name=BeanImpl, container=DefaultStatelessContainer)
> 2012-02-14 18:12:43,836 INFO  [startup] Created Ejb(deployment-id=multiple-ejbs/SampleWS,
ejb-name=SampleWS, container=DefaultStatelessContainer)
> 2012-02-14 18:12:43,836 INFO  [startup] Deployed Application(path=C:\Users\204071044\AppData\Local\Temp\geronimo-deployer2964695379050213700.tmpdir\multiple-ejbs-1.0.0.jar)
> 2012-02-14 18:12:44,023 INFO  [ModuleDeployer] Deploying module: addressing-1.5.2 - file:/C:/Users/204071044/Software/DRMS/2.0/geronimo-tomcat6-javaee5-2.2.1/repository/org/apache/axis2/addressing/1.5.2/addressing-1.5.2.mar
> 2012-02-14 18:12:44,210 INFO  [SupportedModesServiceImpl] Portlet mode 'edit' not found
for portletId: '/plugin.Deployment!-87374526|0'
> I tried various combinations of JNDI name to lookup this EJB with no success. According
to the documentation, the name should be {deploymentId}{interfaceType.annotationName}, so
in this case, "multiple-ejbs/BeanImplARemote" should work for example. However, the output
is an error:
> Looking up multiple-ejbs/BeanImplARemote
> Error: multiple-ejbs/BeanImplARemote

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message