You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by David Blevins <da...@visi.com> on 2009/12/09 14:56:09 UTC

Re: NamingExpection: Name openejb is not bound in this Context

On Nov 29, 2009, at 6:11 PM, Cae Fernandes wrote:

> If I telnet to openejb I can see all the naming contexts (openejb,  
> comp,
> comp/env).
> But connecting to it thru ejbd I only see the queue message  
> destination bean
> and the stateless session bean.
>
> Also on LocalInitialContextFactory InitialContext instance(at the  
> server
> side), I only see the same ejbs.
> I did do a breakpoint exception at nullpointer, and a bunch of
> nullpointerexceptions occur, a lot of them are expected too (I can  
> tell
> because of comments).

Looking up data sources over the ejbd definitely shouldn't work, but  
it should work via the LocalInitialContextFactory.

On Nov 29, 2009, at 6:31 PM, Cae Fernandes wrote:

>
> Thru the openejb 3.1 spring integration, I couldn't even get the  
> servers to
> boot (like if remotable wasnt turned on).
>
> I did a openejb factory:
>
> public class OpenEjbFactoryBean {
>
> 	private Properties properties;
> 	private Context context;
>
> 	public OpenEjbFactoryBean() {
> 		super();
> 	}
>
> 	public OpenEjbFactoryBean(Properties properties) throws  
> NamingException,
> IOException {
> 		this();
> 		this.properties = properties;
> 		this.context = (Context) new InitialContext(properties);
> ---
>
> 	<bean id="openEjbProperties"
> class 
> ="org.springframework.beans.factory.config.PropertiesFactoryBean" >
> 		<property name="location">
> 			<value>/WEB-INF/openejb.properties</value>
> 		</property>
> 	</bean>
> 	
> 	<bean id="openEjbFactoryBean"
> class="br.com.noc.EjbFactory.OpenEjbFactoryBean"
> 		lazy-init="false" scope="singleton" depends-on="openEjbProperties">
> 		<constructor-arg ref="openEjbProperties" />
> 	</bean>
>
> 	
> ---
> I pasted the openejb.properties at the other message.
>
> Maybe the embeded version isnt supposed to have a openejb naming  
> context?
> Or it`s broken?

I'm curious about the WEB-INF/ references in the above code.  Is this  
running inside Tomcat?  If that's the case than all "java:" lookups  
will go straight to it and bypass OpenEJB.  To get around this we  
added an "openejb:" prefix in 3.1.1 (or maybe it was 3.1.2).  Anyway,  
give this lookup a try:

   new InitialContext().lookup("openejb:Resource/mySqlDatabase");

Basically anything you could lookup in "java:openejb/" you can do via  
"openejb:" as well.  It's basically a symlink directly to the  
"openejb" jndi namespace but guaranteed to work in any mode like  
Tomcat, embedded, standalone, etc.

-David


Re: NamingExpection: Name openejb is not bound in this Context

Posted by Cae Fernandes <ra...@gmail.com>.
I'll give what you said a go, but I'm probably sure it didn't work before.
I am running it embeded in tomcat (not the openejb.war thing, just
initiating localcontextinitialfactory from openejb.jar).

Like I said, openejb context is only seen through telnet, not through jndi
(neither remote nor local).
I don't remember if I tried looking up openejb namespace directly, like you
suggested.
I'll try and post back here asap.


David Blevins wrote:
> 
> 
> On Nov 29, 2009, at 6:11 PM, Cae Fernandes wrote:
> 
>> If I telnet to openejb I can see all the naming contexts (openejb,  
>> comp,
>> comp/env).
>> But connecting to it thru ejbd I only see the queue message  
>> destination bean
>> and the stateless session bean.
>>
>> Also on LocalInitialContextFactory InitialContext instance(at the  
>> server
>> side), I only see the same ejbs.
>> I did do a breakpoint exception at nullpointer, and a bunch of
>> nullpointerexceptions occur, a lot of them are expected too (I can  
>> tell
>> because of comments).
> 
> Looking up data sources over the ejbd definitely shouldn't work, but  
> it should work via the LocalInitialContextFactory.
> 
> On Nov 29, 2009, at 6:31 PM, Cae Fernandes wrote:
> 
>>
>> Thru the openejb 3.1 spring integration, I couldn't even get the  
>> servers to
>> boot (like if remotable wasnt turned on).
>>
>> I did a openejb factory:
>>
>> public class OpenEjbFactoryBean {
>>
>> 	private Properties properties;
>> 	private Context context;
>>
>> 	public OpenEjbFactoryBean() {
>> 		super();
>> 	}
>>
>> 	public OpenEjbFactoryBean(Properties properties) throws  
>> NamingException,
>> IOException {
>> 		this();
>> 		this.properties = properties;
>> 		this.context = (Context) new InitialContext(properties);
>> ---
>>
>> 	<bean id="openEjbProperties"
>> class 
>> ="org.springframework.beans.factory.config.PropertiesFactoryBean" >
>> 		<property name="location">
>> 			<value>/WEB-INF/openejb.properties</value>
>> 		</property>
>> 	</bean>
>> 	
>> 	<bean id="openEjbFactoryBean"
>> class="br.com.noc.EjbFactory.OpenEjbFactoryBean"
>> 		lazy-init="false" scope="singleton" depends-on="openEjbProperties">
>> 		<constructor-arg ref="openEjbProperties" />
>> 	</bean>
>>
>> 	
>> ---
>> I pasted the openejb.properties at the other message.
>>
>> Maybe the embeded version isnt supposed to have a openejb naming  
>> context?
>> Or it`s broken?
> 
> I'm curious about the WEB-INF/ references in the above code.  Is this  
> running inside Tomcat?  If that's the case than all "java:" lookups  
> will go straight to it and bypass OpenEJB.  To get around this we  
> added an "openejb:" prefix in 3.1.1 (or maybe it was 3.1.2).  Anyway,  
> give this lookup a try:
> 
>    new InitialContext().lookup("openejb:Resource/mySqlDatabase");
> 
> Basically anything you could lookup in "java:openejb/" you can do via  
> "openejb:" as well.  It's basically a symlink directly to the  
> "openejb" jndi namespace but guaranteed to work in any mode like  
> Tomcat, embedded, standalone, etc.
> 
> -David
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/NamingExpection%3A-Name-openejb-is-not-bound-in-this-Context-tp26560497p26713107.html
Sent from the OpenEJB User mailing list archive at Nabble.com.