Re: OpenEJB with JUnit from NetBeans: NameNotFoundException

2008-10-09 Thread franz see

I figured out what the solution is,

The setUp() of the test cases are missing this line



> properties.setProperty("openejb.deployments.classpath.include",
> ".*simple-stateless/target/classes.*");
> 

I don't know why though ( I don't know how openejb works ). But the
interceptors example works and it has that line.

I filed an issue in [1] for this.

Thanks,
Franz

[1] https://issues.apache.org/jira/browse/OPENEJB-922


franz see wrote:
> 
> Good day,
> 
> I am getting the same problem. And my system is able to find the
> META-INF/ejb-jar.xml as seen in the last part of the surefire reports (
> not unless that's the wrong ejb-jar.xml that I'm supposed to look for ).
> 
> I downloaded openejb-examples-3.0 ( [1] ), extracted the archive, and run
> `mvn clean install`, and I am getting NameNotFoundException all over the
> place.
> 
> Are there are many steps I need to take to set this up?
> 
> Thanks,
> Franz
> 
> [1]
> http://www.apache.org/dyn/closer.cgi/openejb/3.0/openejb-examples-3.0.tar.
> 
> Sample Surefire reports from simple-stateless:
> 
> 
>> 
>> > name="org.superbiz.calculator.CalculatorTest">
>>   
>> 
>> > name="java.runtime.name"/>
>> > name="sun.boot.library.path"/>
>> 
>> 
>> http://java.sun.com/"; name="java.vendor.url"/>
>> 
>> 
>> 
>> > value="org.apache.openejb.core.security.JaccProvider$Factory"
>> name="javax.security.jacc.PolicyConfigurationFactory.provider"/>
>> 
>> 
>> 
>> > name="java.vm.specification.name"/>
>> > value="/home/franz/src/openejb-examples-3.0/simple-stateless"
>> name="user.dir"/>
>> 
>> > value="/home/franz/src/openejb-examples-3.0/simple-stateless"
>> name="derby.system.home"/>
>> > name="java.awt.graphicsenv"/>
>> > value="/home/franz/src/openejb-examples-3.0/simple-stateless"
>> name="basedir"/>
>> > value="/usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/endorsed"
>> name="java.endorsed.dirs"/>
>> 
>> > name="surefire.real.class.path"/>
>> 
>> 
>> > name="java.vm.specification.vendor"/>
>> > name="java.naming.factory.url.pkgs"/>
>> 
>> 
>> 
>> > value="/usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/server:/usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386:/usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/../lib/i386"
>> name="java.library.path"/>
>> > value="/home/franz/src/openejb-examples-3.0/simple-stateless/target/test-classes:/home/franz/src/openejb-examples-3.0/simple-stateless/target/classes:/shared/apps/.m2/repository/junit/junit/4.1/junit-4.1.jar:/shared/apps/.m2/repository/org/apache/openejb/javaee-api/5.0-1/javaee-api-5.0-1.jar:/shared/apps/.m2/repository/org/apache/openejb/openejb-core/3.0/openejb-core-3.0.jar:/shared/apps/.m2/repository/log4j/log4j/1.2.12/log4j-1.2.12.jar:/shared/apps/.m2/repository/org/apache/openejb/openejb-loader/3.0/openejb-loader-3.0.jar:/shared/apps/.m2/repository/org/apache/openejb/openejb-javaagent/3.0/openejb-javaagent-3.0.jar:/shared/apps/.m2/repository/org/apache/openejb/openejb-jee/3.0/openejb-jee-3.0.jar:/shared/apps/.m2/repository/com/sun/xml/bind/jaxb-impl/2.0.5/jaxb-impl-2.0.5.jar:/shared/apps/.m2/repository/commons-cli/commons-cli/1.1/commons-cli-1.1.jar:/shared/apps/.m2/repository/org/apache/activemq/activemq-ra/4.1.1/activemq-ra-4.1.1.jar:/shared/apps/.m2/repository/org/apache/activemq/activemq-core/4.1.1/activemq-core-4.1.1.jar:/shared/apps/.m2/repository/backport-util-concurrent/backport-util-concurrent/2.1/backport-util-concurrent-2.1.jar:/shared/apps/.m2/repository/commons-logging/commons-logging/1.1/commons-logging-1.1.jar:/shared/apps/.m2/repository/org/apache/activemq/activeio-core/3.0.0-incubator/activeio-core-3.0.0-incubator.jar:/shared/apps/.m2/repository/org/apache/openjpa/openjpa/1.0.1/openjpa-1.0.1.jar:/shared/apps/.m2/repository/net/sourceforge/serp/serp/1.13.1/serp-1.13.1.jar:/shared/apps/.m2/repository/commons-lang/commons-lang/2.1/commons-lang-2.1.jar:/shared/apps/.m2/repository/commons-collections/commons-collections/3.2/commons-collections-3.2.jar:/shared/apps/.m2/repository/org/apache/geronimo/components/geronimo-connector/2.1/geronimo-connector-2.1.jar:/shared/apps/.m2/repository/org/apache/geronimo/components/geronimo-transaction/2.1/geronimo-transaction-2.1.jar:/shared/apps/.m2/repository/org/objectweb/howl/howl/1.0.1-1/howl-1.0.1-1.jar:/shared/apps/.m2/repository/org/apache/geronimo/javamail/geronimo-javamail_1.4_mail/1.2/geronimo-javamail_1.4_mail-1.2.jar:/shared/apps/.m2/repository/org/apache/openejb/xbean-reflect/3.4-r636442/xbean-reflect-3.4-r636442.jar:/shared/apps/.m2/repository/org/apache/openejb/xbean-finder/3.4-r636442/xbean-finder-3.4-r636442.jar:/shared/apps/.m2/repository/org/apache/xbean/xbean-naming/3.3/xbean-naming-3.3.jar:/shared/apps/.m2/repository/asm/asm/2.2.3/asm-2.2.3.jar:/shared/apps/.m2/repository/asm/asm-commons/2.2.3/asm-commons-2.2.3.jar:/shared/apps/.m2/repository/asm/asm-tree/2.2.3/asm-tree-2.2.3.jar:/shared/apps/.m2/repository/hsqldb/hsqldb/1.8.0.

Re: OpenEJB with JUnit from NetBeans: NameNotFoundException

2008-10-09 Thread franz see

Good day,

I am getting the same problem. And my system is able to find the
META-INF/ejb-jar.xml as seen in the last part of the surefire reports ( not
unless that's the wrong ejb-jar.xml that I'm supposed to look for ).

I downloaded openejb-examples-3.0 ( [1] ), extracted the archive, and run
`mvn clean install`, and I am getting NameNotFoundException all over the
place.

Are there are many steps I need to take to set this up?

Thanks,
Franz

[1]
http://www.apache.org/dyn/closer.cgi/openejb/3.0/openejb-examples-3.0.tar.

Sample Surefire reports from simple-stateless:


> 
>  name="org.superbiz.calculator.CalculatorTest">
>   
> 
>  name="java.runtime.name"/>
>  name="sun.boot.library.path"/>
> 
> 
> http://java.sun.com/"; name="java.vendor.url"/>
> 
> 
> 
>  value="org.apache.openejb.core.security.JaccProvider$Factory"
> name="javax.security.jacc.PolicyConfigurationFactory.provider"/>
> 
> 
> 
>  name="java.vm.specification.name"/>
>  value="/home/franz/src/openejb-examples-3.0/simple-stateless"
> name="user.dir"/>
> 
>  value="/home/franz/src/openejb-examples-3.0/simple-stateless"
> name="derby.system.home"/>
>  name="java.awt.graphicsenv"/>
>  value="/home/franz/src/openejb-examples-3.0/simple-stateless"
> name="basedir"/>
>  value="/usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/endorsed"
> name="java.endorsed.dirs"/>
> 
>  name="surefire.real.class.path"/>
> 
> 
>  name="java.vm.specification.vendor"/>
>  name="java.naming.factory.url.pkgs"/>
> 
> 
> 
>  value="/usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386/server:/usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386:/usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/../lib/i386"
> name="java.library.path"/>
>  value="/home/franz/src/openejb-examples-3.0/simple-stateless/target/test-classes:/home/franz/src/openejb-examples-3.0/simple-stateless/target/classes:/shared/apps/.m2/repository/junit/junit/4.1/junit-4.1.jar:/shared/apps/.m2/repository/org/apache/openejb/javaee-api/5.0-1/javaee-api-5.0-1.jar:/shared/apps/.m2/repository/org/apache/openejb/openejb-core/3.0/openejb-core-3.0.jar:/shared/apps/.m2/repository/log4j/log4j/1.2.12/log4j-1.2.12.jar:/shared/apps/.m2/repository/org/apache/openejb/openejb-loader/3.0/openejb-loader-3.0.jar:/shared/apps/.m2/repository/org/apache/openejb/openejb-javaagent/3.0/openejb-javaagent-3.0.jar:/shared/apps/.m2/repository/org/apache/openejb/openejb-jee/3.0/openejb-jee-3.0.jar:/shared/apps/.m2/repository/com/sun/xml/bind/jaxb-impl/2.0.5/jaxb-impl-2.0.5.jar:/shared/apps/.m2/repository/commons-cli/commons-cli/1.1/commons-cli-1.1.jar:/shared/apps/.m2/repository/org/apache/activemq/activemq-ra/4.1.1/activemq-ra-4.1.1.jar:/shared/apps/.m2/repository/org/apache/activemq/activemq-core/4.1.1/activemq-core-4.1.1.jar:/shared/apps/.m2/repository/backport-util-concurrent/backport-util-concurrent/2.1/backport-util-concurrent-2.1.jar:/shared/apps/.m2/repository/commons-logging/commons-logging/1.1/commons-logging-1.1.jar:/shared/apps/.m2/repository/org/apache/activemq/activeio-core/3.0.0-incubator/activeio-core-3.0.0-incubator.jar:/shared/apps/.m2/repository/org/apache/openjpa/openjpa/1.0.1/openjpa-1.0.1.jar:/shared/apps/.m2/repository/net/sourceforge/serp/serp/1.13.1/serp-1.13.1.jar:/shared/apps/.m2/repository/commons-lang/commons-lang/2.1/commons-lang-2.1.jar:/shared/apps/.m2/repository/commons-collections/commons-collections/3.2/commons-collections-3.2.jar:/shared/apps/.m2/repository/org/apache/geronimo/components/geronimo-connector/2.1/geronimo-connector-2.1.jar:/shared/apps/.m2/repository/org/apache/geronimo/components/geronimo-transaction/2.1/geronimo-transaction-2.1.jar:/shared/apps/.m2/repository/org/objectweb/howl/howl/1.0.1-1/howl-1.0.1-1.jar:/shared/apps/.m2/repository/org/apache/geronimo/javamail/geronimo-javamail_1.4_mail/1.2/geronimo-javamail_1.4_mail-1.2.jar:/shared/apps/.m2/repository/org/apache/openejb/xbean-reflect/3.4-r636442/xbean-reflect-3.4-r636442.jar:/shared/apps/.m2/repository/org/apache/openejb/xbean-finder/3.4-r636442/xbean-finder-3.4-r636442.jar:/shared/apps/.m2/repository/org/apache/xbean/xbean-naming/3.3/xbean-naming-3.3.jar:/shared/apps/.m2/repository/asm/asm/2.2.3/asm-2.2.3.jar:/shared/apps/.m2/repository/asm/asm-commons/2.2.3/asm-commons-2.2.3.jar:/shared/apps/.m2/repository/asm/asm-tree/2.2.3/asm-tree-2.2.3.jar:/shared/apps/.m2/repository/hsqldb/hsqldb/1.8.0.7/hsqldb-1.8.0.7.jar:/shared/apps/.m2/repository/org/apache/openejb/commons-dbcp-all/1.3/commons-dbcp-all-1.3.jar:/shared/apps/.m2/repository/org/codehaus/swizzle/swizzle-stream/1.0.1/swizzle-stream-1.0.1.jar:/shared/apps/.m2/repository/wsdl4j/wsdl4j/1.6.1/wsdl4j-1.6.1.jar:"
> name="surefire.test.class.path"/>
>  name="java.specification.name"/>
> 
>  name="sun.management.compiler"/>
> 
> 
> 
> 
> 
> 
> 
>  value="/home/franz/src/openejb-examples-3.0/simple-stateless/target/test-classes:/home/fra

Re: OpenEJB in an OSGi container

2008-10-09 Thread Zog

I'm using apache Felix 1.2.1 with OSGi 1.4.
I've no code to share yet - I started on this just recently and am still in 
information gathering mode :) but for sure I'll share this
once I get it to work.
Thanks a lot for the help 
  /Zog


David Blevins wrote:
> 
> Thanks, Guillaume.  That gives me a pretty good idea on what the  
> pieces are.
> 
> Zog, let me know what OSGi kernel and version you're using and I'll  
> see if I can't whip up some boot code for you.  If you've got any  
> starter code you can share, feel free to zip it up and attach it do a  
> JIRA (created a jira for you here
> https://issues.apache.org/jira/browse/OPENEJB-921)
> 
> -David
> 
> 
> On Oct 9, 2008, at 2:47 PM, Guillaume Nodet wrote:
> 
>> It's been a long time since I work on that and I still have not found
>> the time to continue this integration work.
>> Anyway, the code I used is available at:
>>  http://svn.apache.org/repos/asf/servicemix/smx4/features/branches/ 
>> ejb3
>> It uses a spring-powered bundle to set up OpenEJB:
>> 
>> http://svn.apache.org/repos/asf/servicemix/smx4/features/branches/ejb3/deployer/src/main/resources/META-INF/spring/openejb-spring.xml
>> and the related java classes are available at:
>> 
>> http://svn.apache.org/repos/asf/servicemix/smx4/features/branches/ejb3/deployer/src/main/java/org/apache/servicemix/ejb3/deployer/
>>
>> Unfortunately, this may be a bit outdated :-(
>>
>> Anyway, the idea was to be able to listen to newly installed bundles
>> and discover EJB inside those so that they are automatically
>> configured as plain EJB or web services.
>> Though, this was in the context of ServiceMix, where the EJBs were to
>> be exposed on the JBI bus and eventually through HTTP/SOAP too.
>>
>> On Thu, Oct 9, 2008 at 9:26 PM, David Blevins  
>> <[EMAIL PROTECTED]> wrote:
>>> Guillaume is the one who's done most the work in this area in  
>>> regards to his
>>> use of OpenEJB in the OSGi-based ServiceMix 4.
>>>
>>> What boot technique did you use in ServieMix?
>>>
>>>
>>> -David
>>>
>>>
>>> On Oct 9, 2008, at 2:08 PM, Zog wrote:
>>>

 Hi
 So, I managed to get my EJB app running just fine in Tomcat/ 
 OpeneEJB. Now
 that it validates the J2EE support I need from OpenEJB, I'd like  
 to move
 all
 this
 to an OSGi container.
 Any hints on where I should look for information ?
 I scanned through the web and although it's stated everywhere that  
 OpenEJB
 is packaged as OSGi bundled, I couldn't find information on how to  
 start
 openejb
 in osgi.
 I tried a simple approach where I load everything in openejb/lib  
 from the
 system classpath,
 but got a mysterious exception:
 Caused by: org.apache.openejb.core.ivm.naming.NamingException:  
 Cannot
 initailize
 OpenEJB: null
  at
 org 
 .apache.openejb.core.ivm.naming.InitContextFactory.initializeOpenE
 JB(InitContextFactory.java:88)
  at
 org 
 .apache.openejb.core.ivm.naming.InitContextFactory.getInitialConte
 xt(InitContextFactory.java:35)
  at
 org 
 .apache.openejb.client.LocalInitialContextFactory.getIntraVmContex
 t(LocalInitialContextFactory.java:114)

 That's most probably related to the way OSGi does classloading,  
 and I'm
 investigating.

 Should I look at the way you embedded OpenEJB for Tomcat ? Or  
 should I
 look
 elsewhere ?
 Any clue welcomed :)
/Zog

 PS: Btw, finding http://openejb.apache.org/apidocs is not very  
 easy on the
 openejb site -
 I had to scan through the forums to find that one.
 --
 View this message in context:
 http://www.nabble.com/OpenEJB-in-an-OSGi-container-tp19905326p19905326.html
 Sent from the OpenEJB User mailing list archive at Nabble.com.


>>>
>>>
>>
>>
>>
>> -- 
>> Cheers,
>> Guillaume Nodet
>> 
>> Blog: http://gnodet.blogspot.com/
>> 
>> Open Source SOA
>> http://open.iona.com
>>
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/OpenEJB-in-an-OSGi-container-tp19905326p19907692.html
Sent from the OpenEJB User mailing list archive at Nabble.com.



Re: OpenEJB in an OSGi container

2008-10-09 Thread David Blevins
Thanks, Guillaume.  That gives me a pretty good idea on what the  
pieces are.


Zog, let me know what OSGi kernel and version you're using and I'll  
see if I can't whip up some boot code for you.  If you've got any  
starter code you can share, feel free to zip it up and attach it do a  
JIRA (created a jira for you here https://issues.apache.org/jira/browse/OPENEJB-921)


-David


On Oct 9, 2008, at 2:47 PM, Guillaume Nodet wrote:


It's been a long time since I work on that and I still have not found
the time to continue this integration work.
Anyway, the code I used is available at:
 http://svn.apache.org/repos/asf/servicemix/smx4/features/branches/ 
ejb3

It uses a spring-powered bundle to set up OpenEJB:
 
http://svn.apache.org/repos/asf/servicemix/smx4/features/branches/ejb3/deployer/src/main/resources/META-INF/spring/openejb-spring.xml
and the related java classes are available at:
 
http://svn.apache.org/repos/asf/servicemix/smx4/features/branches/ejb3/deployer/src/main/java/org/apache/servicemix/ejb3/deployer/

Unfortunately, this may be a bit outdated :-(

Anyway, the idea was to be able to listen to newly installed bundles
and discover EJB inside those so that they are automatically
configured as plain EJB or web services.
Though, this was in the context of ServiceMix, where the EJBs were to
be exposed on the JBI bus and eventually through HTTP/SOAP too.

On Thu, Oct 9, 2008 at 9:26 PM, David Blevins  
<[EMAIL PROTECTED]> wrote:
Guillaume is the one who's done most the work in this area in  
regards to his

use of OpenEJB in the OSGi-based ServiceMix 4.

What boot technique did you use in ServieMix?


-David


On Oct 9, 2008, at 2:08 PM, Zog wrote:



Hi
So, I managed to get my EJB app running just fine in Tomcat/ 
OpeneEJB. Now
that it validates the J2EE support I need from OpenEJB, I'd like  
to move

all
this
to an OSGi container.
Any hints on where I should look for information ?
I scanned through the web and although it's stated everywhere that  
OpenEJB
is packaged as OSGi bundled, I couldn't find information on how to  
start

openejb
in osgi.
I tried a simple approach where I load everything in openejb/lib  
from the

system classpath,
but got a mysterious exception:
Caused by: org.apache.openejb.core.ivm.naming.NamingException:  
Cannot

initailize
OpenEJB: null
 at
org 
.apache.openejb.core.ivm.naming.InitContextFactory.initializeOpenE

JB(InitContextFactory.java:88)
 at
org 
.apache.openejb.core.ivm.naming.InitContextFactory.getInitialConte

xt(InitContextFactory.java:35)
 at
org 
.apache.openejb.client.LocalInitialContextFactory.getIntraVmContex

t(LocalInitialContextFactory.java:114)

That's most probably related to the way OSGi does classloading,  
and I'm

investigating.

Should I look at the way you embedded OpenEJB for Tomcat ? Or  
should I

look
elsewhere ?
Any clue welcomed :)
   /Zog

PS: Btw, finding http://openejb.apache.org/apidocs is not very  
easy on the

openejb site -
I had to scan through the forums to find that one.
--
View this message in context:
http://www.nabble.com/OpenEJB-in-an-OSGi-container-tp19905326p19905326.html
Sent from the OpenEJB User mailing list archive at Nabble.com.









--
Cheers,
Guillaume Nodet

Blog: http://gnodet.blogspot.com/

Open Source SOA
http://open.iona.com





Re: OpenEJB in an OSGi container

2008-10-09 Thread Guillaume Nodet
It's been a long time since I work on that and I still have not found
the time to continue this integration work.
Anyway, the code I used is available at:
  http://svn.apache.org/repos/asf/servicemix/smx4/features/branches/ejb3
It uses a spring-powered bundle to set up OpenEJB:
  
http://svn.apache.org/repos/asf/servicemix/smx4/features/branches/ejb3/deployer/src/main/resources/META-INF/spring/openejb-spring.xml
and the related java classes are available at:
  
http://svn.apache.org/repos/asf/servicemix/smx4/features/branches/ejb3/deployer/src/main/java/org/apache/servicemix/ejb3/deployer/

Unfortunately, this may be a bit outdated :-(

Anyway, the idea was to be able to listen to newly installed bundles
and discover EJB inside those so that they are automatically
configured as plain EJB or web services.
Though, this was in the context of ServiceMix, where the EJBs were to
be exposed on the JBI bus and eventually through HTTP/SOAP too.

On Thu, Oct 9, 2008 at 9:26 PM, David Blevins <[EMAIL PROTECTED]> wrote:
> Guillaume is the one who's done most the work in this area in regards to his
> use of OpenEJB in the OSGi-based ServiceMix 4.
>
> What boot technique did you use in ServieMix?
>
>
> -David
>
>
> On Oct 9, 2008, at 2:08 PM, Zog wrote:
>
>>
>> Hi
>> So, I managed to get my EJB app running just fine in Tomcat/OpeneEJB. Now
>> that it validates the J2EE support I need from OpenEJB, I'd like to move
>> all
>> this
>> to an OSGi container.
>> Any hints on where I should look for information ?
>> I scanned through the web and although it's stated everywhere that OpenEJB
>> is packaged as OSGi bundled, I couldn't find information on how to start
>> openejb
>> in osgi.
>> I tried a simple approach where I load everything in openejb/lib from the
>> system classpath,
>> but got a mysterious exception:
>> Caused by: org.apache.openejb.core.ivm.naming.NamingException: Cannot
>> initailize
>> OpenEJB: null
>>   at
>> org.apache.openejb.core.ivm.naming.InitContextFactory.initializeOpenE
>> JB(InitContextFactory.java:88)
>>   at
>> org.apache.openejb.core.ivm.naming.InitContextFactory.getInitialConte
>> xt(InitContextFactory.java:35)
>>   at
>> org.apache.openejb.client.LocalInitialContextFactory.getIntraVmContex
>> t(LocalInitialContextFactory.java:114)
>>
>> That's most probably related to the way OSGi does classloading, and I'm
>> investigating.
>>
>> Should I look at the way you embedded OpenEJB for Tomcat ? Or should I
>> look
>> elsewhere ?
>> Any clue welcomed :)
>> /Zog
>>
>> PS: Btw, finding http://openejb.apache.org/apidocs is not very easy on the
>> openejb site -
>> I had to scan through the forums to find that one.
>> --
>> View this message in context:
>> http://www.nabble.com/OpenEJB-in-an-OSGi-container-tp19905326p19905326.html
>> Sent from the OpenEJB User mailing list archive at Nabble.com.
>>
>>
>
>



-- 
Cheers,
Guillaume Nodet

Blog: http://gnodet.blogspot.com/

Open Source SOA
http://open.iona.com


Re: OpenEJB in an OSGi container

2008-10-09 Thread Zog

(in case that was for me and not for Guillaume N): I'm not using servicemix -
I'd like
to have openejb running in a plain barebone Felix installation. That would
be the
start, then I'd take a look at how to deploy ejbs in there (i.e. directly
via the
openeejb conf or as bundles like Guillaume has done).
 


David Blevins wrote:
> 
> Guillaume is the one who's done most the work in this area in regards  
> to his use of OpenEJB in the OSGi-based ServiceMix 4.
> 
> What boot technique did you use in ServieMix?
> 
> 
> -David
> 
> 
> On Oct 9, 2008, at 2:08 PM, Zog wrote:
> 
>>
>> Hi
>> So, I managed to get my EJB app running just fine in Tomcat/ 
>> OpeneEJB. Now
>> that it validates the J2EE support I need from OpenEJB, I'd like to  
>> move all
>> this
>> to an OSGi container.
>> Any hints on where I should look for information ?
>> I scanned through the web and although it's stated everywhere that  
>> OpenEJB
>> is packaged as OSGi bundled, I couldn't find information on how to  
>> start
>> openejb
>> in osgi.
>> I tried a simple approach where I load everything in openejb/lib  
>> from the
>> system classpath,
>> but got a mysterious exception:
>> Caused by: org.apache.openejb.core.ivm.naming.NamingException: Cannot
>> initailize
>> OpenEJB: null
>>at
>> org.apache.openejb.core.ivm.naming.InitContextFactory.initializeOpenE
>> JB(InitContextFactory.java:88)
>>at
>> org.apache.openejb.core.ivm.naming.InitContextFactory.getInitialConte
>> xt(InitContextFactory.java:35)
>>at
>> org.apache.openejb.client.LocalInitialContextFactory.getIntraVmContex
>> t(LocalInitialContextFactory.java:114)
>>
>> That's most probably related to the way OSGi does classloading, and  
>> I'm
>> investigating.
>>
>> Should I look at the way you embedded OpenEJB for Tomcat ? Or should  
>> I look
>> elsewhere ?
>> Any clue welcomed :)
>>  /Zog
>>
>> PS: Btw, finding http://openejb.apache.org/apidocs is not very easy  
>> on the
>> openejb site -
>> I had to scan through the forums to find that one.
>> -- 
>> View this message in context:
>> http://www.nabble.com/OpenEJB-in-an-OSGi-container-tp19905326p19905326.html
>> Sent from the OpenEJB User mailing list archive at Nabble.com.
>>
>>
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/OpenEJB-in-an-OSGi-container-tp19905326p19905846.html
Sent from the OpenEJB User mailing list archive at Nabble.com.



Re: OpenEJB in an OSGi container

2008-10-09 Thread David Blevins
Guillaume is the one who's done most the work in this area in regards  
to his use of OpenEJB in the OSGi-based ServiceMix 4.


What boot technique did you use in ServieMix?


-David


On Oct 9, 2008, at 2:08 PM, Zog wrote:



Hi
So, I managed to get my EJB app running just fine in Tomcat/ 
OpeneEJB. Now
that it validates the J2EE support I need from OpenEJB, I'd like to  
move all

this
to an OSGi container.
Any hints on where I should look for information ?
I scanned through the web and although it's stated everywhere that  
OpenEJB
is packaged as OSGi bundled, I couldn't find information on how to  
start

openejb
in osgi.
I tried a simple approach where I load everything in openejb/lib  
from the

system classpath,
but got a mysterious exception:
Caused by: org.apache.openejb.core.ivm.naming.NamingException: Cannot
initailize
OpenEJB: null
   at
org.apache.openejb.core.ivm.naming.InitContextFactory.initializeOpenE
JB(InitContextFactory.java:88)
   at
org.apache.openejb.core.ivm.naming.InitContextFactory.getInitialConte
xt(InitContextFactory.java:35)
   at
org.apache.openejb.client.LocalInitialContextFactory.getIntraVmContex
t(LocalInitialContextFactory.java:114)

That's most probably related to the way OSGi does classloading, and  
I'm

investigating.

Should I look at the way you embedded OpenEJB for Tomcat ? Or should  
I look

elsewhere ?
Any clue welcomed :)
 /Zog

PS: Btw, finding http://openejb.apache.org/apidocs is not very easy  
on the

openejb site -
I had to scan through the forums to find that one.
--
View this message in context: 
http://www.nabble.com/OpenEJB-in-an-OSGi-container-tp19905326p19905326.html
Sent from the OpenEJB User mailing list archive at Nabble.com.






OpenEJB in an OSGi container

2008-10-09 Thread Zog

Hi
So, I managed to get my EJB app running just fine in Tomcat/OpeneEJB. Now
that it validates the J2EE support I need from OpenEJB, I'd like to move all
this
to an OSGi container.
Any hints on where I should look for information ? 
I scanned through the web and although it's stated everywhere that OpenEJB
is packaged as OSGi bundled, I couldn't find information on how to start
openejb
in osgi.
I tried a simple approach where I load everything in openejb/lib from the
system classpath,
but got a mysterious exception:
Caused by: org.apache.openejb.core.ivm.naming.NamingException: Cannot
initailize
 OpenEJB: null
at
org.apache.openejb.core.ivm.naming.InitContextFactory.initializeOpenE
JB(InitContextFactory.java:88)
at
org.apache.openejb.core.ivm.naming.InitContextFactory.getInitialConte
xt(InitContextFactory.java:35)
at
org.apache.openejb.client.LocalInitialContextFactory.getIntraVmContex
t(LocalInitialContextFactory.java:114)

That's most probably related to the way OSGi does classloading, and I'm
investigating.

Should I look at the way you embedded OpenEJB for Tomcat ? Or should I look
elsewhere ?
Any clue welcomed :)
  /Zog

PS: Btw, finding http://openejb.apache.org/apidocs is not very easy on the
openejb site - 
I had to scan through the forums to find that one.
-- 
View this message in context: 
http://www.nabble.com/OpenEJB-in-an-OSGi-container-tp19905326p19905326.html
Sent from the OpenEJB User mailing list archive at Nabble.com.



Re: JNDI lookup in Tomcat

2008-10-09 Thread Zog

In a servlet listener for my webapp, I'm using this:

public void contextInitialized(ServletContextEvent aArg0)
{
System.setProperty(Context.INITIAL_CONTEXT_FACTORY,   
"org.apache.openejb.client.LocalInitialContextFactory");
System.err.println(">>> FULL JNDI TREE FROM STARTUP");
try {
InitialContext ic = new InitialContext();
listContext("",ic);
} catch (NamingException e) {
System.err.println("Could not list tree."+e);
}
System.err.println("<<< FULL JNDI TREE FROM STARTUP");  
  
}

private static final void listContext(String s, Context c) throws
NamingException
{
NamingEnumeration pairs = c.list("");
for (; pairs.hasMoreElements();)
{
NameClassPair p = pairs.next();
System.err.println(s+"/"+p.getName() + " " + p.getClassName());
Object o = c.lookup(p.getName());
if (o instanceof Context)
{
Context child = (Context) o; 
listContext(s+"/"+p.getName(), child);
}
}
}

And here's what I get:
/. java.lang.String
/openejb org.apache.openejb.core.ivm.naming.IvmContext
/openejb/ConfigurationInfoBusinessRemote
org.apache.openejb.core.ivm.naming.Busi
nessRemoteReference
/openejb/DeployerBusinessRemote
org.apache.openejb.core.ivm.naming.BusinessRemot
eReference
...and then other contexts created by my MDB/SB.

I don't see any /openejb/TransactionManager there.

/Zog


David Blevins wrote:
> 
> 
> On Oct 8, 2008, at 12:37 PM, Zog wrote:
> 
>> I installed the openejb.war in tomcat-6.0.18 and my ear as a  
>> collapsed ear.
>> When I lookup objects in the JNDI tree, I realized that I can freely  
>> look up
>> injected resources (I use the  in ejb-jar.xml for ex  
>> for data
>> sources),
>> but non injected are failing - is this normal ?
>> Specifically, one of my ejb is doing
>> InitialContext ic = new InitialContext(); // Properly initialized  
>> with the
>> OpenEJB ICfactory
>> ic.lookup("openejb/TransactionManager");
>> and this always throws a NameNotFoundException.
> 
> Hmm.  If it was created with the LocalInitialContextFactory as so..
> 
>   Properties properties = new Properties();
>   properties.setProperty(Context.INITIAL_CONTEXT_FACTORY,  
> "org.apache.openejb.client.LocalInitialContextFactory");
> 
>   InitialContext initialContext = new InitialContext(properties);
> 
> Then it should definitely work.  If it was done as so...
> 
>   InitialContext initialContext = new InitialContext();
> 
> Then I'm not as confident that it will work.  We have code in the  
> integration to add the "openejb" subcontext into the webapp's jndi  
> context, or so I thought.  I added code along these lines, but it's  
> been while and I can't recall the details.  Maybe in this second case  
> you have to lookup "java:openejb/TransactionManager".
> 
> Can you verify which technique you are using?
> 
> 
> -David
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/JNDI-lookup-in-Tomcat-tp19883726p19898308.html
Sent from the OpenEJB User mailing list archive at Nabble.com.



Re: OpenEJB with JUnit from NetBeans: NameNotFoundException

2008-10-09 Thread David Blevins


On Oct 9, 2008, at 4:32 AM, Bernhard Humm wrote:


init:
deps-jar:
compile:
compile-test:
Testsuite: org.superbiz.calculator.CalculatorTest
Apache OpenEJB 3.0build: 20080408-04:13
http://openejb.apache.org/
INFO - openejb.home = C:\temp\NetBeans\OpenEJBTest
INFO - openejb.base = C:\temp\NetBeans\OpenEJBTest
INFO - Configuring Service(id=Default Security Service,
type=SecurityService, provider-id=Default Security Service)
INFO - Configuring Service(id=Default Transaction Manager,
type=TransactionManager, provider-id=Default Transaction Manager)
INFO - Configuring Service(id=Default JDK 1.3 ProxyFactory,
type=ProxyFactory, provider-id=Default JDK 1.3 ProxyFactory)
Tests run: 2, Failures: 0, Errors: 2, Time elapsed: 5,234 sec


It doesn't look like the app is getting discovered with the way it's  
setup in NetBeans.  OpenEJB will search for directories or jars  
containing a META-INF/ejb-jar.xml file and load those directories and  
jars as individual ejb jars.  We have NetBeans users, so I know it's  
capable of putting both the classes and the META-INF/ejb-jar.xml in  
the same directory so that OpenEJB can discover them together as an  
app.  We just need to figure out what might be happening with this  
particular setup.


Run this in your test case and see if your classpath is setup right.   
There should be a META-INF/ejb-jar.xml file in any directories that  
contain ejb classes that should be deployed by OpenEJB.


Enumeration ejbJars =  
this.getClass().getClassLoader().getResources("META-INF/ejb-jar.xml");

while (ejbJars.hasMoreElements()) {
URL url = ejbJars.nextElement();
System.out.println("app = " + url);
}


-David





Re: OpenEJB with JUnit from NetBeans: NameNotFoundException

2008-10-09 Thread Bernhard Humm



David Blevins wrote:
> 
> 
> Could you post the log output from the test run?
> 
> -David
> 
> 

init:
deps-jar:
compile:
compile-test:
Testsuite: org.superbiz.calculator.CalculatorTest
Apache OpenEJB 3.0build: 20080408-04:13
http://openejb.apache.org/
INFO - openejb.home = C:\temp\NetBeans\OpenEJBTest
INFO - openejb.base = C:\temp\NetBeans\OpenEJBTest
INFO - Configuring Service(id=Default Security Service,
type=SecurityService, provider-id=Default Security Service)
INFO - Configuring Service(id=Default Transaction Manager,
type=TransactionManager, provider-id=Default Transaction Manager)
INFO - Configuring Service(id=Default JDK 1.3 ProxyFactory,
type=ProxyFactory, provider-id=Default JDK 1.3 ProxyFactory)
Tests run: 2, Failures: 0, Errors: 2, Time elapsed: 5,234 sec

- Standard Output ---
Apache OpenEJB 3.0build: 20080408-04:13
http://openejb.apache.org/
INFO - openejb.home = C:\temp\NetBeans\OpenEJBTest
INFO - openejb.base = C:\temp\NetBeans\OpenEJBTest
INFO - Configuring Service(id=Default Security Service,
type=SecurityService, provider-id=Default Security Service)
INFO - Configuring Service(id=Default Transaction Manager,
type=TransactionManager, provider-id=Default Transaction Manager)
INFO - Configuring Service(id=Default JDK 1.3 ProxyFactory,
type=ProxyFactory, provider-id=Default JDK 1.3 ProxyFactory)
-  ---
Testcase:
testCalculatorViaRemoteInterface(org.superbiz.calculator.CalculatorTest):
Caused an ERROR
Name "Calculator" not found.
javax.naming.NameNotFoundException: Name "Calculator" not found.
at
org.apache.openejb.core.ivm.naming.IvmContext.federate(IvmContext.java:172)
at
org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:129)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at
org.superbiz.calculator.CalculatorTest.testCalculatorViaRemoteInterface(CalculatorTest.java:46)


Testcase:
testCalculatorViaLocalInterface(org.superbiz.calculator.CalculatorTest):
Caused an ERROR
Name "Calculator" not found.
javax.naming.NameNotFoundException: Name "Calculator" not found.
at
org.apache.openejb.core.ivm.naming.IvmContext.federate(IvmContext.java:172)
at
org.apache.openejb.core.ivm.naming.IvmContext.lookup(IvmContext.java:129)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at
org.superbiz.calculator.CalculatorTest.testCalculatorViaLocalInterface(CalculatorTest.java:63)


Test org.superbiz.calculator.CalculatorTest FAILED
test-report:
C:\temp\NetBeans\OpenEJBTest\nbproject\build-impl.xml:540: Some tests
failed; see details above.
BUILD FAILED (total time: 11 seconds)


-- 
View this message in context: 
http://www.nabble.com/OpenEJB-with-JUnit-from-NetBeans%3A-NameNotFoundException-tp19874503p19895424.html
Sent from the OpenEJB User mailing list archive at Nabble.com.



Re: Override annotations in ejb-jar.xml for a test case

2008-10-09 Thread David Blevins


On Oct 9, 2008, at 3:16 AM, Marcin Kwapisz wrote:

Correct me if I am wrong: when ejb-jar is empty OpenEJB process all  
class files (in classes and test-classes) and looks for annotated  
EJBs. When ejb-jar is modified, OpenEJB process that file and looks  
for annotated EJBs in test-classes only.


We look for annotated ejbs in classes/ if we find a classes/META-INF/ 
ejb-jar.xml file and the ejb-jar.xml file does not have 'metadata- 
complete' attribute set to 'true'.  Aside from the metadata-complete  
attribute, the contents of the ejb-jar.xml do not prevent searching  
for annotations or annotated ejbs.  The classes/ directory is treated  
as a single ejb jar and the contents of the classes/META-INF/ejb- 
jar.xml apply only to the beans in classes/.


The same rule applies for test-classes/.  Specifically, we look for  
annotated ejbs in test-classes/ if we find a test-classes/META-INF/ejb- 
jar.xml file and the ejb-jar.xml file does not have 'metadata- 
complete' attribute set to 'true' and the test-classes/ directory is  
treated as a single ejb jar, separate from classes/, and the contents  
of the test-classes/META-INF/ejb-jar.xml apply only to the beans in  
test-classes/.


Hope that helps.

-David



Re: OpenEJB with JUnit from NetBeans: NameNotFoundException

2008-10-09 Thread David Blevins


On Oct 8, 2008, at 2:09 PM, Bernhard Humm wrote:



This is what I did first, with the same effect: NameNotFoundException


Could you post the log output from the test run?

-David



RE: Override annotations in ejb-jar.xml for a test case

2008-10-09 Thread Marcin Kwapisz
Hi,

> We don't have any functionality for supplying an alternate ejb-jar.xml
> for testing purposes.  It's not a bad idea and is something we might
> be able to add after we get the 3.1 release out the door.

[Marcin Kwapisz] 
My Maven2 profile is as follows.  directs to folder 
src/test/resources/Toplink (METAINF) where modified ejb-jar.xml and 
persistence.xml exist.

TestEJB_Toplink


env
testtoplink




toplink.essentials
toplink-essentials-agent
2.1-53
test


toplink.essentials
toplink-essentials
2.1-53
test


zsk.samples
ToplinkExternalContainer
1.0
test





src/test/resources/Toplink





> This might be because the ejb-jar.xml is with the ejbs that are
> annotated.
[Marcin Kwapisz] 
Correct me if I am wrong: when ejb-jar is empty OpenEJB process all class files 
(in classes and test-classes) and looks for annotated EJBs. When ejb-jar is 
modified, OpenEJB process that file and looks for annotated EJBs in 
test-classes only.

Regards
-- 
Marcin Kwapisz
Division of Computer Networks
Technical Univeristy of Lodz, Poland





Re: EntityManager not picking up Map properties

2008-10-09 Thread David Blevins


On Sep 18, 2008, at 10:28 PM, rde8026 wrote:

I'm using Hibernate as my JPA provider in a Stateless EJB.  I need  
to add the
hibernate.default_catalog property to the EntityManager based on the  
dialect
being used (i.e. SQL Server = dbo).  I'm injecting the  
EntityManagerFactory

and trying to construct an EntityManager based off that but passing a
HashMap to it with that single property...and its not pre-pending  
the sql

statements correctly.  If I do it via the persistence.xml file it
worksany thoughts?

Here is a code snippet..

Map props = new HashMap();
props.put("hibernate.default_catalog", "dbo");  
em = emf.createEntityManager(props);


Likely a bug in hibernate as that call goes directly to them.  We get  
the hibernate EntityManagerFactory via a call like:


   PersistenceProvider persistenceProvider = (PersistenceProvider)  
clazz.newInstance();
   EntityManagerFactory emf =  
persistenceProvider.createContainerEntityManagerFactory(unitInfo, new  
HashMap());


And the persistence.xml data is in the PersistenceUnitInfo  
implementation we create and hand to the persistence provider  
(Hibernate in this case).  Seems they only support that property (or  
perhaps all properties) via the call above and not via the  
EntityManagerFactory createEntityManager method.


-David



Re: HELP! JNDI DataSource Name

2008-10-09 Thread David Blevins


On Sep 19, 2008, at 5:10 PM, rde8026 wrote:


Object obj1 = new
javax.naming.InitialContext().lookup("java:openejb/Resource/JTADS");
I've also tried it like this:
Properties props = new Properties();
props.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.LocalInitialContextFactory");
javax.naming.Context ctx = new javax.naming.InitialContext(props);
Object obj1 = ctx.lookup("java:openejb/Resource/JTADS");

I always get this error: NameNotFoundException: Name
"java:openejb/Resource/JTADS" not found.

Now the reason I need to understand the correct JNDI name is so I  
can use it

as a Hibernate Property (hibernate.connection.datasource).

I'm using openejb 3.1 SNAPSHOT and Hibernate hibernate-3.2.5.ga.

Any ideas?  I'm totally lost...as I understand it this should just  
work...

Thanks in advance


If hibernate is getting used in the context of an EJB, one technique  
that might work is to declare an @Resource reference to the datasource  
at the top of that bean's class.  That will cause it to be available  
to any code executing in the scope of that ejb via that name in JNDI.


As far as accessing java:openejb, I think we need to revise our code  
here.  Without going into too many details, the java:openejb isn't  
available in all situations.  It's really only available when doing a  
"new InitialContext().lookup("java:openejb")" from outside the scope  
of an ejb or servlet (say in a test case).  From inside the scope of  
an ejb or servlet you get their private JNDI scope which doesn't  
include java:openejb (it should).  When doing a lookup via "new  
InitialContext(properties).lookup("java:openejb)" with the properties  
listing the LocalInitialContextFactory you get an ejb-only namespace  
where java:openejb isn't there (again, it should).  We need to fix up  
those namespaces.


Trying roll a 3.1 release at the moment, but this is definitely  
something we'll fix up immediately after.  And hopefully get a 3.1.1  
out very soon after 3.1.


-David
 


Re: Rollback transactions in unit testing

2008-10-09 Thread David Blevins


On Sep 29, 2008, at 8:39 AM, Glauber Ferreira wrote:


Hi all.

I need to rollback transactions in order to revert all data modified
(deleted, updated, created) by my tests. How can I do that in the  
test code

listed in this link:
http://openejb.apache.org/3.0/unit-testing-transactions.html


Suggestions in this thread are pretty good.  A couple additional  
possibilities to throw on the stack..  If you throw a runtime  
exception from the TransactionBean call method the container will  
rollback the transaction.  Another option is to call the  
setRollbackOnly() method on the javax.ejb.SessionContext object.  A  
session ejb can have it injected with a field declared like "@Resource  
SessionContext sessionContext;"


-David