You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by tomaz <to...@arnes.si> on 2012/04/23 09:28:14 UTC

EJB 3.1 lookup failed

Hello I'm new to ejb environment I'm trying to access in web application(TomEE) the remote EJB(Glassfish) but with no luck.

Glassfish application server:
------------------------------
Installed Version:  GlassFish Server Open Source Edition 3.1 (build 43)
Debug:  Not Enabled
HTTP Port(s):  4848,8080,8181
IIOP Port(s):  3820,3920,3700


My Stateless Session Bean:
--------------------------
@Stateless(mappedName="CalculatorEJB", name="Calculator")
@DeclareRoles({"Users", "Admins"})


My glassfish-ejb-jar.xml:
--------------------------
<security-role-mapping>
    <role-name>Uporabniki</role-name>
    <group-name>Users</group-name>
  </security-role-mapping>
  <security-role-mapping>
    <role-name>Administratorji</role-name>
    <group-name>Admins</group-name>
  </security-role-mapping>

  <enterprise-beans>
    <ejb>
      <ejb-name>Calculator</ejb-name>
      <ior-security-config>
        <transport-config>
          <integrity>supported</integrity>
          <confidentiality>supported</confidentiality>
          <establish-trust-in-target>supported</establish-trust-in-target>
          <establish-trust-in-client>supported</establish-trust-in-client>
        </transport-config>
        <as-context>
          <auth-method>username_password</auth-method>
          <realm>file</realm>
          <required>true</required>
        </as-context>
        <sas-context>
          <caller-propagation>supported</caller-propagation>
        </sas-context>
      </ior-security-config>
    </ejb>
  </enterprise-beans>


Glassfish 3.1 JNDI names:
-------------------------
Portable JNDI names for EJB Calculator : [java:global/Calculator-ejb/Calculator!si.arnes.ejb.local.CalculatorLocalApi,
java:global/Calculator-ejb/Calculator!si.arnes.ejb.remote.CalculatorRemoteApi]


TomEE 1.0.0-beta-2-webprofile:
------------------------------
Apache Tomcat/7.0.21
JVM: 1.6.0_10-b33


My web application servlet:
---------------------------
@EJB(lookup="java:comp/env/CalculatorEJB")
private CalculatorApi calcCliApi;

My web.xml:
------------
<ejb-ref>
  <description>remote ejb on glassfish</description>
  <ejb-ref-name>CalculatorEJB</ejb-ref-name>
  <ejb-ref-type>Session</ejb-ref-type>
  <remote>si.arnes.ejb.remote.CalculatorRemoteApi</remote>
</ejb-ref>

My sun-web.xml:
---------------
<ejb-ref>
	<ejb-ref-name>CalculatorEJB</ejb-ref-name>
	<jndi-name>corbaname:iiop:jalovec.arnes.si:3700#java:global/Calculator-ejb/Calculator!si.arnes.ejb.remote.CalculatorRemoteApi</jndi-name>
</ejb-ref>


Problems:
-------------
1) I get no exception's!
2) In openejb.log I have this error messages:
	2012-04-23 09:17:41,109 - ERROR - Error in safeBind method
	javax.naming.NameNotFoundException: No ORB registered with the OpenEJB system
	...
	2012-04-23 09:17:41,109 - ERROR - Error in safeBind method
	javax.naming.NameNotFoundException: No HandleDelegate registered with the OpenEJB system
	......
	2012-04-23 09:17:41,109 - ERROR - Error in safeBind method
	javax.naming.NameNotFoundException: No HandleDelegate registered with the OpenEJB system
	


What I'm doing wrong?



Even if I try the manual lookup it didn't work.

My manual lookup:
-----------------
Properties properties = new Properties();
properties.setProperty("java.naming.factory.state", "com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
properties.setProperty("org.omg.CORBA.ORBInitialHost", "jalovec.arnes.si");
properties.setProperty("org.omg.CORBA.ORBInitialPort", "3700");
Context ctx = new InitialContext(properties);
CalculatorApi calcCli = (CalculatorApi) ctx.lookup("java:global/Calculator-ejb/Calculator!si.arnes.ejb.remote.CalculatorRemoteApi");

I'm getting exception:
----------------------
Name global is not bound in this Context

What I'm doing wrong?



Is there any tutorial for remote EJB?


Regards, Tomaz