You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Alexis Krier <al...@laposte.net> on 2011/11/02 22:32:23 UTC

OpenEjb testing EJB 2.1

Hello,
I was looking to test my old 2.1 EJB with this example:
https://github.com/apache/openejb/tree/trunk/openejb/examples/component-interfaces

I have the EJBHome & EJBObject ok
but where is my SessionBean? I suppose it is "FriendlyPerson" but this 
is not implementing SessionBean.

Will I have to modify all my old sessionBeans to match "FriendlyPerson" way?

thank you

Alexis

OpenEjb testing EJB 2.1

Posted by Alexis Krier <al...@laposte.net>.
Hello,
I was looking to test my old 2.1 EJB with this example:
https://github.com/apache/openejb/tree/trunk/openejb/examples/component-interfaces

I have the EJBHome & EJBObject ok
but where is my SessionBean? I suppose it is "FriendlyPerson" but this 
is not implementing SessionBean.

Will I have to modify all my old sessionBeans to match "FriendlyPerson" way?

thank you

Alexis

Re: OpenEjb testing EJB 2.1 with websphere jars

Posted by Alexis Krier <al...@laposte.net>.
Yep you were right, once I've isolated the classic EJB classes, all went 
right.
I've had another problem with a class which excpected a specific jar in 
the IBM JDK so I've add it and there was no more problem.

No This server is going really fast to start up during JUnit, I'm 
impressed. We are starting to build many test with it so everything is 
not tested yet, but men, it's working!

It is so quick and stable than I prefer to use it to debug my ejb than 
the websphere inside RAD which is ... well you know^^

Thank you

Le 03/11/2011 19:23, Frank Brown a écrit :
> I've deployed EJB's (created initially for WebSphere) using openejb, and
> it worked quite nicely.  I did not have to make any no changes to the
> EJB's themselves.  I had a separate class that would do the lookup for
> all EJB Remote Homes, and this is the only class I had to change.
>
> I suspect your problem is with how your EJB client obtains an initial
> context for looking up the EJB's.  You will need to use one of the
> openejb initial context factory classes rather than an IBM initial
> context factory class.  You will need the corresponding jars for openejb
> clients rather than IBM WebSphere clients.
>
> Also, be aware that if your EJB's access other EJB's, then you will
> need to use the openejb classes to get initial context in the EJB
> Module, not just the client module/application.
>
>
>
>>>> On 11/3/2011 at  9:55 AM, Alexis Krier<al...@laposte.net>
> wrote:
> Hello
> Ok I've deployed EJB 2.1  in my JUNIT without problem now
> but when I try to deploy EJB created for websphere, I have a strange
> error which use some ibm classes.
>
> whereas I have set my exclude like this
> p.put("openejb.deployments.classpath.include",
> ".*myproject/target/classes.*");
> p.put("openejb.deployments.classpath.exclude", ".*com.ibm.*");
> p.put("openejb.deployments.classpath.filter.descriptors", "true");
>
> ejb jar is simple
> XHome
> X
> XLocalHome
> XLocal
> XSession
> Stateless
> Container
>
>
> error is strange with an IBM ref
> javax.ejb.EJBException: Cannot obtain a free instance.; nested
> exception is:
>      java.lang.NoClassDefFoundError: com/ibm/CORBA/iiop/ObjectURL
>      at
> org.apache.openejb.core.ivm.BaseEjbProxyHandler.convertException(BaseEjbProxyHandler.java:365)
>      at
> org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:288)
>      at $Proxy46.getBeneficiary(Unknown Source)
>      ...
>      at
> com.ibm.websphere.naming.WsnInitialContextFactory.init_implClassCtor(WsnInitialContextFactory.java:172)
>      at
> com.ibm.websphere.naming.WsnInitialContextFactory.getInitialContext(WsnInitialContextFactory.java:112)
> er.loadClass(ClassLoader.java:248)
> ...
>
> I think I'm loading bad librairies but I can't figure out which ones
>
> Thank you
>
> Alexis
>
>
>
>
>> Message du 02/11/11 23:30
>> De : "David Blevins"
>> A : users@openejb.apache.org
>> Copie à :
>> Objet : Re: OpenEjb testing EJB 2.1
>>
>>
>> On Nov 2, 2011, at 2:32 PM, Alexis Krier wrote:
>>
>>> Hello,
>>> I was looking to test my old 2.1 EJB with this example:
>>>
> https://github.com/apache/openejb/tree/trunk/openejb/examples/component-interfaces
>
>>> I have the EJBHome&  EJBObject ok
>>> but where is my SessionBean? I suppose it is "FriendlyPerson" but
> this is not implementing SessionBean.
>>> Will I have to modify all my old sessionBeans to match
> "FriendlyPerson" way?
>> We have full support for EJB 1.1 through 3.1, so you should be able
> to test them as they are. That example shows that you can still use EJB
> 2.x features with an EJB 3.x bean. All EJB 2.x should work fine.
>>
>> -David
>>
>>
> Une messagerie gratuite, garantie à vie et des services en plus, ça
> vous tente ?
> Je crée ma boîte mail www.laposte.net
>

Re: OpenEjb testing EJB 2.1 with websphere jars

Posted by Frank Brown <br...@stancounty.com>.
I've deployed EJB's (created initially for WebSphere) using openejb, and
it worked quite nicely.  I did not have to make any no changes to the
EJB's themselves.  I had a separate class that would do the lookup for
all EJB Remote Homes, and this is the only class I had to change. 
 
I suspect your problem is with how your EJB client obtains an initial
context for looking up the EJB's.  You will need to use one of the
openejb initial context factory classes rather than an IBM initial
context factory class.  You will need the corresponding jars for openejb
clients rather than IBM WebSphere clients.
 
Also, be aware that if your EJB's access other EJB's, then you will
need to use the openejb classes to get initial context in the EJB
Module, not just the client module/application.
 
 

>>> On 11/3/2011 at  9:55 AM, Alexis Krier <al...@laposte.net>
wrote:
Hello
Ok I've deployed EJB 2.1  in my JUNIT without problem now
but when I try to deploy EJB created for websphere, I have a strange
error which use some ibm classes.

whereas I have set my exclude like this
p.put("openejb.deployments.classpath.include",
".*myproject/target/classes.*");
p.put("openejb.deployments.classpath.exclude", ".*com.ibm.*");
p.put("openejb.deployments.classpath.filter.descriptors", "true");

ejb jar is simple
XHome
X
XLocalHome
XLocal
XSession
Stateless
Container


error is strange with an IBM ref
javax.ejb.EJBException: Cannot obtain a free instance.; nested
exception is:
    java.lang.NoClassDefFoundError: com/ibm/CORBA/iiop/ObjectURL
    at
org.apache.openejb.core.ivm.BaseEjbProxyHandler.convertException(BaseEjbProxyHandler.java:365)
    at
org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:288)
    at $Proxy46.getBeneficiary(Unknown Source)
    ...
    at
com.ibm.websphere.naming.WsnInitialContextFactory.init_implClassCtor(WsnInitialContextFactory.java:172)
    at
com.ibm.websphere.naming.WsnInitialContextFactory.getInitialContext(WsnInitialContextFactory.java:112)
er.loadClass(ClassLoader.java:248)
...

I think I'm loading bad librairies but I can't figure out which ones

Thank you

Alexis




> Message du 02/11/11 23:30
> De : "David Blevins"
> A : users@openejb.apache.org 
> Copie à :
> Objet : Re: OpenEjb testing EJB 2.1
>
>
> On Nov 2, 2011, at 2:32 PM, Alexis Krier wrote:
>
> > Hello,
> > I was looking to test my old 2.1 EJB with this example:
> >
https://github.com/apache/openejb/tree/trunk/openejb/examples/component-interfaces

> >
> > I have the EJBHome & EJBObject ok
> > but where is my SessionBean? I suppose it is "FriendlyPerson" but
this is not implementing SessionBean.
> >
> > Will I have to modify all my old sessionBeans to match
"FriendlyPerson" way?
>
> We have full support for EJB 1.1 through 3.1, so you should be able
to test them as they are. That example shows that you can still use EJB
2.x features with an EJB 3.x bean. All EJB 2.x should work fine.
>
>
> -David
>
> 

Une messagerie gratuite, garantie à vie et des services en plus, ça
vous tente ?
Je crée ma boîte mail www.laposte.net

OpenEjb testing EJB 2.1 with websphere jars

Posted by Alexis Krier <al...@laposte.net>.
Hello
Ok I've deployed EJB 2.1  in my JUNIT without problem now
but when I try to deploy EJB created for websphere, I have a strange error which use some ibm classes.

whereas I have set my exclude like this
p.put("openejb.deployments.classpath.include", ".*myproject/target/classes.*");
p.put("openejb.deployments.classpath.exclude", ".*com.ibm.*");
p.put("openejb.deployments.classpath.filter.descriptors", "true");

ejb jar is simple
XHome
 X
 XLocalHome
 XLocal
 XSession
 Stateless
 Container

 
error is strange with an IBM ref
 javax.ejb.EJBException: Cannot obtain a free instance.; nested exception is:
    java.lang.NoClassDefFoundError: com/ibm/CORBA/iiop/ObjectURL
    at org.apache.openejb.core.ivm.BaseEjbProxyHandler.convertException(BaseEjbProxyHandler.java:365)
    at org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:288)
    at $Proxy46.getBeneficiary(Unknown Source)
    ...
    at com.ibm.websphere.naming.WsnInitialContextFactory.init_implClassCtor(WsnInitialContextFactory.java:172)
    at com.ibm.websphere.naming.WsnInitialContextFactory.getInitialContext(WsnInitialContextFactory.java:112)
er.loadClass(ClassLoader.java:248)
...

I think I'm loading bad librairies but I can't figure out which ones

Thank you

Alexis




> Message du 02/11/11 23:30
> De : "David Blevins"
> A : users@openejb.apache.org
> Copie à :
> Objet : Re: OpenEjb testing EJB 2.1
>
>
> On Nov 2, 2011, at 2:32 PM, Alexis Krier wrote:
>
> > Hello,
> > I was looking to test my old 2.1 EJB with this example:
> > https://github.com/apache/openejb/tree/trunk/openejb/examples/component-interfaces
> >
> > I have the EJBHome & EJBObject ok
> > but where is my SessionBean? I suppose it is "FriendlyPerson" but this is not implementing SessionBean.
> >
> > Will I have to modify all my old sessionBeans to match "FriendlyPerson" way?
>
> We have full support for EJB 1.1 through 3.1, so you should be able to test them as they are. That example shows that you can still use EJB 2.x features with an EJB 3.x bean. All EJB 2.x should work fine.
>
>
> -David
>
> 

Une messagerie gratuite, garantie à vie et des services en plus, ça vous tente ?
Je crée ma boîte mail www.laposte.net

Re: OpenEjb testing EJB 2.1

Posted by David Blevins <da...@gmail.com>.
On Nov 2, 2011, at 2:32 PM, Alexis Krier wrote:

> Hello,
> I was looking to test my old 2.1 EJB with this example:
> https://github.com/apache/openejb/tree/trunk/openejb/examples/component-interfaces
> 
> I have the EJBHome & EJBObject ok
> but where is my SessionBean? I suppose it is "FriendlyPerson" but this is not implementing SessionBean.
> 
> Will I have to modify all my old sessionBeans to match "FriendlyPerson" way?

We have full support for EJB 1.1 through 3.1, so you should be able to test them as they are.  That example shows that you can still use EJB 2.x features with an EJB 3.x bean.  All EJB 2.x should work fine.


-David