You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by jaysee <jo...@gmail.com> on 2012/08/09 08:39:48 UTC

Restful web application+ejb: can not lookup ejb.

hello. 
I am a newbie to tomee+.

I am trying to implement restful web service which uses another ejb in
tomee+ server.
I have two module deployed. one is the restful web service
module(RestSS.war), and the other is the ejb module(SimeSimsCore.jar).
I deployed two successfully. and when I installed the ejb. I confirmed
following in the log file.
2012. 8. 9 오후 2:46:36 org.apache.openejb.assembler.classic.JndiBuilder bind
정보: Jndi(name=SimpleSmsBeanLocal) --> Ejb(deployment-id=SimpleSmsBean)
2012. 8. 9 오후 2:46:36 org.apache.openejb.assembler.classic.JndiBuilder bind
정보:
Jndi(name=global/SimpleSmsCore/SimpleSmsBean!org.etri.csp.ucws.sms.SimpleSms)
--> Ejb(deployment-id=SimpleSmsBean)
2012. 8. 9 오후 2:46:36 org.apache.openejb.assembler.classic.JndiBuilder bind
정보: Jndi(name=SimpleSmsBeanRemote) --> Ejb(deployment-id=SimpleSmsBean)
2012. 8. 9 오후 2:46:36 org.apache.openejb.assembler.classic.JndiBuilder bind
정보: Jndi(name=global/SimpleSmsCore/SimpleSmsBean) -->
Ejb(deployment-id=SimpleSmsBean)

So, I tried to lookup using ejb with following code.

InitialContext initial=new InitialContext();
SimpleSms
smsBean=(SimpleSms)initial.lookup(java:global/SimpleSmsCore/SimpleSmsBean);

and I also tried. "java:global/SimpleSmsRemote" and
"java:global/SimpleSmsBean" ..
but everything failed with...

Name [SimpleSmsCore/SimpleSmsBean] is not bound in this Context. Unable to
find [SimpleSmsCore].

So, I tried to use InitialContext with properties according the guide in
homepage.

Properties p = new Properties();
p.put("java.naming.factory.initial",
"org.apache.openejb.client.LocalInitialContextFactory");

InitialContext initial=new InitialContext(p);
SimpleSms smsBean=(SimpleSms)initial.lookup(SimpleSmsBeanRemote);

and then, I got antother error like this.

org.apache.cxf.interceptor.Fault: $Proxy120 cannot be cast to
org.etri.csp.ucws.sms.SimpleSms
        at
org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:155)
        at
org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:121)
        at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:167)
        at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:94)

Can you please help me how to lookup an ejb in other module?

I know there's another way to lookup ejb using web.xml descriptor. but, I
want to lookup using jndi names.











--
View this message in context: http://openejb.979440.n4.nabble.com/Restful-web-application-ejb-can-not-lookup-ejb-tp4656729.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Restful web application+ejb: can not lookup ejb.

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi,

i think that's simply a deployment error, put the common part of both
webapp in lib/ or do an ear

- Romain


2012/8/9 jaysee <jo...@gmail.com>

> hello.
> I am a newbie to tomee+.
>
> I am trying to implement restful web service which uses another ejb in
> tomee+ server.
> I have two module deployed. one is the restful web service
> module(RestSS.war), and the other is the ejb module(SimeSimsCore.jar).
> I deployed two successfully. and when I installed the ejb. I confirmed
> following in the log file.
> 2012. 8. 9 오후 2:46:36 org.apache.openejb.assembler.classic.JndiBuilder bind
> 정보: Jndi(name=SimpleSmsBeanLocal) --> Ejb(deployment-id=SimpleSmsBean)
> 2012. 8. 9 오후 2:46:36 org.apache.openejb.assembler.classic.JndiBuilder bind
> 정보:
>
> Jndi(name=global/SimpleSmsCore/SimpleSmsBean!org.etri.csp.ucws.sms.SimpleSms)
> --> Ejb(deployment-id=SimpleSmsBean)
> 2012. 8. 9 오후 2:46:36 org.apache.openejb.assembler.classic.JndiBuilder bind
> 정보: Jndi(name=SimpleSmsBeanRemote) --> Ejb(deployment-id=SimpleSmsBean)
> 2012. 8. 9 오후 2:46:36 org.apache.openejb.assembler.classic.JndiBuilder bind
> 정보: Jndi(name=global/SimpleSmsCore/SimpleSmsBean) -->
> Ejb(deployment-id=SimpleSmsBean)
>
> So, I tried to lookup using ejb with following code.
>
> InitialContext initial=new InitialContext();
> SimpleSms
> smsBean=(SimpleSms)initial.lookup(java:global/SimpleSmsCore/SimpleSmsBean);
>
> and I also tried. "java:global/SimpleSmsRemote" and
> "java:global/SimpleSmsBean" ..
> but everything failed with...
>
> Name [SimpleSmsCore/SimpleSmsBean] is not bound in this Context. Unable to
> find [SimpleSmsCore].
>
> So, I tried to use InitialContext with properties according the guide in
> homepage.
>
> Properties p = new Properties();
> p.put("java.naming.factory.initial",
> "org.apache.openejb.client.LocalInitialContextFactory");
>
> InitialContext initial=new InitialContext(p);
> SimpleSms smsBean=(SimpleSms)initial.lookup(SimpleSmsBeanRemote);
>
> and then, I got antother error like this.
>
> org.apache.cxf.interceptor.Fault: $Proxy120 cannot be cast to
> org.etri.csp.ucws.sms.SimpleSms
>         at
>
> org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:155)
>         at
>
> org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:121)
>         at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:167)
>         at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:94)
>
> Can you please help me how to lookup an ejb in other module?
>
> I know there's another way to lookup ejb using web.xml descriptor. but, I
> want to lookup using jndi names.
>
>
>
>
>
>
>
>
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Restful-web-application-ejb-can-not-lookup-ejb-tp4656729.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>