tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Blevins <david.blev...@visi.com>
Subject Re: Binding custom WebServiceContext problems.
Date Tue, 26 Jan 2010 02:25:17 GMT

On Jan 21, 2010, at 6:54 PM, andreessen wrote:

> Just ran into problems with binding. I am using OpenEJB for WS tests  
> and
> need to bind my custom WebServiceContext with JNDI to make
> @Resource
> WebServiceContext wctx;
> works properly for my tests.
>
> In my setUp method I do the following:
>
> Properties props = new Properties();
>        props.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,
>                 
> "org.apache.openejb.client.LocalInitialContextFactory");
>        props.setProperty("openejb.embedded.remotable", "true");
> initialContext = new InitialContext(props);
>        WebServiceContextStub wctxStub = new WebServiceContextStub();
> initialContext.bind("java:comp/WebServiceContext", wctxStub);
>        wctxStub =
> (WebServiceContextStub)initialContext.lookup("java:comp/ 
> WebServiceContext");
>
> But the last line throws javax.naming.NameNotFoundException: Name
> "comp/WebServiceContext" not found.

Hmm.  Each bean gets it's own private "java:comp" namespace, so  
binding the replacement WebServiceContext to the test case created  
InitialContext won't have the affect you want.  The bean won't be able  
to see it.

What is the ultimate goal of the "WebServiceContextStub"?  Maybe there  
a new feature we could add to help get the end result that you need.

-David


-- 
http://blog.dblevins.com/
http://twitter.com/dblevins
Support OpenEJB with Tweets!


Mime
View raw message