Re: OpenEJB with JUnit from NetBeans: NameNotFoundException

2009-03-16 Thread jooocz

Wow! Thanks for the replies, these helped me a lot.

@Jon : I tried your suggestion, please refer to my solutions below. Thanks
so much for your time. I really appreciate it :-) And I was able to deploy
the app correctly. Here's the correct JNDI names.

INFO - Jndi(name=UserAccountFacadeRemote) -->
Ejb(deployment-id=UserAccountFacade)
INFO - Jndi(name=DostGroupFacadeRemote) -->
Ejb(deployment-id=DostGroupFacade)
INFO - Jndi(name=PerformersLogFacadeRemote) -->
Ejb(deployment-id=PerformersLogFacade)
INFO - Jndi(name=BudgetMatrixBeanRemote) -->
Ejb(deployment-id=BudgetMatrixBean)

Note : I temporarily delete Mfos (an interface) and MFOBean (implements
Mfos). 

@David : Hi, from you and Jon's reply I think I need to fix that error.
Please refer to my solutions below. Thank you so much. I'm learning a lot
:jumping:

My solutions : 

1.) I changed my ejb-jar.xml


http://java.sun.com/xml/ns/javaee";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
metadata-complete="true" version="3.0"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd";>
  

  UserAccountFacade
  UserAccountFacade
 
ph.gov.dost.performers.session.UserAccountFacadeRemote
 
ph.gov.dost.performers.session.UserAccountFacade
  Stateless
  Container
  
   
ph.gov.dost.performers.session.UserAccountFacade/em
edostPerformers-ejbPU
Transaction

 
ph.gov.dost.performers.session.UserAccountFacade
  em

  
  

  


  DostGroupFacade
  DostGroupFacade
 
ph.gov.dost.performers.session.DostGroupFacadeRemote
  ph.gov.dost.performers.session.DostGroupFacade
  Stateless
  Container
  
   
ph.gov.dost.performers.session.DostGroupFacade/em
edostPerformers-ejbPU
Transaction

 
ph.gov.dost.performers.session.DostGroupFacade
  em

  
  

  


  PerformersLogFacade
  PerformersLogFacade
 
ph.gov.dost.performers.session.PerformersLogFacadeRemote
 
ph.gov.dost.performers.session.PerformersLogFacade
  Stateless
  Container
  
   
ph.gov.dost.performers.session.PerformersLogFacade/ctx
   
javax.ejb.SessionContext

 
ph.gov.dost.performers.session.PerformersLogFacade
  ctx

  
  
   
ph.gov.dost.performers.session.PerformersLogFacade/em
edostPerformers-ejbPU
Transaction

 
ph.gov.dost.performers.session.PerformersLogFacade
  em

  
  

  


  BudgetMatrixBean
  BudgetMatrixBean
 
ph.gov.dost.performers.session.BudgetMatrixRemote
  ph.gov.dost.performers.session.BudgetMatrixBean
  Stateless
  Container
  
   
ph.gov.dost.performers.session.BudgetMatrixBean/ctx
   
javax.ejb.SessionContext

 
ph.gov.dost.performers.session.BudgetMatrixBean
  ctx

  
  
   
ph.gov.dost.performers.session.BudgetMatrixBean/em
edostPerformers-ejbPU
Transaction

 
ph.gov.dost.performers.session.BudgetMatrixBean
  em

  
  

  

  
  

  Admin


  AgencyRep


  ExecutiveRep

  


2.) And to those .java files that didn't find the Persistence unit, I add
this :

@PersistenceContext(unitName="edostPerformers-ejbPU")
private EntityManager em;

.. code here

It's ok now, NameNotFoundException was resolved. For now, I need to install
JAVA AGENT. I will update this thread after. 

INFO - Assembling app: classpath.ear
INFO - PersistenceUnit(name=ExecutiveSupport4PU,
provider=oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider)
ERROR - JAVA AGENT NOT INSTALLED. The JPA Persistence Provider requested
installation of a ClassFileTransformer which requires a JavaAgent.  See
http://openejb.apache.org/3.0/javaagent.html
INFO - PersistenceUnit(name=ExecutiveSupport4PU,
provider=oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider)
ERROR - JAVA AGENT NOT INSTALLED. The JPA Persistence Provider requested
installation of a ClassFileTransformer which requires a JavaAgent.  See
http://openejb.apache.org/3.0/javaagent.html
INFO - PersistenceUnit(name=edostPerformers-ejbPU,
provider=org.apache.openjpa.persistence.PersistenceProviderImpl)
ERROR - JAVA AGENT NOT INSTALLED. The JPA Persistence Provider requested
installation of a ClassFileTransformer which requires a JavaAgent.  See
http://openejb.apache.org/3.0/javaagent.html
INFO - Jndi(name=UserAccountFacadeRemote) -->
Ejb(deployment-id=UserAccountFacade)

Again, thanks so much for your time.

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



Re: OpenEJB with JUnit from NetBeans: NameNotFoundException

2009-03-16 Thread David Blevins
It also looks like there are some validation errors with regard to the  
@PersistenceContext usage.



ERROR - FAIL ... BudgetMatrixBean:	Persistence unit not found for  
@PersistenceContext(name="em", unitName="").  Available  
units[ExecutiveSupport4PU, ExecutiveSupport4PU, edostPerformers-ejbPU]
ERROR - FAIL ... DostGroupFacade:	Persistence unit not found for  
@PersistenceContext(name="em", unitName="").  Available  
units[ExecutiveSupport4PU, ExecutiveSupport4PU, edostPerformers-ejbPU]
ERROR - FAIL ... PerformersLogFacade:	Persistence unit not found for  
@PersistenceContext(name="em", unitName="").  Available  
units[ExecutiveSupport4PU, ExecutiveSupport4PU, edostPerformers-ejbPU]
ERROR - FAIL ... UserAccountFacade:	Persistence unit not found for  
@PersistenceContext(name="em", unitName="").  Available  
units[ExecutiveSupport4PU, ExecutiveSupport4PU, edostPerformers-ejbPU]
ERROR - InvalidEjbModule(path=/home/jocel/svndostperf1/trunk/PROTOTYPE/ 
edostPerformers/edostPerformers-ejb/dist/edostPerformers-ejb.jar)


The unitName attribute of @PersistenceContext is required when there  
are multiple persistence units available.  Be careful though, as you  
have two units with the same name of ExecutiveSupport4PU.  You might  
want to rename one of them or remove it if it is a duplicate.


-David


On Mar 16, 2009, at 12:06 PM, Jonathan Gallimore wrote:


Hi,

I'm not quite sure if understand the problem, but I'll have a go at  
helping :)


From your output, it looks like your app isn't being deployed  
correctly, and that in turn is causing the JNDI lookup to fail. I'm  
just guessing here, but I think your session bean has a reference to  
itself which might be causing some of the problem:



  MFOSB
  MFOBean
  ph.gov.dost.performers.MFOBean
  Stateful
  Container
  
  MFOBean
  Session
  ph.gov.dost.performers.MFOBean
  ph.gov.dost.performers.MFOBean
  edostPerformers-ejb.jar#Mfos
  
  

I'm not sure you need the  section here, as it looks  
like your bean is trying to create a reference to itself. If you can  
get your app to deploy correctly, you should then be able to figure  
out the correct JNDI name to use in your test from the output, you  
should see something like:


Jndi(name=MFOBeanRemote) --> Ejb(deployment-id=MFOBean)

if you do, the following should work:

InitialContext initialContext = new InitialContext(properties);
MFO mfo = (MFO) initialContext.lookup("MFOBeanRemote");


I hope I've understood what's going on and been some help, apologies  
if not!


Cheers

Jon


jooocz wrote:

Good day,
I'm having the same error. I know that some of the users resolved  
this and I

tried to work with those solutions, also in this blog --
http://qbeukes.blogspot.com/search/label/ejb. But I still get the  
error. I

hope someone can help me.

I tried the code given by David.
Enumeration ejbJars =
this.getClass().getClassLoader().getResources("META-INF/ejb- 
jar.xml");

while (ejbJars.hasMoreElements()) {
URL url = ejbJars.nextElement();
System.out.println("app = " + url);
}
Here's the output :
app =
jar:file:/home/jocel/Desktop/javalib/openejb-3.1/lib/openejb- 
core-3.1.jar!/META-INF/ejb-jar.xml

app =
file:/home/jocel/svndostperf1/trunk/PROTOTYPE/ExecutiveSupport4/ 
build/test/classes/META-INF/ejb-jar.xml


Here's my ejb-jar.xml

http://java.sun.com/xml/ns/j2ee";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd";> 
   
   MFOSB
   MFOBean
   ph.gov.dost.performers.MFOBean
   Stateful
   Container
   
   MFOBean
   Session
   ph.gov.dost.performers.MFOBeanhome>

   ph.gov.dost.performers.MFOBean
   edostPerformers-ejb.jar#Mfos
   
   
   
   
   
   
   MFO
   *
   
   Required
   
   
   

Here's my test, I'm using TestNG 5.8

imports here.

   @Test
   public void init() throws Exception {
   System.out.println("=== init() ===");
Enumeration ejbJars =
this.getClass().getClassLoader().getResources("META-INF/ejb- 
jar.xml");

while (ejbJars.hasMoreElements()) {
URL url = ejbJars.nextElement();
System.out.println("app = " + url);
}
   Properties properties = new Properties();
   properties.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.LocalInitialContextFactory");
   // 
properties.setProperty("openejb.deployments.classpath.include",
".*build/test/classes.*");  
properties.put("openejbDatasoure",

"new://Resource?type=DataSource");
   properties.put("openejbDatasoure.JdbcDriver",
"com.mysql.jdbc.Driver");
   properties.put

Re: OpenEJB with JUnit from NetBeans: NameNotFoundException

2009-03-16 Thread Jonathan Gallimore

Hi,

I'm not quite sure if understand the problem, but I'll have a go at 
helping :)


From your output, it looks like your app isn't being deployed 
correctly, and that in turn is causing the JNDI lookup to fail. I'm just 
guessing here, but I think your session bean has a reference to itself 
which might be causing some of the problem:



   MFOSB
   MFOBean
   ph.gov.dost.performers.MFOBean
   Stateful
   Container
   
   MFOBean
   Session
   ph.gov.dost.performers.MFOBean
   ph.gov.dost.performers.MFOBean
   edostPerformers-ejb.jar#Mfos
   
   

I'm not sure you need the  section here, as it looks like 
your bean is trying to create a reference to itself. If you can get your 
app to deploy correctly, you should then be able to figure out the 
correct JNDI name to use in your test from the output, you should see 
something like:


Jndi(name=MFOBeanRemote) --> Ejb(deployment-id=MFOBean)

if you do, the following should work:

InitialContext initialContext = new InitialContext(properties);
MFO mfo = (MFO) initialContext.lookup("MFOBeanRemote");


I hope I've understood what's going on and been some help, apologies if not!

Cheers

Jon


jooocz wrote:

Good day,
I'm having the same error. I know that some of the users resolved this and I
tried to work with those solutions, also in this blog --
http://qbeukes.blogspot.com/search/label/ejb. But I still get the error. I
hope someone can help me.

I tried the code given by David.
Enumeration ejbJars =
this.getClass().getClassLoader().getResources("META-INF/ejb-jar.xml");
 while (ejbJars.hasMoreElements()) {
 URL url = ejbJars.nextElement();
 System.out.println("app = " + url);
 } 


Here's the output :
app =
jar:file:/home/jocel/Desktop/javalib/openejb-3.1/lib/openejb-core-3.1.jar!/META-INF/ejb-jar.xml
app =
file:/home/jocel/svndostperf1/trunk/PROTOTYPE/ExecutiveSupport4/build/test/classes/META-INF/ejb-jar.xml

Here's my ejb-jar.xml

http://java.sun.com/xml/ns/j2ee";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd";> 



MFOSB
MFOBean
ph.gov.dost.performers.MFOBean
Stateful
Container

MFOBean
Session
ph.gov.dost.performers.MFOBean
ph.gov.dost.performers.MFOBean
edostPerformers-ejb.jar#Mfos






MFO
*

Required




Here's my test, I'm using TestNG 5.8

imports here.

@Test
public void init() throws Exception {
System.out.println("=== init() ===");

 Enumeration ejbJars =

this.getClass().getClassLoader().getResources("META-INF/ejb-jar.xml");
 while (ejbJars.hasMoreElements()) {
 URL url = ejbJars.nextElement();
 System.out.println("app = " + url);
 } 


Properties properties = new Properties();
properties.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.LocalInitialContextFactory");
//properties.setProperty("openejb.deployments.classpath.include",
".*build/test/classes.*"); 

properties.put("openejbDatasoure",

"new://Resource?type=DataSource");
properties.put("openejbDatasoure.JdbcDriver",
"com.mysql.jdbc.Driver");
properties.put("openejbDatasoure.JdbcUrl",
"jdbc:mysql://localhost:3306/dost_performers");
properties.put("openejbDatasoure.UserName", "root");
properties.put("openejbDatasoure.Password", "mysql");

System.getProperties().setProperty("toplink.target-server",

"org.apache.openejb.toplink.openejb.OpenEJBTransactionController");
System.getProperties().setProperty("toplink.ddl-generation",
"create-table");
System.getProperties().setProperty("toplink.logging.level", "INFO");
   
System.getProperties().setProperty("toplink.create-ddl-jdbc-file-name",

"create.sql");
   
System.getProperties().setProperty("toplink.ddl-generation.output-mode",

"both");

System.out.println("=== INITIAL CONTEXT ===");

InitialContext initialContext = new InitialContext(properties);

System.out.println("=== LOOKUP ===");
Mfos mfos = (Mfos) initialContext.lookup("Mfos"); 

mfos.add(new MFO(Long.valueOf(31),"Name 1"));

mfos.add(new MFO(Long.valueOf(23), "Name 2"));

List list = mfos.getMfos();

//assertEquals("List.size() : ", 2, list.size());

for(MFO m : list) {

mfos.remove(m);
}

//assertEquals("Mfos.getMfos : ", 0, mfos.getMfos().size());

}

  

Re: OpenEJB with JUnit from NetBeans: NameNotFoundException

2009-03-16 Thread jooocz

Good day,
I'm having the same error. I know that some of the users resolved this and I
tried to work with those solutions, also in this blog --
http://qbeukes.blogspot.com/search/label/ejb. But I still get the error. I
hope someone can help me.

I tried the code given by David.
Enumeration ejbJars =
this.getClass().getClassLoader().getResources("META-INF/ejb-jar.xml");
 while (ejbJars.hasMoreElements()) {
 URL url = ejbJars.nextElement();
 System.out.println("app = " + url);
 } 

Here's the output :
app =
jar:file:/home/jocel/Desktop/javalib/openejb-3.1/lib/openejb-core-3.1.jar!/META-INF/ejb-jar.xml
app =
file:/home/jocel/svndostperf1/trunk/PROTOTYPE/ExecutiveSupport4/build/test/classes/META-INF/ejb-jar.xml

Here's my ejb-jar.xml

http://java.sun.com/xml/ns/j2ee";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd";> 


MFOSB
MFOBean
ph.gov.dost.performers.MFOBean
Stateful
Container

MFOBean
Session
ph.gov.dost.performers.MFOBean
ph.gov.dost.performers.MFOBean
edostPerformers-ejb.jar#Mfos






MFO
*

Required




Here's my test, I'm using TestNG 5.8

imports here.

@Test
public void init() throws Exception {
System.out.println("=== init() ===");

 Enumeration ejbJars =
this.getClass().getClassLoader().getResources("META-INF/ejb-jar.xml");
 while (ejbJars.hasMoreElements()) {
 URL url = ejbJars.nextElement();
 System.out.println("app = " + url);
 } 

Properties properties = new Properties();
properties.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.LocalInitialContextFactory");
//properties.setProperty("openejb.deployments.classpath.include",
".*build/test/classes.*"); 

properties.put("openejbDatasoure",
"new://Resource?type=DataSource");
properties.put("openejbDatasoure.JdbcDriver",
"com.mysql.jdbc.Driver");
properties.put("openejbDatasoure.JdbcUrl",
"jdbc:mysql://localhost:3306/dost_performers");
properties.put("openejbDatasoure.UserName", "root");
properties.put("openejbDatasoure.Password", "mysql");

System.getProperties().setProperty("toplink.target-server",
"org.apache.openejb.toplink.openejb.OpenEJBTransactionController");
System.getProperties().setProperty("toplink.ddl-generation",
"create-table");
System.getProperties().setProperty("toplink.logging.level", "INFO");
   
System.getProperties().setProperty("toplink.create-ddl-jdbc-file-name",
"create.sql");
   
System.getProperties().setProperty("toplink.ddl-generation.output-mode",
"both");

System.out.println("=== INITIAL CONTEXT ===");
InitialContext initialContext = new InitialContext(properties);

System.out.println("=== LOOKUP ===");
Mfos mfos = (Mfos) initialContext.lookup("Mfos"); 

mfos.add(new MFO(Long.valueOf(31),"Name 1"));
mfos.add(new MFO(Long.valueOf(23), "Name 2"));

List list = mfos.getMfos();
//assertEquals("List.size() : ", 2, list.size());

for(MFO m : list) {
mfos.remove(m);
}

//assertEquals("Mfos.getMfos : ", 0, mfos.getMfos().size());
}

Mfos mfos = (Mfos) initialContext.lookup("Mfos");  is the root cause
of the error. I don't know what to indicate in that lookup.

My attempts :
Mfos mfos = (Mfos) initialContext.lookup("ejb/Mfos");
Mfos mfos = (Mfos) initialContext.lookup("ejb/MfoBean");
Mfos mfos = (Mfos) initialContext.lookup("java:comp/env/Mfos");

Here's the output when I run the file
compile-test-single:
[Parser] Running:
  ph.dost.performers.exec4.test.UserTest

=== init() ===
app =
jar:file:/home/jocel/Desktop/javalib/openejb-3.1/lib/openejb-core-3.1.jar!/META-INF/ejb-jar.xml
app =
file:/home/jocel/svndostperf1/trunk/PROTOTYPE/ExecutiveSupport4/build/test/classes/META-INF/ejb-jar.xml
=== INITIAL CONTEXT ===
Apache OpenEJB 3.1build: 20081009-03:31
http://openejb.apache.org/
INFO - openejb.home =
/home/jocel/svndostperf1/trunk/PROTOTYPE/ExecutiveSupport4
INFO - openejb.base =
/home/jocel/svndostperf1/trunk/PROTOTYPE/ExecutiveSupport4
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=openejbDatasoure, type=Resource,
provider-id=Default JDBC Database)
INFO - Found EjbModul

Re: OpenEJB with JUnit from NetBeans: NameNotFoundException

2008-10-17 Thread Bernhard Humm



David Blevins wrote:
> 
> 
> 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.
> 
> 

Thanks a lot, David,

now I got it working! I had to place the META-INF directory in the src
directory. It must then contain ejb-jar.xml and persistence.xml for using
entity beans and session beans.

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



Re: OpenEJB with JUnit from NetBeans: NameNotFoundException

2008-10-11 Thread franz see

Good day,

The failing copy was extracted on a vfat which was configured to
automatically convert paths to lower cases ( I changed that now ).

Where should that be documented in?

Thanks,
Franz


David Blevins wrote:
> 
> 
> On Oct 11, 2008, at 9:39 AM, franz see wrote:
> 
>>
>> Good day,
>>
>> The script you gave me passed with no problem. And after comparing  
>> with my
>> failing copy, I found out what the reason is.
>>
>> My `meta-inf` were in all small caps, and because of that openejb  
>> failed to
>> detect `META-INF/ejb-jar.xml`.
>>
>> After renaming my `meta-inf` to `META-INF`, the test passes ( except  
>> for
>> simple-webservices ).
> 
> Wow, that's very interesting.  We can probably do a search for both  
> uppercase and lowercase just in case this sort of scenario happens  
> again.  Added a JIRA for that
> http://issues.apache.org/jira/browse/OPENEJB-923
> 
> Do you have any theories on how it got named lowercase meta-inf?   
> Maybe something we can document.
> 
> -David
> 
> 
> 

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



Re: OpenEJB with JUnit from NetBeans: NameNotFoundException

2008-10-11 Thread David Blevins


On Oct 11, 2008, at 9:39 AM, franz see wrote:



Good day,

The script you gave me passed with no problem. And after comparing  
with my

failing copy, I found out what the reason is.

My `meta-inf` were in all small caps, and because of that openejb  
failed to

detect `META-INF/ejb-jar.xml`.

After renaming my `meta-inf` to `META-INF`, the test passes ( except  
for

simple-webservices ).


Wow, that's very interesting.  We can probably do a search for both  
uppercase and lowercase just in case this sort of scenario happens  
again.  Added a JIRA for that http://issues.apache.org/jira/browse/OPENEJB-923


Do you have any theories on how it got named lowercase meta-inf?   
Maybe something we can document.


-David



Re: OpenEJB with JUnit from NetBeans: NameNotFoundException

2008-10-11 Thread franz see

Good day,

The script you gave me passed with no problem. And after comparing with my
failing copy, I found out what the reason is. 

My `meta-inf` were in all small caps, and because of that openejb failed to
detect `META-INF/ejb-jar.xml`.

After renaming my `meta-inf` to `META-INF`, the test passes ( except for
simple-webservices ).

Thanks,
Franz


David Blevins wrote:
> 
> 
> On Oct 9, 2008, at 9:42 PM, franz see wrote:
> 
>>
>> 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.
>>
> 
> That solution definitely works and is the way you get a module  
> discovered when there is no simple-stateless/target/classes/META-INF/ 
> ejb-jar.xml file.
> 
> I ran the 3.0 examples against various Java 1.5.0_x versions on maven  
> 2.0.8 with a clean repo on FreeBSD 6.2, Linux 2.6.24, and OSX 10.5.4  
> and all ran fine except the simple-webservices test on FreeBSD.
> 
> Can you run this little script and attach the output (build.log) to  
> the jira you created?
> 
> ---begin---
> #!/bin/bash
> 
> {
> 
> wget -q
> http://archive.apache.org/dist/maven/binaries/apache-maven-2.0.8-bin.tar.gz
> wget -q http://www.apache.org/dist/openejb/3.0/openejb-examples-3.0.tar.gz
> 
> tar xzf apache-maven-2.0.8-bin.tar.gz
> tar xzf openejb-examples-3.0.tar.gz
> 
> cd openejb-examples-3.0/simple-stateless
> 
> uname -a
> ../../apache-maven-2.0.8/bin/mvn -X -Dmaven.repo.local=tmp clean install
> 
> } | tee build.log
> ---end---
> 
> 
> -David
> 
> 
> 
> 
> 
> 
> 

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



Re: OpenEJB with JUnit from NetBeans: NameNotFoundException

2008-10-10 Thread David Blevins


On Oct 9, 2008, at 9:42 PM, franz see wrote:



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.



That solution definitely works and is the way you get a module  
discovered when there is no simple-stateless/target/classes/META-INF/ 
ejb-jar.xml file.


I ran the 3.0 examples against various Java 1.5.0_x versions on maven  
2.0.8 with a clean repo on FreeBSD 6.2, Linux 2.6.24, and OSX 10.5.4  
and all ran fine except the simple-webservices test on FreeBSD.


Can you run this little script and attach the output (build.log) to  
the jira you created?


---begin---
#!/bin/bash

{

wget -q 
http://archive.apache.org/dist/maven/binaries/apache-maven-2.0.8-bin.tar.gz
wget -q http://www.apache.org/dist/openejb/3.0/openejb-examples-3.0.tar.gz

tar xzf apache-maven-2.0.8-bin.tar.gz
tar xzf openejb-examples-3.0.tar.gz

cd openejb-examples-3.0/simple-stateless

uname -a
../../apache-maven-2.0.8/bin/mvn -X -Dmaven.repo.local=tmp clean install

} | tee build.log
---end---


-David







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 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: 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: OpenEJB with JUnit from NetBeans: NameNotFoundException

2008-10-08 Thread Bernhard Humm

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



David Blevins wrote:
> 
> 
> Instead of using the ant build.xml in NetBeans, try having NetBeans  
> run the test case directly.
> 
> -David
> 
> 

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



Re: OpenEJB with JUnit from NetBeans: NameNotFoundException

2008-10-08 Thread David Blevins

On Oct 8, 2008, at 3:26 AM, Bernhard Humm wrote:



I am trying to use OpenEJB with JUnit from NetBeans IDE. This is  
what I have

done:

1. Download openejb-3.0.zip and openejb-examples-3.0.zip from
openejb.apache.org and unzip.
2. Open new NetBeans Java Project with Existing Sources (source and  
test

directories from openejb-examples)
3. Add openejb-3.0/lib/* as source and test libraries (also needs  
libs as

source libraries for compilation
4. Execute build.xml (default)

The project is being built and the JUnit tests start running.  
However, I get
an javax.naming.NameNotFoundException for all EJBs. The EJBs seem  
not to be

registered in the name server. Providing an JNDI name using
(MappedName="...") does not help either.



Instead of using the ant build.xml in NetBeans, try having NetBeans  
run the test case directly.


-David




OpenEJB with JUnit from NetBeans: NameNotFoundException

2008-10-08 Thread Bernhard Humm

I am trying to use OpenEJB with JUnit from NetBeans IDE. This is what I have
done:

1. Download openejb-3.0.zip and openejb-examples-3.0.zip from
openejb.apache.org and unzip.
2. Open new NetBeans Java Project with Existing Sources (source and test
directories from openejb-examples)
3. Add openejb-3.0/lib/* as source and test libraries (also needs libs as
source libraries for compilation
4. Execute build.xml (default)

The project is being built and the JUnit tests start running. However, I get
an javax.naming.NameNotFoundException for all EJBs. The EJBs seem not to be
registered in the name server. Providing an JNDI name using
(MappedName="...") does not help either.

What can I do?

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