Accessing Remote EJB

Hi

I spent last week creating a small 3 tier application using NetBeans and reading documentation on how to process... so I have a fair understanding of EJB. I succeeded in deploying my EJB module and then my Web module (war) onto the a Sun App Server on my local machine. (my EJB has both remote & local interface)

I created 1 simple EJB with 1 method and eveything works fine if I access my EJB from my web tier using these methods:

@EJB

private CalculatriceRemote calculatrice;

OR

InitialContext ic;

try{

ic =new InitialContext();

Object ref = ic.lookup("java:comp/env/ejb/Foo");

CalculatriceRemote calc = (CalculatriceRemote)PortableRemoteObject.narrow(ref,CalculatriceRemote.class);

result = calc.additionner(x,y);

}catch (NamingException ex){

}

...

Now what I am looking for, is to deploy the EJB part on ANOTHER sun App server (on another physical machine). And I would like to access it from my Web tier which is on my local machine.

I googled without any good result... some talk about JNDI, some talk about the sun-web.xml file, some about CORBA, some about WebLogic. This is really confusing.

I am new to this so I was wondering if anyone could give me a good starting trail or hints on what I need to know exactly to achieve this...

Thanks

[1641 byte] By [moriaka] at [2007-11-26 18:11:38]
# 1
This is covered in our EJB FAQ :https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html#cross-appserverremoteref --ken
ksaksa at 2007-7-9 5:44:16 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2

[nobr]Hey

Thanks for the answer, it helped a lot. It gave me a good hint on where to look at...

But after trying many different things I still get stuck with a javax.naming.NameNotFoundException. I think I am doing it write but the thing I really can't be sure about is where exactly does this error comes from... it is from my servlet or... does it really goes up to the other server and then does not find the Bean...

Here is how I setup my code perhaps you will see what is it I am doing wrong.

1) In the war-module deployed on Server1

web.xml

<ejb-ref>

<ejb-ref-name>Test</ejb-ref-name>

<ejb-ref-type>Session</ejb-ref-type>

<home>ejb.TestLocal</home>

<remote>ejb.TestRemote</remote>

<ejb-link>ejb.TestBean</ejb-link>

</ejb-ref>

sun-web.xml

<ejb-ref>

<ejb-ref-name>Test</ejb-ref-name>

<jndi-name>corbaname:iiop:192.168.209.132:3700#ejb/TestRemote</jndi-name>

</ejb-ref>

In the servlet

try {

InitialContext ic = new InitialContext();

//Object ref = ic.lookup("corbaname:iiop:192.168.209.132:3700#ejb/TestRemote");

Object ref = ic.lookup("java:comp/env/ejb/Test");

TestRemote testBean = (TestRemote)PortableRemoteObject.narrow(ref, TestRemote.class);

out.println(testBean.businessMethod());

}

catch (Exception e) {

out.println(e.getClass().getName());

out.println("<br>");

out.println(e.getMessage());

}

2) In the ejb-module deployed on Server2

My Bean

package ejb;

import javax.ejb.Stateless;

@Stateless

public class TestBean implements TestRemote, TestLocal {

/** Creates a new instance of TestBean */

public TestBean() {

}

public int businessMethod() {

return 0;

}

}

My Bean's Remote Interface

package ejb;

import javax.ejb.Local;

@Local

public interface TestLocal {

int businessMethod();

}

My Bean's Local Interface

package ejb;

import javax.ejb.Remote;

@Remote

public interface TestRemote {

int businessMethod();

}

JNDI name on Server2 (from server console)

ejb.TestRemote

demo.ejb3.calculatrice.CalculatriceRemote__3_x_Internal_RemoteBusinessHome__

demo.ejb3.calculatrice.CalculatriceRemote#demo.ejb3.calculatrice.CalculatriceRemote

ejb.TestRemote__3_x_Internal_RemoteBusinessHome__

jdbc (folder)

UserTransaction

ejb (folder)

ejb.TestRemote#ejb.TestRemote

demo.ejb3.calculatrice.CalculatriceRemote

I have been messing arround with this for 3 days, I'm sure I am just not typing the right JNDI reference somewhere... can anyone help me figure this out?

Thanks[/nobr]

moriaka at 2007-7-9 5:44:16 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 3

Few things. First, if you don't explicitly assign the global JNDI name of the ejb it will

default to the fully qualified name of the Remote interface.That would make it

"ejb.TestRemote" instead of "ejb/TestRemote".

On the client side, the ejb-ref is incorrect. Since it's referring to a 3.0 remote business interface,

there is no <home> element needed. You also don't need the <ejb-link> since that only

applies when you're referring to another ejb within the same .ear.

<ejb-ref>

<ejb-ref-name>Test</ejb-ref-name>

<ejb-ref-type>Session</ejb-ref-type>

<remote>ejb.TestRemote</remote>

</ejb-ref>

Finally, the portion of the lookup string after "java:comp/env/" must match the content of

the ejb-ref-name exactly. There is no automatic pre-pending of "ejb". So, based on

the above ejb-ref, the code should be ic.lookup("java:comp/env/Test");

ksaksa at 2007-7-9 5:44:16 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 4

Hi, thanks for the reply... ok I fixed the code as you told. Here is the result of the modification:

SERVER:

I removed the deployment descriptor from the ejb module so now, on the server console, I can see that the JNDI name is, as you told, ejb.TestRemote.

CLIENT:

web.xml

<ejb-ref>

<ejb-ref-name>Test</ejb-ref-name>

<ejb-ref-type>Session</ejb-ref-type>

<remote>ejb.TestRemote</remote>

</ejb-ref>

sun-web.xml

<ejb-ref>

<ejb-ref-name>Test</ejb-ref-name>

<jndi-name>corbaname:iiop:192.168.209.132:3700#ejb/TestRemote</jndi-name>

</ejb-ref>

Servlet code

try {

InitialContext ic = new InitialContext();

Object ref = ic.lookup("java:comp/env/Test");

TestRemote testBean = (TestRemote)PortableRemoteObject.narrow(ref, TestRemote.class);

out.println(testBean.businessMethod());

}

catch (Exception e) {

out.println(e.getClass().getName());

out.println("

");

out.println(e.getMessage());

}

--

Also, I get this error when I deploy my web app:

"IOP00100009: (BAD_PARAM) string_to_object conversion failed due to bad bad schema specific part"

org.omg.CORBA.BAD_PARAM:vmcid: OMG minor code: 9 completed: No

at com.sun.corba.ee.impl.logging.OMGSystemException.soBadSchemaSpecific(OMGSystemException.java:1081)

at com.sun.corba.ee.impl.logging.OMGSystemException.soBadSchemaSpecific(OMGSystemException.java:1099)

at com.sun.corba.ee.impl.resolver.INSURLOperationImpl.resolveCorbaname(INSURLOperationImpl.java:188)

at com.sun.corba.ee.impl.resolver.INSURLOperationImpl.resolveINSURL(INSURLOperationImpl.java:127)

at com.sun.corba.ee.impl.resolver.INSURLOperationImpl.operate(INSURLOperationImpl.java:117)

at com.sun.corba.ee.impl.orb.ORBImpl.string_to_object(ORBImpl.java:929)

at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:831)

at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:156)

at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:307)

at javax.naming.InitialContext.lookup(InitialContext.java:351)

at servlet.TestServlet.processRequest(TestServlet.java:40)

at servlet.TestServlet.doGet(TestServlet.java:60)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)

at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:278)

at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)

at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)

at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)

at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)

at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)

at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)

at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)

at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:231)

at com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)

at com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)

at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)

at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)

at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)

at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)

at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)

Caused by: org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0

at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHelper.java:72)

at org.omg.CosNaming._NamingContextExtStub.resolve_str(_NamingContextExtStub.java:165)

at com.sun.corba.ee.impl.resolver.INSURLOperationImpl.resolveCorbaname(INSURLOperationImpl.java:184)

... 35 more

deployed with moduleid = TestEJB-war

WEB0100: Loading web module [TestEJB-war] in virtual server [server] at [/TestEJB-war]

moriaka at 2007-7-9 5:44:16 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 5

The ejb-ref mapping in sun-web.xml still doesn't match the target global JNDI name.

<jndi-name>corbaname:iiop:192.168.209.132:3700#ejb/TestRemote</jndi-name>

should be

<jndi-name>corbaname:iiop:192.168.209.132:3700#ejb.TestRemote</jndi-name>

Also, what version of the App Server are you using? There was a bug that prevented

this from working in the original Java EE 5 SDK.It should be fixed in the latest

release on the web site or from glassfish. Here's the bug :

https://glassfish.dev.java.net/issues/show_bug.cgi?id=735

ksaksa at 2007-7-9 5:44:16 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 6

Hey there.

I replaced the / with a . in the JNDI name.

I did not verify the version of my App Server since I work on a different computer today... I will confirm you the version in a future post.

What I did though is install a brand new version of Sun App Server on my remote machine (a debian linux virtual machine). If I run the command: "./asadmin version" I get 9.0_01.

On my local machine, I re-installed a new java EE SDK netbeans included, freshly downloaded from Sun. Same thing with "./asadmin version" I get 9.0_01.

Let me reconfirm the configuration:

Server

EJB on the server has the ejb.TestRemote JNDI name. It is deployed, I can telnet the 3700 port

Local

web.xml

<ejb-ref>

<ejb-ref-name>Test</ejb-ref-name>

<ejb-ref-type>Session</ejb-ref-type>

<home>ejb.TestLocal</home> //If it is not there, I can't deploy/run... !!! and netbeans gives me an error on the file

<remote>ejb.TestRemote</remote>

</ejb-ref>

sun-web.xml

<ejb-ref>

<ejb-ref-name>Test</ejb-ref-name>

<jndi-name>corbaname:iiop:10.211.55.7:3700#ejb.TestRemote</jndi-name>

</ejb-ref>

Servlet

try {

Context c = new InitialContext();

//return (TestRemote) c.lookup("ejb.TestRemote");//WORKING IF EJB & WAR ON SAME SERVER

return (TestRemote) c.lookup("java:comp/env/Test");

}

catch(NamingException ne) {

Logger.getLogger(getClass().getName()).log(Level.SEVERE,"exception caught" ,ne);

throw new RuntimeException(ne);

}

When I deploy on my local server I get the following errors:

App Server Output

"IOP00100009: (BAD_PARAM) string_to_object conversion failed due to bad bad schema specific part"

org.omg.CORBA.BAD_PARAM:vmcid: OMG minor code: 9 completed: No

at com.sun.corba.ee.impl.logging.OMGSystemException.soBadSchemaSpecific(OMGSystemException.java:1081)

at com.sun.corba.ee.impl.logging.OMGSystemException.soBadSchemaSpecific(OMGSystemException.java:1099)

at com.sun.corba.ee.impl.resolver.INSURLOperationImpl.resolveCorbaname(INSURLOperationImpl.java:188)

at com.sun.corba.ee.impl.resolver.INSURLOperationImpl.resolveINSURL(INSURLOperationImpl.java:127)

at com.sun.corba.ee.impl.resolver.INSURLOperationImpl.operate(INSURLOperationImpl.java:117)

at com.sun.corba.ee.impl.orb.ORBImpl.string_to_object(ORBImpl.java:929)

at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:831)

at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:156)

at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:307)

at javax.naming.InitialContext.lookup(InitialContext.java:351)

at servlets.TestBean.lookupTestBean(TestBean.java:76)

at servlets.TestBean.processRequest(TestBean.java:37)

at servlets.TestBean.doGet(TestBean.java:51)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)

at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:278)

at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)

at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)

at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)

at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)

at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)

at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)

at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)

at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:239)

at com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)

at com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)

at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)

at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)

at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)

at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)

at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)

Caused by: org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0

at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHelper.java:72)

at org.omg.CosNaming._NamingContextExtStub.resolve_str(_NamingContextExtStub.java:165)

at com.sun.corba.ee.impl.resolver.INSURLOperationImpl.resolveCorbaname(INSURLOperationImpl.java:184)

... 36 more

exception caught

javax.naming.NameNotFoundException: No object bound for java:comp/env/Test [Root exception is org.omg.CORBA.BAD_PARAM:vmcid: OMG minor code: 9 completed: No]

at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:196)

at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:307)

at javax.naming.InitialContext.lookup(InitialContext.java:351)

at servlets.TestBean.lookupTestBean(TestBean.java:76)

at servlets.TestBean.processRequest(TestBean.java:37)

at servlets.TestBean.doGet(TestBean.java:51)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)

at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:278)

at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)

at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)

at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)

at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)

at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)

at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)

at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)

at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:239)

at com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)

at com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)

at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)

at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)

at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)

at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)

at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)

Caused by: org.omg.CORBA.BAD_PARAM:vmcid: OMG minor code: 9 completed: No

at com.sun.corba.ee.impl.logging.OMGSystemException.soBadSchemaSpecific(OMGSystemException.java:1081)

at com.sun.corba.ee.impl.logging.OMGSystemException.soBadSchemaSpecific(OMGSystemException.java:1099)

at com.sun.corba.ee.impl.resolver.INSURLOperationImpl.resolveCorbaname(INSURLOperationImpl.java:188)

at com.sun.corba.ee.impl.resolver.INSURLOperationImpl.resolveINSURL(INSURLOperationImpl.java:127)

at com.sun.corba.ee.impl.resolver.INSURLOperationImpl.operate(INSURLOperationImpl.java:117)

at com.sun.corba.ee.impl.orb.ORBImpl.string_to_object(ORBImpl.java:929)

at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:831)

at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:156)

... 31 more

Caused by: org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0

at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHelper.java:72)

at org.omg.CosNaming._NamingContextExtStub.resolve_str(_NamingContextExtStub.java:165)

at com.sun.corba.ee.impl.resolver.INSURLOperationImpl.resolveCorbaname(INSURLOperationImpl.java:184)

... 36 more

StandardWrapperValve[TestBean]: Servlet.service() for servlet TestBean threw exception

java.lang.RuntimeException: javax.naming.NameNotFoundException: No object bound for java:comp/env/Test [Root exception is org.omg.CORBA.BAD_PARAM:vmcid: OMG minor code: 9 completed: No]

at servlets.TestBean.lookupTestBean(TestBean.java:80)

at servlets.TestBean.processRequest(TestBean.java:37)

at servlets.TestBean.doGet(TestBean.java:51)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)

at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:278)

at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)

at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)

at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)

at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)

at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)

at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)

at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)

at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:239)

at com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)

at com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)

at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)

at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)

at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)

at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)

at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)

Caused by: javax.naming.NameNotFoundException: No object bound for java:comp/env/Test [Root exception is org.omg.CORBA.BAD_PARAM:vmcid: OMG minor code: 9 completed: No]

at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:196)

at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:307)

at javax.naming.InitialContext.lookup(InitialContext.java:351)

at servlets.TestBean.lookupTestBean(TestBean.java:76)

... 28 more

Caused by: org.omg.CORBA.BAD_PARAM:vmcid: OMG minor code: 9 completed: No

at com.sun.corba.ee.impl.logging.OMGSystemException.soBadSchemaSpecific(OMGSystemException.java:1081)

at com.sun.corba.ee.impl.logging.OMGSystemException.soBadSchemaSpecific(OMGSystemException.java:1099)

at com.sun.corba.ee.impl.resolver.INSURLOperationImpl.resolveCorbaname(INSURLOperationImpl.java:188)

at com.sun.corba.ee.impl.resolver.INSURLOperationImpl.resolveINSURL(INSURLOperationImpl.java:127)

at com.sun.corba.ee.impl.resolver.INSURLOperationImpl.operate(INSURLOperationImpl.java:117)

at com.sun.corba.ee.impl.orb.ORBImpl.string_to_object(ORBImpl.java:929)

at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:831)

at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:156)

... 31 more

Caused by: org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0

at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHelper.java:72)

at org.omg.CosNaming._NamingContextExtStub.resolve_str(_NamingContextExtStub.java:165)

at com.sun.corba.ee.impl.resolver.INSURLOperationImpl.resolveCorbaname(INSURLOperationImpl.java:184)

... 36 more

Servlet Output

HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

java.lang.RuntimeException: javax.naming.NameNotFoundException: No object bound for java:comp/env/Test [Root exception is org.omg.CORBA.BAD_PARAM:vmcid: OMG minor code: 9 completed: No]

note The full stack traces of the exception and its root causes are available in the Sun Java System Application Server Platform Edition 9.0_01 logs.

Sun Java System Application Server Platform Edition 9.0_01

moriaka at 2007-7-9 5:44:16 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 7

UPDATE.

On the server, I get the following entry in the log file:

Timestamp:

Feb 14, 2007 16:37:03.630

Log Level:

WARNING

Logger:

javax.enterprise.resource.corba.ee._INITIALIZING_.rpc.transport

Name-Value Pairs:

_ThreadID=19;_ThreadName=SelectorThread;12;2;300;364;_RequestID=cf322793-0ea9-4c1a-9bf8-90fbfc850e9a;

Record Number:

163

Message ID:

"IOP00410215

Complete Message

(COMM_FAILURE) Read of full message failed : bytes requested = 12 bytes read = 2 max wait time = 300 total time spent waiting = 364"

org.omg.CORBA.COMM_FAILURE:vmcid: SUN minor code: 215 completed: No

at com.sun.corba.ee.impl.logging.ORBUtilSystemException.transportReadTimeoutExceeded(ORBUtilSystemException.java:2720)

at com.sun.corba.ee.impl.logging.ORBUtilSystemException.transportReadTimeoutExceeded(ORBUtilSystemException.java:2746)

at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.readFully(SocketOrChannelConnectionImpl.java:676)

at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.read(SocketOrChannelConnectionImpl.java:545)

at com.sun.corba.ee.impl.protocol.giopmsgheaders.MessageBase.readGIOPHeader(MessageBase.java:118)

at com.sun.corba.ee.impl.transport.CorbaContactInfoBase.createMessageMediator(CorbaContactInfoBase.java:153)

at com.sun.corba.ee.impl.transport.SocketOrChannelAcceptorImpl.createMessageMediator(SocketOrChannelAcceptorImpl.java:528)

at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.readBits(SocketOrChannelConnectionImpl.java:332)

at com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.handleEvent(SocketOrChannelConnectionImpl.java:1183)

at com.sun.corba.ee.impl.transport.SelectorImpl.run(SelectorImpl.java:281)

moriaka at 2007-7-9 5:44:16 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 8

The ejb-ref definitely needs to change since it does not correctly describe

a remote 3.0 business reference. The existence of the <home> element

means it will be processed as an EJB 2.x style Home ejb-ref, which will conflict

with what actually exists at that target global JNDI name. What version

of the web .xsd are you referring to in your web.xml?You should update

to the version corresponding to Java EE 5 :

<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http

://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/x

ml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">

Doing that will refer to the updated schema that allows for the <home> element to

be optional.

ksaksa at 2007-7-9 5:44:16 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 9

Hi ksaks

Indeed the xsd was version 2.4. I downloaded the Java EE 5 SDK Update 2 bundle (with tools) for Mac OS X.

Either there is something weird with the OS X bundle or J2EE 1.4 was selected in the project when I created it and I did not notice. I will verify this... I don't have access to my Mac right now.

I switched back to my other office today and verified my App Server version. My remote one is 9.0_01 but my local one was 9.0.

I will re-install my SDK on my local machine and make some extra tests. (Windows this time)

moriaka at 2007-7-9 5:44:16 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 10

I tried to use:

@EJB(name="corbaname:iiop:132.216.183.52:3700#ejb.TestRemote")

private TestRemote testBean;

and I got a similar error to the previous one but maybe it could give you more information on what is going on... The EJB is deployed on the server... under de name: ejb.TestRemote.

Here is the error I got:

HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Servlet.init() for servlet TestServlet threw exception

root cause

java.lang.RuntimeException: WEB5002: Exception in handleBeforeEvent.

root cause

com.sun.enterprise.InjectionException: Exception attempting to inject Unresolved Ejb-Ref corbaname:iiop:132.216.183.52:3700#ejb.TestRemote@jndi: ejb.TestRemote@null@ejb.TestRemote@Session@null into class servlet.TestServlet

root cause

javax.naming.NameNotFoundException: ejb.TestRemote#ejb.TestRemote not found

note The full stack traces of the exception and its root causes are available in the Sun Java System Application Server Platform Edition 9.0_01 logs.

Sun Java System Application Server Platform Edition 9.0_01

moriaka at 2007-7-9 5:44:16 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 11

To map the remote ejb dependency using the annotation, you'll need to specify the

mappedName() attribute, not name(). name() is the location of the dependency

within the client component's environment(java:comp/env). mappedName()

is the target to which the dependency should be resolved.It's the difference

between the location of a pointer and the thing the pointer points to.

https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html#EJB_ejb-ref_ejb_local_ref

ksaksa at 2007-7-9 5:44:16 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 12

Hi ksaks

I read this information on the glassfish FAQ:

Step 4. For EJB 3.0 Remote access, use Glassfish v2 Promoted Build 13 (8/16/2006) or later.

Builds from this point on will contain a required bug fix.

See https://glassfish.dev.java.net/issues/show_bug.cgi?id=920 for more details.

Would that mean that it is not possible to do EJB remote access in the version of sun application server I am using: 9.0_01? Would that be the problem or is it supposed to work as if I had Glassfish v2 (right now I am using v1 since it is included in Sun App Server) ?

moriaka at 2007-7-9 5:44:16 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 13
We'll need to update that portion of the FAQ now that the fix is available in a formal release.Anything Glassfish V1 UR1 or later OR Java EE 5 SDK Update 1 (9.0_01) or later has the fix.You'll need that on both sides.Thanks for pointing this out. --ken
ksaksa at 2007-7-9 5:44:16 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 14

fyi

I succeeded at connecting to my remote EJB using 2 Windows XP physical machines. It seems that there is a problem if I try to connect to an EJB which is on a Debian Virtual Machine (VMWARE-Server). I am not sure what exactly is the problem... but I'm looking into it.

Thanks for your help.

moriaka at 2007-7-9 5:44:16 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 15
> I succeeded at connecting to my remote EJB using 2> Windows XP physical machines. Glad to hear it :-) Thanks for your patience in working through the issues. --ken> Thanks for your help.
ksaksa at 2007-7-21 17:17:04 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 16

Problem fixed:

If you run a Virtual Machine using VMWare and try to access a remote EJB, the IIOP listener might have problem biding to the correct IP. Especially if the VM shares your Host IP address.

You have to specify, in the sun app server (admin console), the IP address on which IIOP should be bound to:

Console > ORB > IIOP Listener > orb-listener-1

change the IP from 0.0.0.0 to the Virtual Machine's real IP address.

moriaka at 2007-7-21 17:17:04 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...