You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Russell Collins <Co...@austin.rr.com> on 2012/11/16 14:26:41 UTC

JNDI Lookup

I am having problems looking up an ejb remotely.  In Geronimo 2.x, this 
worked perfectly.  Now I am having issues.  First, when I deploy the 
ear, this is the JNDI entries that are created.


7556:  2012-11-14 22:11:33,271 INFO [startup] Assembling app: 
/home/opt/Geronimo3.0/bin/com.cs/base-business/1.0/car
7557:  2012-11-14 22:11:33,278 INFO [startup] 
Jndi(name=CompositionLocal) --> 
Ejb(deployment-id=cs-base-business.jar/Composition)
7558:  2012-11-14 22:11:33,279 INFO [startup] 
Jndi(name=global/cs-base-ear-1.0-SNAPSHOT/cs-base-business/Composition!com.cs.base.interfaces.ICompositionLocal) 
--> Ejb(deployment-id=cs-base-business.jar/Composition)
7559:  2012-11-14 22:11:33,279 INFO [startup] 
Jndi(name=global/cs-base-ear-1.0-SNAPSHOT/cs-base-business/Composition) 
--> Ejb(deployment-id=cs-base-business.jar/Composition)
7560:  2012-11-14 22:11:33,279 INFO [startup] 
Jndi(name=EmailManagerRemote) --> 
Ejb(deployment-id=cs-base-business.jar/EmailManager)
7561:  2012-11-14 22:11:33,279 INFO [startup] 
Jndi(name=global/cs-base-ear-1.0-SNAPSHOT/cs-base-business/EmailManager!com.cs.base.remote.interfaces.IEmailManagerRemote) 
--> Ejb(deployment-id=cs-base-business.jar/EmailManager)
7562:  2012-11-14 22:11:33,279 INFO [startup] 
Jndi(name=global/cs-base-ear-1.0-SNAPSHOT/cs-base-business/EmailManager) 
--> Ejb(deployment-id=cs-base-business.jar/EmailManager)



I try to use this code to access the ejb's.

InitialContext context;
// Configure Initial context
         try {
             this.m_emailManager = 
(IEmailManagerRemote)context.lookup("EmailManagerRemote");
// Other statements

I get this error upon lookup:

java.lang.ClassFormatError: javax/ejb/EJBException : Missing Code attribute
     at java.lang.ClassLoader.defineClass1(Native Method)
     at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
     at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
     at 
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
     at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
     at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
     at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
     at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
     at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
     at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
     at java.lang.ClassLoader.defineClass1(Native Method)
     at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
     at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
     at 
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
     at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
     at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
     at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
     at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
     at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
     at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
     at 
org.apache.openejb.client.JNDIContext.createBusinessObject(JNDIContext.java:202)
     at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:244)
     at javax.naming.InitialContext.lookup(InitialContext.java:392)
     at com.acc.base.ejb.Emailer.sendContactUs(Emailer.java:68)
     at com.acc.base.ejb.EmailerTest.emailerSuccessTest(EmailerTest.java:30)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:597)
     at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
     at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
     at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
     at 
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
     at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
     at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
     at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
     at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
     at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
     at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
     at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
     at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
     at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
     at 
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
     at 
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
     at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
     at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
     at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
     at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)


please tell me what I am doing wrong because this technique worked in 
previous versions of Geronimo.

-- 

Russell Collins
Collins-Solutions@austin.rr.com


Re: JNDI Lookup

Posted by David Jencks <da...@yahoo.com>.
This looks really odd.   IIUC it's saying that the bytes for the EJBException class doesn't have the code bits.  Are you sure a real ee jar containing these is on the client class path?  I've never seen anything remotely like this.

anyone else have a clue?

thanks
david jencks

On Nov 17, 2012, at 5:21 PM, Russell Collins wrote:

> Is there anybody out there that can point me in the right direction?
> 
> On 11/16/2012 07:26 AM, Russell Collins wrote:
>> I am having problems looking up an ejb remotely.  In Geronimo 2.x, this worked perfectly.  Now I am having issues.  First, when I deploy the ear, this is the JNDI entries that are created.
>> 
>> 
>> 7556:  2012-11-14 22:11:33,271 INFO [startup] Assembling app: /home/opt/Geronimo3.0/bin/com.cs/base-business/1.0/car
>> 7557:  2012-11-14 22:11:33,278 INFO [startup] Jndi(name=CompositionLocal) --> Ejb(deployment-id=cs-base-business.jar/Composition)
>> 7558:  2012-11-14 22:11:33,279 INFO [startup] Jndi(name=global/cs-base-ear-1.0-SNAPSHOT/cs-base-business/Composition!com.cs.base.interfaces.ICompositionLocal) --> Ejb(deployment-id=cs-base-business.jar/Composition)
>> 7559:  2012-11-14 22:11:33,279 INFO [startup] Jndi(name=global/cs-base-ear-1.0-SNAPSHOT/cs-base-business/Composition) --> Ejb(deployment-id=cs-base-business.jar/Composition)
>> 7560:  2012-11-14 22:11:33,279 INFO [startup] Jndi(name=EmailManagerRemote) --> Ejb(deployment-id=cs-base-business.jar/EmailManager)
>> 7561:  2012-11-14 22:11:33,279 INFO [startup] Jndi(name=global/cs-base-ear-1.0-SNAPSHOT/cs-base-business/EmailManager!com.cs.base.remote.interfaces.IEmailManagerRemote) --> Ejb(deployment-id=cs-base-business.jar/EmailManager)
>> 7562:  2012-11-14 22:11:33,279 INFO [startup] Jndi(name=global/cs-base-ear-1.0-SNAPSHOT/cs-base-business/EmailManager) --> Ejb(deployment-id=cs-base-business.jar/EmailManager)
>> 
>> I try to use this code to access the ejb's.
>> 
>> InitialContext context;
>> // Configure Initial context
>>         try {
>>             this.m_emailManager = (IEmailManagerRemote)context.lookup("EmailManagerRemote");
>> // Other statements
>> 
>> I get this error upon lookup:
>> 
>> java.lang.ClassFormatError: javax/ejb/EJBException : Missing Code attribute
>>     at java.lang.ClassLoader.defineClass1(Native Method)
>>     at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
>>     at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
>>     at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
>>     at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
>>     at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
>>     at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
>>     at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>>     at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>>     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
>>     at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>>     at java.lang.ClassLoader.defineClass1(Native Method)
>>     at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
>>     at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
>>     at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
>>     at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
>>     at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
>>     at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
>>     at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>>     at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>>     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
>>     at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>>     at org.apache.openejb.client.JNDIContext.createBusinessObject(JNDIContext.java:202)
>>     at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:244)
>>     at javax.naming.InitialContext.lookup(InitialContext.java:392)
>>     at com.acc.base.ejb.Emailer.sendContactUs(Emailer.java:68)
>>     at com.acc.base.ejb.EmailerTest.emailerSuccessTest(EmailerTest.java:30)
>>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>     at java.lang.reflect.Method.invoke(Method.java:597)
>>     at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
>>     at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
>>     at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
>>     at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
>>     at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
>>     at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
>>     at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
>>     at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
>>     at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
>>     at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
>>     at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
>>     at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
>>     at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
>>     at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
>>     at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>>     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
>>     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
>>     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
>>     at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
>> 
>> 
>> please tell me what I am doing wrong because this technique worked in previous versions of Geronimo.
>> -- 
>> 
>> Russell Collins
>> Collins-Solutions@austin.rr.com
> 
> 
> -- 
> 
> Russell Collins
> Collins-Solutions@austin.rr.com


Re: JNDI Lookup

Posted by Russell Collins <Co...@austin.rr.com>.
Thanks Ivan.  Your suggestion and Shawn's helped me to think about the 
problem.  As it turns out, this was a classpath issue.  In the 
classpath, I had the javaee-api ahead of the openejb-client.  When I got 
the classpath loading corrected, everything worked like I expected it 
to.  Once again, thanks.

On 11/21/2012 09:28 AM, Ivan wrote:
> I am wondering whether you have checked the classpath, which is 
> suggested by David, as the exception looks like a low level error,
> e.g.  run classloader.getResource("javax/ejb/EJBException.class") in 
> your application to know the EJB API  jar location, and check whether 
> the jar  file is corrupted.
>
> Hope it helps.
> 2012/11/21 Russell Collins <Collins-Solutions@austin.rr.com 
> <ma...@austin.rr.com>>
>
>     Ok.  This is good information for the when I actually package the
>     EAR and deploy to the server. However, right now, I am completely
>     outside a Geronimo container.  How would I get this remote lookup
>     to work?  Once again, the method that I am using now used to work
>     with Geronimo 2.x
>
>
>     On 11/21/2012 02:14 AM, Shawn Jiang wrote:
>>     If you are doing the JNDI lookup from separate client EAR.
>>      You'll have to provide a geornimo application deployment plan so
>>     that the client can get the ejb remote interface from the OSGi
>>     framework instead of from the remote interface packaged in the
>>     client ear.   That means,  you don't have to provide a remote
>>     interface class in your ejb client ear.  The remote interface
>>     will be provided by the copy that the EJB provider registered in
>>     OSGi framework after you add a "import" clause in the geronimo
>>     application deployment plan.
>>
>>
>>     <application
>>     xmlns="http://geronimo.apache.org/xml/ns/j2ee/application-1.2">
>>       <dep:environment
>>     xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
>>         <dep:moduleId>
>>     <dep:groupId>default</dep:groupId>
>>     <dep:artifactId>your_seperate_EAR</dep:artifactId>
>>     <dep:version>1</dep:version>
>>           <dep:type>car</dep:type>
>>         </dep:moduleId>
>>         <dep:dependencies>
>>         </dep:dependencies>
>>        
>>     <dep:import-package>*your.remote.ejb.interface.package*</dep:import-package>
>>         <dep:hidden-classes/>
>>         <dep:non-overridable-classes/>
>>       </dep:environment>
>>
>>     </application>
>>
>>     This is a limitation in Geronimo 3.0 after changing the OSGi
>>     framework.  Hope this helps.
>>
>>
>>     On Wed, Nov 21, 2012 at 2:26 PM, Russell Collins
>>     <Collins-Solutions@austin.rr.com
>>     <ma...@austin.rr.com>> wrote:
>>
>>         First of all, thank you for your response.  The EAR has a
>>         structure of:
>>
>>         <ear-archive>
>>             -lib
>>                 -<various assemblies
>>                 - remote interface.jar
>>             - META-INF
>>                 - application.xml
>>                 - geronimo-application.xml
>>             - business-ejb.jar
>>
>>
>>         Eventually, there will be two EAR archives in the Geronimo
>>         server. Currently, there is only one that has been deployed
>>         to the Geronimo server.  I am testing the second EJB project
>>         using JUnit so currently it is acting as a stand alone
>>         client.  I am doing/will be doing the lookup using a separate
>>         EAR deployed to the Geronimo server.
>>
>>         The JNDI lookup is currently in a regular AppClient that is
>>         using JUnit to run tests.
>>
>>         The remote interface is included in the classpath of the
>>         AppClient.  Also, the following entry is included in the
>>         maven dependancy:
>>
>>                 <dependency>
>>         <groupId>org.apache.openejb</groupId>
>>         <artifactId>openejb-client</artifactId>
>>         <version>4.0.0</version>
>>         <scope>provided</scope>
>>                 </dependency>
>>
>>
>>         Currently, I have an EAR archive that has been deployed to
>>         the server.
>>
>>
>>         On 11/18/2012 07:21 PM, Shawn Jiang wrote:
>>>         I'd like to know the structure of your EAR.  Are you doing
>>>         the JNDI searching in the same EAR or in separate EAR ?
>>>
>>>         What's module the JNDI lookup is in ?   WAR, or AppClient.
>>>
>>>         I remember  for remote interface based JNDI EJB lookup in
>>>         G3.  you'll have to import the remote interface in the
>>>         client module to make sure the same interface  could be
>>>         loaded  within OSGi framework in client side.
>>>
>>>
>>>         On Sun, Nov 18, 2012 at 9:21 AM, Russell Collins
>>>         <Collins-Solutions@austin.rr.com
>>>         <ma...@austin.rr.com>> wrote:
>>>
>>>             Is there anybody out there that can point me in the
>>>             right direction?
>>>
>>>
>>>             On 11/16/2012 07:26 AM, Russell Collins wrote:
>>>>             I am having problems looking up an ejb remotely.  In
>>>>             Geronimo 2.x, this worked perfectly.  Now I am having
>>>>             issues.  First, when I deploy the ear, this is the JNDI
>>>>             entries that are created.
>>>>
>>>>
>>>>             7556: 2012-11-14 22:11:33,271 INFO [startup] Assembling
>>>>             app:
>>>>             /home/opt/Geronimo3.0/bin/com.cs/base-business/1.0/car
>>>>             7557: 2012-11-14 22:11:33,278 INFO [startup]
>>>>             Jndi(name=CompositionLocal) -->
>>>>             Ejb(deployment-id=cs-base-business.jar/Composition)
>>>>             7558: 2012-11-14 22:11:33,279 INFO [startup]
>>>>             Jndi(name=global/cs-base-ear-1.0-SNAPSHOT/cs-base-business/Composition!com.cs.base.interfaces.ICompositionLocal)
>>>>             --> Ejb(deployment-id=cs-base-business.jar/Composition)
>>>>             7559: 2012-11-14 22:11:33,279 INFO [startup]
>>>>             Jndi(name=global/cs-base-ear-1.0-SNAPSHOT/cs-base-business/Composition)
>>>>             --> Ejb(deployment-id=cs-base-business.jar/Composition)
>>>>             7560: 2012-11-14 22:11:33,279 INFO [startup]
>>>>             Jndi(name=EmailManagerRemote) -->
>>>>             Ejb(deployment-id=cs-base-business.jar/EmailManager)
>>>>             7561: 2012-11-14 22:11:33,279 INFO [startup]
>>>>             Jndi(name=global/cs-base-ear-1.0-SNAPSHOT/cs-base-business/EmailManager!com.cs.base.remote.interfaces.IEmailManagerRemote)
>>>>             --> Ejb(deployment-id=cs-base-business.jar/EmailManager)
>>>>             7562: 2012-11-14 22:11:33,279 INFO [startup]
>>>>             Jndi(name=global/cs-base-ear-1.0-SNAPSHOT/cs-base-business/EmailManager)
>>>>             --> Ejb(deployment-id=cs-base-business.jar/EmailManager)
>>>>
>>>>
>>>>
>>>>             I try to use this code to access the ejb's.
>>>>
>>>>             InitialContext context;
>>>>             // Configure Initial context
>>>>                     try {
>>>>             this.m_emailManager =
>>>>             (IEmailManagerRemote)context.lookup("EmailManagerRemote");
>>>>             // Other statements
>>>>
>>>>             I get this error upon lookup:
>>>>
>>>>             java.lang.ClassFormatError: javax/ejb/EJBException :
>>>>             Missing Code attribute
>>>>                 at java.lang.ClassLoader.defineClass1(Native Method)
>>>>                 at
>>>>             java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
>>>>                 at
>>>>             java.lang.ClassLoader.defineClass(ClassLoader.java:615)
>>>>                 at
>>>>             java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
>>>>                 at
>>>>             java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
>>>>                 at
>>>>             java.net.URLClassLoader.access$000(URLClassLoader.java:58)
>>>>                 at
>>>>             java.net.URLClassLoader$1.run(URLClassLoader.java:197)
>>>>                 at
>>>>             java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>>>>                 at
>>>>             java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>>>>                 at
>>>>             sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
>>>>                 at
>>>>             java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>>>>                 at java.lang.ClassLoader.defineClass1(Native Method)
>>>>                 at
>>>>             java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
>>>>                 at
>>>>             java.lang.ClassLoader.defineClass(ClassLoader.java:615)
>>>>                 at
>>>>             java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
>>>>                 at
>>>>             java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
>>>>                 at
>>>>             java.net.URLClassLoader.access$000(URLClassLoader.java:58)
>>>>                 at
>>>>             java.net.URLClassLoader$1.run(URLClassLoader.java:197)
>>>>                 at
>>>>             java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>>>>                 at
>>>>             java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>>>>                 at
>>>>             sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
>>>>                 at
>>>>             java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>>>>                 at
>>>>             org.apache.openejb.client.JNDIContext.createBusinessObject(JNDIContext.java:202)
>>>>                 at
>>>>             org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:244)
>>>>                 at
>>>>             javax.naming.InitialContext.lookup(InitialContext.java:392)
>>>>                 at
>>>>             com.acc.base.ejb.Emailer.sendContactUs(Emailer.java:68)
>>>>                 at
>>>>             com.acc.base.ejb.EmailerTest.emailerSuccessTest(EmailerTest.java:30)
>>>>                 at
>>>>             sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>                 at
>>>>             sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>>                 at
>>>>             sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>>                 at java.lang.reflect.Method.invoke(Method.java:597)
>>>>                 at
>>>>             org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
>>>>                 at
>>>>             org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
>>>>                 at
>>>>             org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
>>>>                 at
>>>>             org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
>>>>                 at
>>>>             org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
>>>>                 at
>>>>             org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
>>>>                 at
>>>>             org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
>>>>                 at
>>>>             org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
>>>>                 at
>>>>             org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
>>>>                 at
>>>>             org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
>>>>                 at
>>>>             org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
>>>>                 at
>>>>             org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
>>>>                 at
>>>>             org.junit.runners.ParentRunner.run(ParentRunner.java:300)
>>>>                 at
>>>>             org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
>>>>                 at
>>>>             org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>>>>                 at
>>>>             org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
>>>>                 at
>>>>             org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
>>>>                 at
>>>>             org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
>>>>                 at
>>>>             org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
>>>>
>>>>
>>>>             please tell me what I am doing wrong because this
>>>>             technique worked in previous versions of Geronimo.
>>>>             -- 
>>>>
>>>>             Russell Collins
>>>>             Collins-Solutions@austin.rr.com  <ma...@austin.rr.com>
>>>
>>>
>>>             -- 
>>>
>>>             Russell Collins
>>>             Collins-Solutions@austin.rr.com  <ma...@austin.rr.com>
>>>
>>>
>>>
>>>
>>>         -- 
>>>         Shawn
>>
>>
>>         -- 
>>
>>         Russell Collins
>>         Collins-Solutions@austin.rr.com  <ma...@austin.rr.com>
>>
>>
>>
>>
>>     -- 
>>     Shawn
>
>
>     -- 
>
>     Russell Collins
>     Collins-Solutions@austin.rr.com  <ma...@austin.rr.com>
>
>
>
>
> -- 
> Ivan


-- 

Russell Collins
Collins-Solutions@austin.rr.com


Re: JNDI Lookup

Posted by Ivan <xh...@gmail.com>.
I am wondering whether you have checked the classpath, which is suggested
by David, as the exception looks like a low level error,
e.g.  run classloader.getResource(" javax/ejb/EJBException.class") in your
application to know the EJB API  jar location, and check whether the jar
 file is corrupted.

Hope it helps.
2012/11/21 Russell Collins <Co...@austin.rr.com>

>  Ok.  This is good information for the when I actually package the EAR
> and deploy to the server.  However, right now, I am completely outside a
> Geronimo container.  How would I get this remote lookup to work?  Once
> again, the method that I am using now used to work with Geronimo 2.x
>
>
> On 11/21/2012 02:14 AM, Shawn Jiang wrote:
>
> If you are doing the JNDI lookup from separate client EAR.  You'll have to
> provide a geornimo application deployment plan so that the client can get
> the ejb remote interface from the OSGi framework instead of from the remote
> interface packaged in the client ear.   That means,  you don't have to
> provide a remote interface class in your ejb client ear.  The remote
> interface will be provided by the copy that the EJB provider registered in
> OSGi framework after you add a "import" clause in the geronimo application
> deployment plan.
>
>
>  <application xmlns="
> http://geronimo.apache.org/xml/ns/j2ee/application-1.2">
>   <dep:environment xmlns:dep="
> http://geronimo.apache.org/xml/ns/deployment-1.2">
>     <dep:moduleId>
>       <dep:groupId>default</dep:groupId>
>       <dep:artifactId>your_seperate_EAR</dep:artifactId>
>       <dep:version>1</dep:version>
>       <dep:type>car</dep:type>
>     </dep:moduleId>
>     <dep:dependencies>
>     </dep:dependencies>
>     <dep:import-package>*your.remote.ejb.interface.package*
> </dep:import-package>
>     <dep:hidden-classes/>
>     <dep:non-overridable-classes/>
>   </dep:environment>
>
>  </application>
>
>  This is a limitation in Geronimo 3.0 after changing the OSGi framework.
>  Hope this helps.
>
>
> On Wed, Nov 21, 2012 at 2:26 PM, Russell Collins <
> Collins-Solutions@austin.rr.com> wrote:
>
>>  First of all, thank you for your response.  The EAR has a structure of:
>>
>> <ear-archive>
>>     -lib
>>         -<various assemblies
>>         - remote interface.jar
>>     - META-INF
>>         - application.xml
>>         - geronimo-application.xml
>>     - business-ejb.jar
>>
>>
>> Eventually, there will be two EAR archives in the Geronimo server.
>> Currently, there is only one that has been deployed to the Geronimo
>> server.  I am testing the second EJB project using JUnit so currently it is
>> acting as a stand alone client.  I am doing/will be doing the lookup using
>> a separate EAR deployed to the Geronimo server.
>>
>> The JNDI lookup is currently in a regular AppClient that is using JUnit
>> to run tests.
>>
>> The remote interface is included in the classpath of the AppClient.
>> Also, the following entry is included in the maven dependancy:
>>
>>         <dependency>
>>             <groupId>org.apache.openejb</groupId>
>>             <artifactId>openejb-client</artifactId>
>>             <version>4.0.0</version>
>>             <scope>provided</scope>
>>         </dependency>
>>
>>
>> Currently, I have an EAR archive that has been deployed to the server.
>>
>>
>> On 11/18/2012 07:21 PM, Shawn Jiang wrote:
>>
>> I'd like to know the structure of your EAR.  Are you doing the JNDI
>> searching in the same EAR or in separate EAR ?
>>
>>  What's module the JNDI lookup is in ?   WAR, or AppClient.
>>
>>  I remember  for remote interface based JNDI EJB lookup in G3.  you'll
>> have to import the remote interface in the client module to make sure the
>> same interface  could be loaded  within OSGi framework in client side.
>>
>>
>> On Sun, Nov 18, 2012 at 9:21 AM, Russell Collins <
>> Collins-Solutions@austin.rr.com> wrote:
>>
>>>  Is there anybody out there that can point me in the right direction?
>>>
>>>
>>> On 11/16/2012 07:26 AM, Russell Collins wrote:
>>>
>>> I am having problems looking up an ejb remotely.  In Geronimo 2.x, this
>>> worked perfectly.  Now I am having issues.  First, when I deploy the ear,
>>> this is the JNDI entries that are created.
>>>
>>>
>>>   7556:  2012-11-14 22:11:33,271 INFO [startup] Assembling app:
>>> /home/opt/Geronimo3.0/bin/com.cs/base-business/1.0/car  7557:
>>> 2012-11-14 22:11:33,278 INFO [startup] Jndi(name=CompositionLocal) -->
>>> Ejb(deployment-id=cs-base-business.jar/Composition)  7558:  2012-11-14
>>> 22:11:33,279 INFO [startup]
>>> Jndi(name=global/cs-base-ear-1.0-SNAPSHOT/cs-base-business/Composition!com.cs.base.interfaces.ICompositionLocal)
>>> --> Ejb(deployment-id=cs-base-business.jar/Composition)  7559:
>>> 2012-11-14 22:11:33,279 INFO [startup]
>>> Jndi(name=global/cs-base-ear-1.0-SNAPSHOT/cs-base-business/Composition) -->
>>> Ejb(deployment-id=cs-base-business.jar/Composition)  7560:  2012-11-14
>>> 22:11:33,279 INFO [startup] Jndi(name=EmailManagerRemote) -->
>>> Ejb(deployment-id=cs-base-business.jar/EmailManager)  7561:  2012-11-14
>>> 22:11:33,279 INFO [startup]
>>> Jndi(name=global/cs-base-ear-1.0-SNAPSHOT/cs-base-business/EmailManager!com.cs.base.remote.interfaces.IEmailManagerRemote)
>>> --> Ejb(deployment-id=cs-base-business.jar/EmailManager)  7562:
>>> 2012-11-14 22:11:33,279 INFO [startup]
>>> Jndi(name=global/cs-base-ear-1.0-SNAPSHOT/cs-base-business/EmailManager)
>>> --> Ejb(deployment-id=cs-base-business.jar/EmailManager)
>>>
>>> I try to use this code to access the ejb's.
>>>
>>> InitialContext context;
>>> // Configure Initial context
>>>         try {
>>>             this.m_emailManager =
>>> (IEmailManagerRemote)context.lookup("EmailManagerRemote");
>>> // Other statements
>>>
>>> I get this error upon lookup:
>>>
>>> java.lang.ClassFormatError: javax/ejb/EJBException : Missing Code
>>> attribute
>>>     at java.lang.ClassLoader.defineClass1(Native Method)
>>>     at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
>>>     at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
>>>     at
>>> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
>>>     at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
>>>     at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
>>>     at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
>>>     at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>>>     at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>>>     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
>>>     at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>>>     at java.lang.ClassLoader.defineClass1(Native Method)
>>>     at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
>>>     at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
>>>     at
>>> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
>>>     at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
>>>     at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
>>>     at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
>>>     at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>>>     at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>>>     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
>>>     at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>>>     at
>>> org.apache.openejb.client.JNDIContext.createBusinessObject(JNDIContext.java:202)
>>>     at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:244)
>>>     at javax.naming.InitialContext.lookup(InitialContext.java:392)
>>>     at com.acc.base.ejb.Emailer.sendContactUs(Emailer.java:68)
>>>     at
>>> com.acc.base.ejb.EmailerTest.emailerSuccessTest(EmailerTest.java:30)
>>>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>     at
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>     at
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>     at java.lang.reflect.Method.invoke(Method.java:597)
>>>     at
>>> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
>>>     at
>>> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
>>>     at
>>> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
>>>     at
>>> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
>>>     at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
>>>     at
>>> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
>>>     at
>>> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
>>>     at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
>>>     at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
>>>     at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
>>>     at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
>>>     at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
>>>     at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
>>>     at
>>> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
>>>     at
>>> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>>>     at
>>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
>>>     at
>>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
>>>     at
>>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
>>>     at
>>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
>>>
>>>
>>> please tell me what I am doing wrong because this technique worked in
>>> previous versions of Geronimo.
>>>
>>> --
>>>
>>> Russell CollinsCollins-Solutions@austin.rr.com
>>>
>>>
>>>
>>>   --
>>>
>>> Russell CollinsCollins-Solutions@austin.rr.com
>>>
>>>
>>
>>
>>  --
>> Shawn
>>
>>
>>
>>   --
>>
>> Russell CollinsCollins-Solutions@austin.rr.com
>>
>>
>
>
>  --
> Shawn
>
>
>
> --
>
> Russell CollinsCollins-Solutions@austin.rr.com
>
>


-- 
Ivan

Re: JNDI Lookup

Posted by Russell Collins <Co...@austin.rr.com>.
Ok.  This is good information for the when I actually package the EAR 
and deploy to the server. However, right now, I am completely outside a 
Geronimo container. How would I get this remote lookup to work?  Once 
again, the method that I am using now used to work with Geronimo 2.x

On 11/21/2012 02:14 AM, Shawn Jiang wrote:
> If you are doing the JNDI lookup from separate client EAR.  You'll 
> have to provide a geornimo application deployment plan so that the 
> client can get the ejb remote interface from the OSGi framework 
> instead of from the remote interface packaged in the client ear.   
> That means,  you don't have to provide a remote interface class in 
> your ejb client ear.  The remote interface will be provided by the 
> copy that the EJB provider registered in OSGi framework after you add 
> a "import" clause in the geronimo application deployment plan.
>
>
> <application 
> xmlns="http://geronimo.apache.org/xml/ns/j2ee/application-1.2">
>   <dep:environment 
> xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.2">
>     <dep:moduleId>
>       <dep:groupId>default</dep:groupId>
> <dep:artifactId>your_seperate_EAR</dep:artifactId>
>       <dep:version>1</dep:version>
>       <dep:type>car</dep:type>
>     </dep:moduleId>
>     <dep:dependencies>
>     </dep:dependencies>
>     
> <dep:import-package>*your.remote.ejb.interface.package*</dep:import-package>
>     <dep:hidden-classes/>
>     <dep:non-overridable-classes/>
>   </dep:environment>
>
> </application>
>
> This is a limitation in Geronimo 3.0 after changing the OSGi 
> framework.  Hope this helps.
>
>
> On Wed, Nov 21, 2012 at 2:26 PM, Russell Collins 
> <Collins-Solutions@austin.rr.com 
> <ma...@austin.rr.com>> wrote:
>
>     First of all, thank you for your response.  The EAR has a
>     structure of:
>
>     <ear-archive>
>         -lib
>             -<various assemblies
>             - remote interface.jar
>         - META-INF
>             - application.xml
>             - geronimo-application.xml
>         - business-ejb.jar
>
>
>     Eventually, there will be two EAR archives in the Geronimo
>     server.  Currently, there is only one that has been deployed to
>     the Geronimo server.  I am testing the second EJB project using
>     JUnit so currently it is acting as a stand alone client.  I am
>     doing/will be doing the lookup using a separate EAR deployed to
>     the Geronimo server.
>
>     The JNDI lookup is currently in a regular AppClient that is using
>     JUnit to run tests.
>
>     The remote interface is included in the classpath of the
>     AppClient.  Also, the following entry is included in the maven
>     dependancy:
>
>             <dependency>
>     <groupId>org.apache.openejb</groupId>
>     <artifactId>openejb-client</artifactId>
>                 <version>4.0.0</version>
>                 <scope>provided</scope>
>             </dependency>
>
>
>     Currently, I have an EAR archive that has been deployed to the
>     server.
>
>
>     On 11/18/2012 07:21 PM, Shawn Jiang wrote:
>>     I'd like to know the structure of your EAR.  Are you doing the
>>     JNDI searching in the same EAR or in separate EAR ?
>>
>>     What's module the JNDI lookup is in ?   WAR, or AppClient.
>>
>>     I remember  for remote interface based JNDI EJB lookup in G3.
>>      you'll have to import the remote interface in the client module
>>     to make sure the same interface  could be loaded  within OSGi
>>     framework in client side.
>>
>>
>>     On Sun, Nov 18, 2012 at 9:21 AM, Russell Collins
>>     <Collins-Solutions@austin.rr.com
>>     <ma...@austin.rr.com>> wrote:
>>
>>         Is there anybody out there that can point me in the right
>>         direction?
>>
>>
>>         On 11/16/2012 07:26 AM, Russell Collins wrote:
>>>         I am having problems looking up an ejb remotely. In Geronimo
>>>         2.x, this worked perfectly.  Now I am having issues. First,
>>>         when I deploy the ear, this is the JNDI entries that are
>>>         created.
>>>
>>>
>>>         7556:  2012-11-14 22:11:33,271 INFO [startup] Assembling
>>>         app: /home/opt/Geronimo3.0/bin/com.cs/base-business/1.0/car
>>>         7557:  2012-11-14 22:11:33,278 INFO [startup]
>>>         Jndi(name=CompositionLocal) -->
>>>         Ejb(deployment-id=cs-base-business.jar/Composition)
>>>         7558:  2012-11-14 22:11:33,279 INFO [startup]
>>>         Jndi(name=global/cs-base-ear-1.0-SNAPSHOT/cs-base-business/Composition!com.cs.base.interfaces.ICompositionLocal)
>>>         --> Ejb(deployment-id=cs-base-business.jar/Composition)
>>>         7559:  2012-11-14 22:11:33,279 INFO [startup]
>>>         Jndi(name=global/cs-base-ear-1.0-SNAPSHOT/cs-base-business/Composition)
>>>         --> Ejb(deployment-id=cs-base-business.jar/Composition)
>>>         7560:  2012-11-14 22:11:33,279 INFO [startup]
>>>         Jndi(name=EmailManagerRemote) -->
>>>         Ejb(deployment-id=cs-base-business.jar/EmailManager)
>>>         7561:  2012-11-14 22:11:33,279 INFO [startup]
>>>         Jndi(name=global/cs-base-ear-1.0-SNAPSHOT/cs-base-business/EmailManager!com.cs.base.remote.interfaces.IEmailManagerRemote)
>>>         --> Ejb(deployment-id=cs-base-business.jar/EmailManager)
>>>         7562:  2012-11-14 22:11:33,279 INFO [startup]
>>>         Jndi(name=global/cs-base-ear-1.0-SNAPSHOT/cs-base-business/EmailManager)
>>>         --> Ejb(deployment-id=cs-base-business.jar/EmailManager)
>>>
>>>
>>>
>>>         I try to use this code to access the ejb's.
>>>
>>>         InitialContext context;
>>>         // Configure Initial context
>>>                 try {
>>>                     this.m_emailManager =
>>>         (IEmailManagerRemote)context.lookup("EmailManagerRemote");
>>>         // Other statements
>>>
>>>         I get this error upon lookup:
>>>
>>>         java.lang.ClassFormatError: javax/ejb/EJBException : Missing
>>>         Code attribute
>>>             at java.lang.ClassLoader.defineClass1(Native Method)
>>>             at
>>>         java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
>>>             at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
>>>             at
>>>         java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
>>>             at
>>>         java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
>>>             at
>>>         java.net.URLClassLoader.access$000(URLClassLoader.java:58)
>>>             at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
>>>             at
>>>         java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>>>             at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>>>             at
>>>         sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
>>>             at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>>>             at java.lang.ClassLoader.defineClass1(Native Method)
>>>             at
>>>         java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
>>>             at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
>>>             at
>>>         java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
>>>             at
>>>         java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
>>>             at
>>>         java.net.URLClassLoader.access$000(URLClassLoader.java:58)
>>>             at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
>>>             at
>>>         java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>>>             at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>>>             at
>>>         sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
>>>             at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>>>             at
>>>         org.apache.openejb.client.JNDIContext.createBusinessObject(JNDIContext.java:202)
>>>             at
>>>         org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:244)
>>>             at
>>>         javax.naming.InitialContext.lookup(InitialContext.java:392)
>>>             at com.acc.base.ejb.Emailer.sendContactUs(Emailer.java:68)
>>>             at
>>>         com.acc.base.ejb.EmailerTest.emailerSuccessTest(EmailerTest.java:30)
>>>             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>>>         Method)
>>>             at
>>>         sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>             at
>>>         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>             at java.lang.reflect.Method.invoke(Method.java:597)
>>>             at
>>>         org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
>>>             at
>>>         org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
>>>             at
>>>         org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
>>>             at
>>>         org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
>>>             at
>>>         org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
>>>             at
>>>         org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
>>>             at
>>>         org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
>>>             at
>>>         org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
>>>             at
>>>         org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
>>>             at
>>>         org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
>>>             at
>>>         org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
>>>             at
>>>         org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
>>>             at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
>>>             at
>>>         org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
>>>             at
>>>         org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>>>             at
>>>         org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
>>>             at
>>>         org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
>>>             at
>>>         org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
>>>             at
>>>         org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
>>>
>>>
>>>         please tell me what I am doing wrong because this technique
>>>         worked in previous versions of Geronimo.
>>>         -- 
>>>
>>>         Russell Collins
>>>         Collins-Solutions@austin.rr.com  <ma...@austin.rr.com>
>>
>>
>>         -- 
>>
>>         Russell Collins
>>         Collins-Solutions@austin.rr.com  <ma...@austin.rr.com>
>>
>>
>>
>>
>>     -- 
>>     Shawn
>
>
>     -- 
>
>     Russell Collins
>     Collins-Solutions@austin.rr.com  <ma...@austin.rr.com>
>
>
>
>
> -- 
> Shawn


-- 

Russell Collins
Collins-Solutions@austin.rr.com


Re: JNDI Lookup

Posted by Shawn Jiang <ge...@gmail.com>.
If you are doing the JNDI lookup from separate client EAR.  You'll have to
provide a geornimo application deployment plan so that the client can get
the ejb remote interface from the OSGi framework instead of from the remote
interface packaged in the client ear.   That means,  you don't have to
provide a remote interface class in your ejb client ear.  The remote
interface will be provided by the copy that the EJB provider registered in
OSGi framework after you add a "import" clause in the geronimo application
deployment plan.


<application xmlns="http://geronimo.apache.org/xml/ns/j2ee/application-1.2">
  <dep:environment xmlns:dep="
http://geronimo.apache.org/xml/ns/deployment-1.2">
    <dep:moduleId>
      <dep:groupId>default</dep:groupId>
      <dep:artifactId>your_seperate_EAR</dep:artifactId>
      <dep:version>1</dep:version>
      <dep:type>car</dep:type>
    </dep:moduleId>
    <dep:dependencies>
    </dep:dependencies>
    <dep:import-package>*your.remote.ejb.interface.package*
</dep:import-package>
    <dep:hidden-classes/>
    <dep:non-overridable-classes/>
  </dep:environment>

</application>

This is a limitation in Geronimo 3.0 after changing the OSGi framework.
 Hope this helps.


On Wed, Nov 21, 2012 at 2:26 PM, Russell Collins <
Collins-Solutions@austin.rr.com> wrote:

>  First of all, thank you for your response.  The EAR has a structure of:
>
> <ear-archive>
>     -lib
>         -<various assemblies
>         - remote interface.jar
>     - META-INF
>         - application.xml
>         - geronimo-application.xml
>     - business-ejb.jar
>
>
> Eventually, there will be two EAR archives in the Geronimo server.
> Currently, there is only one that has been deployed to the Geronimo
> server.  I am testing the second EJB project using JUnit so currently it is
> acting as a stand alone client.  I am doing/will be doing the lookup using
> a separate EAR deployed to the Geronimo server.
>
> The JNDI lookup is currently in a regular AppClient that is using JUnit to
> run tests.
>
> The remote interface is included in the classpath of the AppClient.  Also,
> the following entry is included in the maven dependancy:
>
>         <dependency>
>             <groupId>org.apache.openejb</groupId>
>             <artifactId>openejb-client</artifactId>
>             <version>4.0.0</version>
>             <scope>provided</scope>
>         </dependency>
>
>
> Currently, I have an EAR archive that has been deployed to the server.
>
>
> On 11/18/2012 07:21 PM, Shawn Jiang wrote:
>
> I'd like to know the structure of your EAR.  Are you doing the JNDI
> searching in the same EAR or in separate EAR ?
>
>  What's module the JNDI lookup is in ?   WAR, or AppClient.
>
>  I remember  for remote interface based JNDI EJB lookup in G3.  you'll
> have to import the remote interface in the client module to make sure the
> same interface  could be loaded  within OSGi framework in client side.
>
>
> On Sun, Nov 18, 2012 at 9:21 AM, Russell Collins <
> Collins-Solutions@austin.rr.com> wrote:
>
>>  Is there anybody out there that can point me in the right direction?
>>
>>
>> On 11/16/2012 07:26 AM, Russell Collins wrote:
>>
>> I am having problems looking up an ejb remotely.  In Geronimo 2.x, this
>> worked perfectly.  Now I am having issues.  First, when I deploy the ear,
>> this is the JNDI entries that are created.
>>
>>
>>   7556:  2012-11-14 22:11:33,271 INFO [startup] Assembling app:
>> /home/opt/Geronimo3.0/bin/com.cs/base-business/1.0/car  7557:
>> 2012-11-14 22:11:33,278 INFO [startup] Jndi(name=CompositionLocal) -->
>> Ejb(deployment-id=cs-base-business.jar/Composition)  7558:  2012-11-14
>> 22:11:33,279 INFO [startup]
>> Jndi(name=global/cs-base-ear-1.0-SNAPSHOT/cs-base-business/Composition!com.cs.base.interfaces.ICompositionLocal)
>> --> Ejb(deployment-id=cs-base-business.jar/Composition)  7559:
>> 2012-11-14 22:11:33,279 INFO [startup]
>> Jndi(name=global/cs-base-ear-1.0-SNAPSHOT/cs-base-business/Composition) -->
>> Ejb(deployment-id=cs-base-business.jar/Composition)  7560:  2012-11-14
>> 22:11:33,279 INFO [startup] Jndi(name=EmailManagerRemote) -->
>> Ejb(deployment-id=cs-base-business.jar/EmailManager)  7561:  2012-11-14
>> 22:11:33,279 INFO [startup]
>> Jndi(name=global/cs-base-ear-1.0-SNAPSHOT/cs-base-business/EmailManager!com.cs.base.remote.interfaces.IEmailManagerRemote)
>> --> Ejb(deployment-id=cs-base-business.jar/EmailManager)  7562:
>> 2012-11-14 22:11:33,279 INFO [startup]
>> Jndi(name=global/cs-base-ear-1.0-SNAPSHOT/cs-base-business/EmailManager)
>> --> Ejb(deployment-id=cs-base-business.jar/EmailManager)
>>
>> I try to use this code to access the ejb's.
>>
>> InitialContext context;
>> // Configure Initial context
>>         try {
>>             this.m_emailManager =
>> (IEmailManagerRemote)context.lookup("EmailManagerRemote");
>> // Other statements
>>
>> I get this error upon lookup:
>>
>> java.lang.ClassFormatError: javax/ejb/EJBException : Missing Code
>> attribute
>>     at java.lang.ClassLoader.defineClass1(Native Method)
>>     at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
>>     at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
>>     at
>> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
>>     at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
>>     at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
>>     at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
>>     at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>>     at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>>     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
>>     at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>>     at java.lang.ClassLoader.defineClass1(Native Method)
>>     at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
>>     at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
>>     at
>> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
>>     at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
>>     at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
>>     at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
>>     at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>>     at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>>     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
>>     at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>>     at
>> org.apache.openejb.client.JNDIContext.createBusinessObject(JNDIContext.java:202)
>>     at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:244)
>>     at javax.naming.InitialContext.lookup(InitialContext.java:392)
>>     at com.acc.base.ejb.Emailer.sendContactUs(Emailer.java:68)
>>     at
>> com.acc.base.ejb.EmailerTest.emailerSuccessTest(EmailerTest.java:30)
>>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>     at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>     at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>     at java.lang.reflect.Method.invoke(Method.java:597)
>>     at
>> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
>>     at
>> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
>>     at
>> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
>>     at
>> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
>>     at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
>>     at
>> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
>>     at
>> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
>>     at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
>>     at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
>>     at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
>>     at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
>>     at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
>>     at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
>>     at
>> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
>>     at
>> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>>     at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
>>     at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
>>     at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
>>     at
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
>>
>>
>> please tell me what I am doing wrong because this technique worked in
>> previous versions of Geronimo.
>>
>> --
>>
>> Russell CollinsCollins-Solutions@austin.rr.com
>>
>>
>>
>>   --
>>
>> Russell CollinsCollins-Solutions@austin.rr.com
>>
>>
>
>
>  --
> Shawn
>
>
>
> --
>
> Russell CollinsCollins-Solutions@austin.rr.com
>
>


-- 
Shawn

Re: JNDI Lookup

Posted by Russell Collins <Co...@austin.rr.com>.
First of all, thank you for your response.  The EAR has a structure of:

<ear-archive>
     -lib
         -<various assemblies
         - remote interface.jar
     - META-INF
         - application.xml
         - geronimo-application.xml
     - business-ejb.jar


Eventually, there will be two EAR archives in the Geronimo server.  
Currently, there is only one that has been deployed to the Geronimo 
server.  I am testing the second EJB project using JUnit so currently it 
is acting as a stand alone client.  I am doing/will be doing the lookup 
using a separate EAR deployed to the Geronimo server.

The JNDI lookup is currently in a regular AppClient that is using JUnit 
to run tests.

The remote interface is included in the classpath of the AppClient.  
Also, the following entry is included in the maven dependancy:

         <dependency>
             <groupId>org.apache.openejb</groupId>
             <artifactId>openejb-client</artifactId>
             <version>4.0.0</version>
             <scope>provided</scope>
         </dependency>


Currently, I have an EAR archive that has been deployed to the server.

On 11/18/2012 07:21 PM, Shawn Jiang wrote:
> I'd like to know the structure of your EAR.  Are you doing the JNDI 
> searching in the same EAR or in separate EAR ?
>
> What's module the JNDI lookup is in ?   WAR, or AppClient.
>
> I remember  for remote interface based JNDI EJB lookup in G3.  you'll 
> have to import the remote interface in the client module to make sure 
> the same interface  could be loaded  within OSGi framework in client side.
>
>
> On Sun, Nov 18, 2012 at 9:21 AM, Russell Collins 
> <Collins-Solutions@austin.rr.com 
> <ma...@austin.rr.com>> wrote:
>
>     Is there anybody out there that can point me in the right direction?
>
>
>     On 11/16/2012 07:26 AM, Russell Collins wrote:
>>     I am having problems looking up an ejb remotely.  In Geronimo
>>     2.x, this worked perfectly.  Now I am having issues.  First, when
>>     I deploy the ear, this is the JNDI entries that are created.
>>
>>
>>     7556:  2012-11-14 22:11:33,271 INFO [startup] Assembling app:
>>     /home/opt/Geronimo3.0/bin/com.cs/base-business/1.0/car
>>     7557:  2012-11-14 22:11:33,278 INFO [startup]
>>     Jndi(name=CompositionLocal) -->
>>     Ejb(deployment-id=cs-base-business.jar/Composition)
>>     7558:  2012-11-14 22:11:33,279 INFO [startup]
>>     Jndi(name=global/cs-base-ear-1.0-SNAPSHOT/cs-base-business/Composition!com.cs.base.interfaces.ICompositionLocal)
>>     --> Ejb(deployment-id=cs-base-business.jar/Composition)
>>     7559:  2012-11-14 22:11:33,279 INFO [startup]
>>     Jndi(name=global/cs-base-ear-1.0-SNAPSHOT/cs-base-business/Composition)
>>     --> Ejb(deployment-id=cs-base-business.jar/Composition)
>>     7560:  2012-11-14 22:11:33,279 INFO [startup]
>>     Jndi(name=EmailManagerRemote) -->
>>     Ejb(deployment-id=cs-base-business.jar/EmailManager)
>>     7561:  2012-11-14 22:11:33,279 INFO [startup]
>>     Jndi(name=global/cs-base-ear-1.0-SNAPSHOT/cs-base-business/EmailManager!com.cs.base.remote.interfaces.IEmailManagerRemote)
>>     --> Ejb(deployment-id=cs-base-business.jar/EmailManager)
>>     7562:  2012-11-14 22:11:33,279 INFO [startup]
>>     Jndi(name=global/cs-base-ear-1.0-SNAPSHOT/cs-base-business/EmailManager)
>>     --> Ejb(deployment-id=cs-base-business.jar/EmailManager)
>>
>>
>>
>>     I try to use this code to access the ejb's.
>>
>>     InitialContext context;
>>     // Configure Initial context
>>             try {
>>                 this.m_emailManager =
>>     (IEmailManagerRemote)context.lookup("EmailManagerRemote");
>>     // Other statements
>>
>>     I get this error upon lookup:
>>
>>     java.lang.ClassFormatError: javax/ejb/EJBException : Missing Code
>>     attribute
>>         at java.lang.ClassLoader.defineClass1(Native Method)
>>         at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
>>         at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
>>         at
>>     java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
>>         at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
>>         at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
>>         at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
>>         at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>>         at java.lang.ClassLoader.defineClass1(Native Method)
>>         at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
>>         at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
>>         at
>>     java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
>>         at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
>>         at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
>>         at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
>>         at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>>         at
>>     org.apache.openejb.client.JNDIContext.createBusinessObject(JNDIContext.java:202)
>>         at
>>     org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:244)
>>         at javax.naming.InitialContext.lookup(InitialContext.java:392)
>>         at com.acc.base.ejb.Emailer.sendContactUs(Emailer.java:68)
>>         at
>>     com.acc.base.ejb.EmailerTest.emailerSuccessTest(EmailerTest.java:30)
>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>         at
>>     sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>         at
>>     sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>         at java.lang.reflect.Method.invoke(Method.java:597)
>>         at
>>     org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
>>         at
>>     org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
>>         at
>>     org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
>>         at
>>     org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
>>         at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
>>         at
>>     org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
>>         at
>>     org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
>>         at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
>>         at
>>     org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
>>         at
>>     org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
>>         at
>>     org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
>>         at
>>     org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
>>         at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
>>         at
>>     org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
>>         at
>>     org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>>         at
>>     org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
>>         at
>>     org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
>>         at
>>     org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
>>         at
>>     org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
>>
>>
>>     please tell me what I am doing wrong because this technique
>>     worked in previous versions of Geronimo.
>>     -- 
>>
>>     Russell Collins
>>     Collins-Solutions@austin.rr.com  <ma...@austin.rr.com>
>
>
>     -- 
>
>     Russell Collins
>     Collins-Solutions@austin.rr.com  <ma...@austin.rr.com>
>
>
>
>
> -- 
> Shawn


-- 

Russell Collins
Collins-Solutions@austin.rr.com


Re: JNDI Lookup

Posted by Shawn Jiang <ge...@gmail.com>.
I'd like to know the structure of your EAR.  Are you doing the JNDI
searching in the same EAR or in separate EAR ?

What's module the JNDI lookup is in ?   WAR, or AppClient.

I remember  for remote interface based JNDI EJB lookup in G3.  you'll have
to import the remote interface in the client module to make sure the same
interface  could be loaded  within OSGi framework in client side.


On Sun, Nov 18, 2012 at 9:21 AM, Russell Collins <
Collins-Solutions@austin.rr.com> wrote:

>  Is there anybody out there that can point me in the right direction?
>
>
> On 11/16/2012 07:26 AM, Russell Collins wrote:
>
> I am having problems looking up an ejb remotely.  In Geronimo 2.x, this
> worked perfectly.  Now I am having issues.  First, when I deploy the ear,
> this is the JNDI entries that are created.
>
>
>   7556:  2012-11-14 22:11:33,271 INFO [startup] Assembling app:
> /home/opt/Geronimo3.0/bin/com.cs/base-business/1.0/car  7557:  2012-11-14
> 22:11:33,278 INFO [startup] Jndi(name=CompositionLocal) -->
> Ejb(deployment-id=cs-base-business.jar/Composition)  7558:  2012-11-14
> 22:11:33,279 INFO [startup]
> Jndi(name=global/cs-base-ear-1.0-SNAPSHOT/cs-base-business/Composition!com.cs.base.interfaces.ICompositionLocal)
> --> Ejb(deployment-id=cs-base-business.jar/Composition)  7559:
> 2012-11-14 22:11:33,279 INFO [startup]
> Jndi(name=global/cs-base-ear-1.0-SNAPSHOT/cs-base-business/Composition) -->
> Ejb(deployment-id=cs-base-business.jar/Composition)  7560:  2012-11-14
> 22:11:33,279 INFO [startup] Jndi(name=EmailManagerRemote) -->
> Ejb(deployment-id=cs-base-business.jar/EmailManager)  7561:  2012-11-14
> 22:11:33,279 INFO [startup]
> Jndi(name=global/cs-base-ear-1.0-SNAPSHOT/cs-base-business/EmailManager!com.cs.base.remote.interfaces.IEmailManagerRemote)
> --> Ejb(deployment-id=cs-base-business.jar/EmailManager)  7562:
> 2012-11-14 22:11:33,279 INFO [startup]
> Jndi(name=global/cs-base-ear-1.0-SNAPSHOT/cs-base-business/EmailManager)
> --> Ejb(deployment-id=cs-base-business.jar/EmailManager)
>
> I try to use this code to access the ejb's.
>
> InitialContext context;
> // Configure Initial context
>         try {
>             this.m_emailManager =
> (IEmailManagerRemote)context.lookup("EmailManagerRemote");
> // Other statements
>
> I get this error upon lookup:
>
> java.lang.ClassFormatError: javax/ejb/EJBException : Missing Code attribute
>     at java.lang.ClassLoader.defineClass1(Native Method)
>     at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
>     at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
>     at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
>     at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
>     at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
>     at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
>     at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>     at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
>     at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>     at java.lang.ClassLoader.defineClass1(Native Method)
>     at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
>     at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
>     at
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
>     at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
>     at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
>     at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
>     at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>     at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
>     at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>     at
> org.apache.openejb.client.JNDIContext.createBusinessObject(JNDIContext.java:202)
>     at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:244)
>     at javax.naming.InitialContext.lookup(InitialContext.java:392)
>     at com.acc.base.ejb.Emailer.sendContactUs(Emailer.java:68)
>     at com.acc.base.ejb.EmailerTest.emailerSuccessTest(EmailerTest.java:30)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>     at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>     at java.lang.reflect.Method.invoke(Method.java:597)
>     at
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
>     at
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
>     at
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
>     at
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
>     at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
>     at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
>     at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
>     at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
>     at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
>     at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
>     at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
>     at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
>     at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
>     at
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
>     at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>     at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
>     at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
>     at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
>     at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
>
>
> please tell me what I am doing wrong because this technique worked in
> previous versions of Geronimo.
>
> --
>
> Russell CollinsCollins-Solutions@austin.rr.com
>
>
>
> --
>
> Russell CollinsCollins-Solutions@austin.rr.com
>
>


-- 
Shawn

Re: JNDI Lookup

Posted by Russell Collins <Co...@austin.rr.com>.
Is there anybody out there that can point me in the right direction?

On 11/16/2012 07:26 AM, Russell Collins wrote:
> I am having problems looking up an ejb remotely.  In Geronimo 2.x, 
> this worked perfectly.  Now I am having issues.  First, when I deploy 
> the ear, this is the JNDI entries that are created.
>
>
> 7556:  2012-11-14 22:11:33,271 INFO [startup] Assembling app: 
> /home/opt/Geronimo3.0/bin/com.cs/base-business/1.0/car
> 7557:  2012-11-14 22:11:33,278 INFO [startup] 
> Jndi(name=CompositionLocal) --> 
> Ejb(deployment-id=cs-base-business.jar/Composition)
> 7558:  2012-11-14 22:11:33,279 INFO [startup] 
> Jndi(name=global/cs-base-ear-1.0-SNAPSHOT/cs-base-business/Composition!com.cs.base.interfaces.ICompositionLocal) 
> --> Ejb(deployment-id=cs-base-business.jar/Composition)
> 7559:  2012-11-14 22:11:33,279 INFO [startup] 
> Jndi(name=global/cs-base-ear-1.0-SNAPSHOT/cs-base-business/Composition) --> 
> Ejb(deployment-id=cs-base-business.jar/Composition)
> 7560:  2012-11-14 22:11:33,279 INFO [startup] 
> Jndi(name=EmailManagerRemote) --> 
> Ejb(deployment-id=cs-base-business.jar/EmailManager)
> 7561:  2012-11-14 22:11:33,279 INFO [startup] 
> Jndi(name=global/cs-base-ear-1.0-SNAPSHOT/cs-base-business/EmailManager!com.cs.base.remote.interfaces.IEmailManagerRemote) 
> --> Ejb(deployment-id=cs-base-business.jar/EmailManager)
> 7562:  2012-11-14 22:11:33,279 INFO [startup] 
> Jndi(name=global/cs-base-ear-1.0-SNAPSHOT/cs-base-business/EmailManager) 
> --> Ejb(deployment-id=cs-base-business.jar/EmailManager)
>
>
>
> I try to use this code to access the ejb's.
>
> InitialContext context;
> // Configure Initial context
>         try {
>             this.m_emailManager = 
> (IEmailManagerRemote)context.lookup("EmailManagerRemote");
> // Other statements
>
> I get this error upon lookup:
>
> java.lang.ClassFormatError: javax/ejb/EJBException : Missing Code 
> attribute
>     at java.lang.ClassLoader.defineClass1(Native Method)
>     at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
>     at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
>     at 
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
>     at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
>     at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
>     at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
>     at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>     at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
>     at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>     at java.lang.ClassLoader.defineClass1(Native Method)
>     at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
>     at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
>     at 
> java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
>     at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
>     at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
>     at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
>     at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>     at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
>     at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>     at 
> org.apache.openejb.client.JNDIContext.createBusinessObject(JNDIContext.java:202)
>     at org.apache.openejb.client.JNDIContext.lookup(JNDIContext.java:244)
>     at javax.naming.InitialContext.lookup(InitialContext.java:392)
>     at com.acc.base.ejb.Emailer.sendContactUs(Emailer.java:68)
>     at 
> com.acc.base.ejb.EmailerTest.emailerSuccessTest(EmailerTest.java:30)
>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>     at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>     at java.lang.reflect.Method.invoke(Method.java:597)
>     at 
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
>     at 
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
>     at 
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
>     at 
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
>     at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
>     at 
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
>     at 
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)
>     at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
>     at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
>     at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
>     at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
>     at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
>     at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
>     at 
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
>     at 
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>     at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
>     at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
>     at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
>     at 
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
>
>
> please tell me what I am doing wrong because this technique worked in 
> previous versions of Geronimo.
> -- 
>
> Russell Collins
> Collins-Solutions@austin.rr.com


-- 

Russell Collins
Collins-Solutions@austin.rr.com