Hi,

can you give us the openejb.log file ?
If you cannot lookup the session bean, either the bean name is wrong either
a deployment error prevented openejb to publish anything.

thanks,



Gul Onural wrote:
> 
> I am trying to get the jndi lookup working with openejb for a test
> class. The test class is very simple. I don't use any jndi formatting,
> and using the default.
> However my test case is failing when in the JNDI lookup. I set the
> openejb.validation.output.level to VERBOSE, but it doesn't really show
> anything
> to help me to understand the issue.
> 
> I am using Junit 4.5 and openejb 3.1.1. In my test class setUp method :
> 
> Properties properties = new Properties();
>       properties.setProperty(Context.INITIAL_CONTEXT_FACTORY,
>               "org.apache.openejb.client.LocalInitialContextFactory");
>       properties.setProperty("openejb.validation.output.level",
> "VERBOSE");
>       properties.setProperty("openejb.deployments.classpath", "true");
>       
>       initialContext = new InitialContext(properties);
> 
> In a test method in my test class:
> 
>       Object object =
> initialContext.lookup("SampleStatelessBeanRemote");
> 
>       assertNotNull(object);
>       assertTrue(object instanceof SampleStatelessRemote);
>       SampleStatelessRemote ssr = (SampleStatelessRemote) object;
>       assertEquals("Hello from Sample Stateless Session Bean",
> ssr.echo());
> 
> The SessionBean (SampleStatelessBean) uses annotations and based on my
> understanding from the documentation,  iopenejb looks into the class
> path and discovers
> annotations. My session bean remote and local interfaces as well as bean
> implementation classes are in test classpath. The session bean doesn't
> use
> any annotation properties such as name or mappedName.
> 
> Stack trace is below.
> 
> Is there anything else I can do to debug the issue ? How can I get more
> debug log from the openejb to further debug this ?
> 
> Gul
> 
> 
> ------------------------------------------------------------------------
> -------
> Test set: generic.samplestateless.impl.SampleStatelessTest
> ------------------------------------------------------------------------
> -------
> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.922
> sec <<< FAILURE!
> testSampleStatelessRemoteInterface(generic.samplestateless.impl.SampleSt
> atelessTest)  Time elapsed: 1.796 sec  <<< ERROR!
> javax.naming.NameNotFoundException: Name "SampleStatelessBeanRemote" not
> found.
>       at
> org.apache.openejb.core.ivm.naming.IvmContext.federate(IvmContext.java:1
> 98)
>       at
> org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:155
> )
>       at
> org.apache.openejb.core.ivm.naming.ContextWrapper.lookup(ContextWrapper.
> java:115)
>       at javax.naming.InitialContext.lookup(InitialContext.java:351)
>       at
> generic.samplestateless.impl.SampleStatelessTest.testSampleStatelessRemo
> teInterface(SampleStatelessTest.java:85)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
> a:39)
>       at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
> Impl.java:25)
>       at java.lang.reflect.Method.invoke(Method.java:585)
>       at
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMet
> hod.java:44)
>       at
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallab
> le.java:15)
>       at
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMetho
> d.java:41)
>       at
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod
> .java:20)
>       at
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.jav
> a:28)
>       at
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:
> 31)
>       at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner
> .java:73)
>       at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner
> .java:46)
>       at
> org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
>       at
> org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
>       at
> org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
>       at
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.jav
> a:28)
>       at
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:
> 31)
>       at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
>       at
> org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.jav
> a:62)
>       at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSe
> t(AbstractDirectoryTestSuite.java:140)
>       at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(Abstr
> actDirectoryTestSuite.java:127)
>       at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
> a:39)
>       at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
> Impl.java:25)
>       at java.lang.reflect.Method.invoke(Method.java:585)
>       at
> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(Suref
> ireBooter.java:345)
>       at
> org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java
> :1009)
> 
> ---------------------------------------------------------------------
> This transmission (including any attachments) may contain confidential
> information, privileged material (including material protected by the
> solicitor-client or other applicable privileges), or constitute non-public
> information. Any use of this information by anyone other than the intended
> recipient is prohibited. If you have received this transmission in error,
> please immediately reply to the sender and delete this information from
> your system. Use, dissemination, distribution, or reproduction of this
> transmission by unintended recipients is not authorized and may be
> unlawful.
> 
> 


-----
   Jean-Louis
-- 
View this message in context: 
http://www.nabble.com/jndi-lookup-tp24154795p24154888.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Reply via email to