You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Bernhard Humm <b....@fbi.h-da.de> on 2008/10/08 10:26:35 UTC

OpenEJB with JUnit from NetBeans: NameNotFoundException

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.


Re: OpenEJB with JUnit from NetBeans: NameNotFoundException

Posted by Bernhard Humm <b....@fbi.h-da.de>.


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

Posted by jooocz <jo...@gmail.com>.
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

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<ejb-jar xmlns="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">
  <enterprise-beans>
    <session>
      <display-name>UserAccountFacade</display-name>
      <ejb-name>UserAccountFacade</ejb-name>
     
<business-remote>ph.gov.dost.performers.session.UserAccountFacadeRemote</business-remote>
     
<ejb-class>ph.gov.dost.performers.session.UserAccountFacade</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
      <persistence-context-ref>
       
<persistence-context-ref-name>ph.gov.dost.performers.session.UserAccountFacade/em</persistence-context-ref-name>
        <persistence-unit-name>edostPerformers-ejbPU</persistence-unit-name>
        <persistence-context-type>Transaction</persistence-context-type>
        <injection-target>
         
<injection-target-class>ph.gov.dost.performers.session.UserAccountFacade</injection-target-class>
          <injection-target-name>em</injection-target-name>
        </injection-target>
      </persistence-context-ref>
      <security-identity>
        <use-caller-identity/>
      </security-identity>
    </session>
    <session>
      <display-name>DostGroupFacade</display-name>
      <ejb-name>DostGroupFacade</ejb-name>
     
<business-remote>ph.gov.dost.performers.session.DostGroupFacadeRemote</business-remote>
      <ejb-class>ph.gov.dost.performers.session.DostGroupFacade</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
      <persistence-context-ref>
       
<persistence-context-ref-name>ph.gov.dost.performers.session.DostGroupFacade/em</persistence-context-ref-name>
        <persistence-unit-name>edostPerformers-ejbPU</persistence-unit-name>
        <persistence-context-type>Transaction</persistence-context-type>
        <injection-target>
         
<injection-target-class>ph.gov.dost.performers.session.DostGroupFacade</injection-target-class>
          <injection-target-name>em</injection-target-name>
        </injection-target>
      </persistence-context-ref>
      <security-identity>
        <use-caller-identity/>
      </security-identity>
    </session>
    <session>
      <display-name>PerformersLogFacade</display-name>
      <ejb-name>PerformersLogFacade</ejb-name>
     
<business-remote>ph.gov.dost.performers.session.PerformersLogFacadeRemote</business-remote>
     
<ejb-class>ph.gov.dost.performers.session.PerformersLogFacade</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
      <resource-env-ref>
       
<resource-env-ref-name>ph.gov.dost.performers.session.PerformersLogFacade/ctx</resource-env-ref-name>
       
<resource-env-ref-type>javax.ejb.SessionContext</resource-env-ref-type>
        <injection-target>
         
<injection-target-class>ph.gov.dost.performers.session.PerformersLogFacade</injection-target-class>
          <injection-target-name>ctx</injection-target-name>
        </injection-target>
      </resource-env-ref>
      <persistence-context-ref>
       
<persistence-context-ref-name>ph.gov.dost.performers.session.PerformersLogFacade/em</persistence-context-ref-name>
        <persistence-unit-name>edostPerformers-ejbPU</persistence-unit-name>
        <persistence-context-type>Transaction</persistence-context-type>
        <injection-target>
         
<injection-target-class>ph.gov.dost.performers.session.PerformersLogFacade</injection-target-class>
          <injection-target-name>em</injection-target-name>
        </injection-target>
      </persistence-context-ref>
      <security-identity>
        <use-caller-identity/>
      </security-identity>
    </session>
    <session>
      <display-name>BudgetMatrixBean</display-name>
      <ejb-name>BudgetMatrixBean</ejb-name>
     
<business-remote>ph.gov.dost.performers.session.BudgetMatrixRemote</business-remote>
      <ejb-class>ph.gov.dost.performers.session.BudgetMatrixBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
      <resource-env-ref>
       
<resource-env-ref-name>ph.gov.dost.performers.session.BudgetMatrixBean/ctx</resource-env-ref-name>
       
<resource-env-ref-type>javax.ejb.SessionContext</resource-env-ref-type>
        <injection-target>
         
<injection-target-class>ph.gov.dost.performers.session.BudgetMatrixBean</injection-target-class>
          <injection-target-name>ctx</injection-target-name>
        </injection-target>
      </resource-env-ref>
      <persistence-context-ref>
       
<persistence-context-ref-name>ph.gov.dost.performers.session.BudgetMatrixBean/em</persistence-context-ref-name>
        <persistence-unit-name>edostPerformers-ejbPU</persistence-unit-name>
        <persistence-context-type>Transaction</persistence-context-type>
        <injection-target>
         
<injection-target-class>ph.gov.dost.performers.session.BudgetMatrixBean</injection-target-class>
          <injection-target-name>em</injection-target-name>
        </injection-target>
      </persistence-context-ref>
      <security-identity>
        <use-caller-identity/>
      </security-identity>
    </session>
  </enterprise-beans>
  <assembly-descriptor>
    <security-role>
      <role-name>Admin</role-name>
    </security-role>
    <security-role>
      <role-name>AgencyRep</role-name>
    </security-role>
    <security-role>
      <role-name>ExecutiveRep</role-name>
    </security-role>
  </assembly-descriptor>
</ejb-jar>

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

Posted by David Blevins <da...@visi.com>.
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:
>
> <session>
>           <display-name>MFOSB</display-name>
>           <ejb-name>MFOBean</ejb-name>
>           <ejb-class>ph.gov.dost.performers.MFOBean</ejb-class>
>           <session-type>Stateful</session-type>
>           <transaction-type>Container</transaction-type>
>           <ejb-local-ref>
>               <ejb-ref-name>MFOBean</ejb-ref-name>
>               <ejb-ref-type>Session</ejb-ref-type>
>               <local-home>ph.gov.dost.performers.MFOBean</local-home>
>               <local>ph.gov.dost.performers.MFOBean</local>
>               <ejb-link>edostPerformers-ejb.jar#Mfos</ejb-link>
>           </ejb-local-ref>
>       </session>
>
> I'm not sure you need the <ejb-local-ref> 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<URL> 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
>> <?xml version="1.0" encoding="UTF-8"?>
>> <ejb-jar version="2.1" xmlns="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"> <enterprise-beans>
>>        <session>
>>            <display-name>MFOSB</display-name>
>>            <ejb-name>MFOBean</ejb-name>
>>            <ejb-class>ph.gov.dost.performers.MFOBean</ejb-class>
>>            <session-type>Stateful</session-type>
>>            <transaction-type>Container</transaction-type>
>>            <ejb-local-ref>
>>                <ejb-ref-name>MFOBean</ejb-ref-name>
>>                <ejb-ref-type>Session</ejb-ref-type>
>>                <local-home>ph.gov.dost.performers.MFOBean</local- 
>> home>
>>                <local>ph.gov.dost.performers.MFOBean</local>
>>                <ejb-link>edostPerformers-ejb.jar#Mfos</ejb-link>
>>            </ejb-local-ref>
>>        </session>
>>        </enterprise-beans>
>>    <assembly-descriptor>
>>        <container-transaction>
>>            <method>
>>                <ejb-name>MFO</ejb-name>
>>                <method-name>*</method-name>
>>            </method>
>>            <trans-attribute>Required</trans-attribute>
>>        </container-transaction>
>>        </assembly-descriptor>
>>    </ejb-jar>
>>
>> Here's my test, I'm using TestNG 5.8
>>
>> imports here.....
>>
>>    @Test
>>    public void init() throws Exception {
>>        System.out.println("======= init() =======");
>>                 Enumeration<URL> 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<MFO> 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.1    build: 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 EjbModule in classpath:
>> /home/jocel/svndostperf1/trunk/PROTOTYPE/ExecutiveSupport4/build/ 
>> test/classes
>> INFO - Found PersistenceModule in classpath:
>> /home/jocel/svndostperf1/trunk/PROTOTYPE/ExecutiveSupport4/build/ 
>> web/WEB-INF/classes
>> INFO - Found PersistenceModule in classpath:
>> /home/jocel/svndostperf1/trunk/PROTOTYPE/edostPerformers/ 
>> edostPerformers-ejb/dist/edostPerformers-ejb.jar
>> INFO - Beginning load:
>> /home/jocel/svndostperf1/trunk/PROTOTYPE/ExecutiveSupport4/build/ 
>> test/classes
>> INFO - Beginning load:
>> /home/jocel/svndostperf1/trunk/PROTOTYPE/ExecutiveSupport4/build/ 
>> web/WEB-INF/classes
>> INFO - Beginning load:
>> /home/jocel/svndostperf1/trunk/PROTOTYPE/edostPerformers/ 
>> edostPerformers-ejb/dist/edostPerformers-ejb.jar
>> INFO - Configuring enterprise application: classpath.ear
>> INFO - Configuring Service(id=Default Stateful Container,  
>> type=Container,
>> provider-id=Default Stateful Container)
>> INFO - Auto-creating a container for bean MFOBean:  
>> Container(type=STATEFUL,
>> id=Default Stateful Container)
>> INFO - Configuring Service(id=Default Stateless Container,  
>> type=Container,
>> provider-id=Default Stateless Container)
>> INFO - Auto-creating a container for bean BudgetMatrixBean:
>> Container(type=STATELESS, id=Default Stateless Container)
>> INFO - Configuring PersistenceUnit(name=ExecutiveSupport4PU,
>> provider 
>> =oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider)
>> INFO - Auto-creating a Resource with id 'openejbDatasoureNonJta' of  
>> type
>> 'DataSource for 'ExecutiveSupport4PU'.
>> INFO - Configuring Service(id=openejbDatasoureNonJta, type=Resource,
>> provider-id=openejbDatasoure)
>> INFO - Adjusting ExecutiveSupport4PU <jta-data-source> to  
>> 'openejbDatasoure'
>> INFO - Adjusting ExecutiveSupport4PU <non-jta-data-source> to
>> 'openejbDatasoureNonJta'
>> INFO - Configuring PersistenceUnit(name=ExecutiveSupport4PU,
>> provider 
>> =oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider)
>> INFO - Adjusting ExecutiveSupport4PU <jta-data-source> to  
>> 'openejbDatasoure'
>> INFO - Adjusting ExecutiveSupport4PU <non-jta-data-source> to
>> 'openejbDatasoureNonJta'
>> INFO - Configuring PersistenceUnit(name=edostPerformers-ejbPU)
>> INFO - Adjusting edostPerformers-ejbPU <jta-data-source> to
>> 'openejbDatasoure'
>> INFO - Adjusting edostPerformers-ejbPU <non-jta-data-source> to
>> 'openejbDatasoureNonJta'
>> ERROR - FAIL ... ContainerTransaction:	Referenced EJB does not  
>> exist: MFO on
>> method "*".
>> ERROR - Invalid
>> EjbModule(path=/home/jocel/svndostperf1/trunk/PROTOTYPE/ 
>> ExecutiveSupport4/build/test/classes)
>> 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 - Invalid
>> EjbModule(path=/home/jocel/svndostperf1/trunk/PROTOTYPE/ 
>> edostPerformers/edostPerformers-ejb/dist/edostPerformers-ejb.jar)
>> INFO - Set the 'openejb.validation.output.level' system property to  
>> VERBOSE
>> for increased validation details.
>> WARN - Jar not loaded. classpath.ear.  Module failed validation.
>> AppModule(path=classpath.ear)
>> ======= LOOKUP =======
>>
>> ===============================================
>> ph.dost.performers.exec4.test.UserTest
>> Total tests run: 1, Failures: 1, Skips: 0
>> ===============================================
>>
>> Java Result: 1
>> View test results in build/test/results/index.html
>>
>> /home/jocel/svndostperf1/trunk/PROTOTYPE/ExecutiveSupport4/ 
>> nbproject/build-impl.xml:878:
>> Some tests failed; see details above.
>> BUILD FAILED (total time: 6 seconds)
>>
>> Here's the structure of my EAR project in Netbeans
>>
>> edostPerformers-ejb
>> -- src
>>  -- dost.performers
>>       -- MFO.java
>>       -- MFOBean.java
>>       -- Mfos.java
>> ExecutiveSupport4 -- src
>>   -- dost.exec
>>       -- MFOController.java
>> -- test
>>  -- dost.exec
>>       -- UserTest.java
>>  -- resources
>>     -- META-INF
>>       -- ejb-jar.xml
>>       -- persistence.xml
>>
>>
>> franz see wrote:
>>
>>> 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
>>>>
>>>>
>>>>
>>>>
>>>
>>
>>


Re: OpenEJB with JUnit from NetBeans: NameNotFoundException

Posted by Jonathan Gallimore <jo...@gmail.com>.
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:

<session>
            <display-name>MFOSB</display-name>
            <ejb-name>MFOBean</ejb-name>
            <ejb-class>ph.gov.dost.performers.MFOBean</ejb-class>
            <session-type>Stateful</session-type>
            <transaction-type>Container</transaction-type>
            <ejb-local-ref>
                <ejb-ref-name>MFOBean</ejb-ref-name>
                <ejb-ref-type>Session</ejb-ref-type>
                <local-home>ph.gov.dost.performers.MFOBean</local-home>
                <local>ph.gov.dost.performers.MFOBean</local>
                <ejb-link>edostPerformers-ejb.jar#Mfos</ejb-link>
            </ejb-local-ref>
        </session>

I'm not sure you need the <ejb-local-ref> 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<URL> 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
> <?xml version="1.0" encoding="UTF-8"?>
> <ejb-jar version="2.1" xmlns="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"> 
> <enterprise-beans>
>         <session>
>             <display-name>MFOSB</display-name>
>             <ejb-name>MFOBean</ejb-name>
>             <ejb-class>ph.gov.dost.performers.MFOBean</ejb-class>
>             <session-type>Stateful</session-type>
>             <transaction-type>Container</transaction-type>
>             <ejb-local-ref>
>                 <ejb-ref-name>MFOBean</ejb-ref-name>
>                 <ejb-ref-type>Session</ejb-ref-type>
>                 <local-home>ph.gov.dost.performers.MFOBean</local-home>
>                 <local>ph.gov.dost.performers.MFOBean</local>
>                 <ejb-link>edostPerformers-ejb.jar#Mfos</ejb-link>
>             </ejb-local-ref>
>         </session>
>         </enterprise-beans>
>     <assembly-descriptor>
>         <container-transaction>
>             <method>
>                 <ejb-name>MFO</ejb-name>
>                 <method-name>*</method-name>
>             </method>
>             <trans-attribute>Required</trans-attribute>
>         </container-transaction>
>         </assembly-descriptor>
>     </ejb-jar>
>
> Here's my test, I'm using TestNG 5.8
>
> imports here.....
>
>     @Test
>     public void init() throws Exception {
>         System.out.println("======= init() =======");
>         
>          Enumeration<URL> 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<MFO> 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.1    build: 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 EjbModule in classpath:
> /home/jocel/svndostperf1/trunk/PROTOTYPE/ExecutiveSupport4/build/test/classes
> INFO - Found PersistenceModule in classpath:
> /home/jocel/svndostperf1/trunk/PROTOTYPE/ExecutiveSupport4/build/web/WEB-INF/classes
> INFO - Found PersistenceModule in classpath:
> /home/jocel/svndostperf1/trunk/PROTOTYPE/edostPerformers/edostPerformers-ejb/dist/edostPerformers-ejb.jar
> INFO - Beginning load:
> /home/jocel/svndostperf1/trunk/PROTOTYPE/ExecutiveSupport4/build/test/classes
> INFO - Beginning load:
> /home/jocel/svndostperf1/trunk/PROTOTYPE/ExecutiveSupport4/build/web/WEB-INF/classes
> INFO - Beginning load:
> /home/jocel/svndostperf1/trunk/PROTOTYPE/edostPerformers/edostPerformers-ejb/dist/edostPerformers-ejb.jar
> INFO - Configuring enterprise application: classpath.ear
> INFO - Configuring Service(id=Default Stateful Container, type=Container,
> provider-id=Default Stateful Container)
> INFO - Auto-creating a container for bean MFOBean: Container(type=STATEFUL,
> id=Default Stateful Container)
> INFO - Configuring Service(id=Default Stateless Container, type=Container,
> provider-id=Default Stateless Container)
> INFO - Auto-creating a container for bean BudgetMatrixBean:
> Container(type=STATELESS, id=Default Stateless Container)
> INFO - Configuring PersistenceUnit(name=ExecutiveSupport4PU,
> provider=oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider)
> INFO - Auto-creating a Resource with id 'openejbDatasoureNonJta' of type
> 'DataSource for 'ExecutiveSupport4PU'.
> INFO - Configuring Service(id=openejbDatasoureNonJta, type=Resource,
> provider-id=openejbDatasoure)
> INFO - Adjusting ExecutiveSupport4PU <jta-data-source> to 'openejbDatasoure'
> INFO - Adjusting ExecutiveSupport4PU <non-jta-data-source> to
> 'openejbDatasoureNonJta'
> INFO - Configuring PersistenceUnit(name=ExecutiveSupport4PU,
> provider=oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider)
> INFO - Adjusting ExecutiveSupport4PU <jta-data-source> to 'openejbDatasoure'
> INFO - Adjusting ExecutiveSupport4PU <non-jta-data-source> to
> 'openejbDatasoureNonJta'
> INFO - Configuring PersistenceUnit(name=edostPerformers-ejbPU)
> INFO - Adjusting edostPerformers-ejbPU <jta-data-source> to
> 'openejbDatasoure'
> INFO - Adjusting edostPerformers-ejbPU <non-jta-data-source> to
> 'openejbDatasoureNonJta'
> ERROR - FAIL ... ContainerTransaction:	Referenced EJB does not exist: MFO on
> method "*".
> ERROR - Invalid
> EjbModule(path=/home/jocel/svndostperf1/trunk/PROTOTYPE/ExecutiveSupport4/build/test/classes)
> 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 - Invalid
> EjbModule(path=/home/jocel/svndostperf1/trunk/PROTOTYPE/edostPerformers/edostPerformers-ejb/dist/edostPerformers-ejb.jar)
> INFO - Set the 'openejb.validation.output.level' system property to VERBOSE
> for increased validation details.
> WARN - Jar not loaded. classpath.ear.  Module failed validation.
> AppModule(path=classpath.ear)
> ======= LOOKUP =======
>
> ===============================================
> ph.dost.performers.exec4.test.UserTest
> Total tests run: 1, Failures: 1, Skips: 0
> ===============================================
>
> Java Result: 1
> View test results in build/test/results/index.html
>
> /home/jocel/svndostperf1/trunk/PROTOTYPE/ExecutiveSupport4/nbproject/build-impl.xml:878:
> Some tests failed; see details above.
> BUILD FAILED (total time: 6 seconds)
>
> Here's the structure of my EAR project in Netbeans
>
> edostPerformers-ejb
> -- src
>   -- dost.performers
>        -- MFO.java
>        -- MFOBean.java
>        -- Mfos.java
> ExecutiveSupport4 
> -- src
>    -- dost.exec
>        -- MFOController.java
> -- test
>   -- dost.exec
>        -- UserTest.java
>   -- resources
>      -- META-INF
>        -- ejb-jar.xml
>        -- persistence.xml
>    
>
>
> franz see wrote:
>   
>> 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
>>>
>>>
>>>
>>>       
>>     
>
>   

Re: OpenEJB with JUnit from NetBeans: NameNotFoundException

Posted by jooocz <jo...@gmail.com>.
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<URL> 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
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar version="2.1" xmlns="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"> 
<enterprise-beans>
        <session>
            <display-name>MFOSB</display-name>
            <ejb-name>MFOBean</ejb-name>
            <ejb-class>ph.gov.dost.performers.MFOBean</ejb-class>
            <session-type>Stateful</session-type>
            <transaction-type>Container</transaction-type>
            <ejb-local-ref>
                <ejb-ref-name>MFOBean</ejb-ref-name>
                <ejb-ref-type>Session</ejb-ref-type>
                <local-home>ph.gov.dost.performers.MFOBean</local-home>
                <local>ph.gov.dost.performers.MFOBean</local>
                <ejb-link>edostPerformers-ejb.jar#Mfos</ejb-link>
            </ejb-local-ref>
        </session>
        </enterprise-beans>
    <assembly-descriptor>
        <container-transaction>
            <method>
                <ejb-name>MFO</ejb-name>
                <method-name>*</method-name>
            </method>
            <trans-attribute>Required</trans-attribute>
        </container-transaction>
        </assembly-descriptor>
    </ejb-jar>

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

imports here.....

    @Test
    public void init() throws Exception {
        System.out.println("======= init() =======");
        
         Enumeration<URL> 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<MFO> 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.1    build: 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 EjbModule in classpath:
/home/jocel/svndostperf1/trunk/PROTOTYPE/ExecutiveSupport4/build/test/classes
INFO - Found PersistenceModule in classpath:
/home/jocel/svndostperf1/trunk/PROTOTYPE/ExecutiveSupport4/build/web/WEB-INF/classes
INFO - Found PersistenceModule in classpath:
/home/jocel/svndostperf1/trunk/PROTOTYPE/edostPerformers/edostPerformers-ejb/dist/edostPerformers-ejb.jar
INFO - Beginning load:
/home/jocel/svndostperf1/trunk/PROTOTYPE/ExecutiveSupport4/build/test/classes
INFO - Beginning load:
/home/jocel/svndostperf1/trunk/PROTOTYPE/ExecutiveSupport4/build/web/WEB-INF/classes
INFO - Beginning load:
/home/jocel/svndostperf1/trunk/PROTOTYPE/edostPerformers/edostPerformers-ejb/dist/edostPerformers-ejb.jar
INFO - Configuring enterprise application: classpath.ear
INFO - Configuring Service(id=Default Stateful Container, type=Container,
provider-id=Default Stateful Container)
INFO - Auto-creating a container for bean MFOBean: Container(type=STATEFUL,
id=Default Stateful Container)
INFO - Configuring Service(id=Default Stateless Container, type=Container,
provider-id=Default Stateless Container)
INFO - Auto-creating a container for bean BudgetMatrixBean:
Container(type=STATELESS, id=Default Stateless Container)
INFO - Configuring PersistenceUnit(name=ExecutiveSupport4PU,
provider=oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider)
INFO - Auto-creating a Resource with id 'openejbDatasoureNonJta' of type
'DataSource for 'ExecutiveSupport4PU'.
INFO - Configuring Service(id=openejbDatasoureNonJta, type=Resource,
provider-id=openejbDatasoure)
INFO - Adjusting ExecutiveSupport4PU <jta-data-source> to 'openejbDatasoure'
INFO - Adjusting ExecutiveSupport4PU <non-jta-data-source> to
'openejbDatasoureNonJta'
INFO - Configuring PersistenceUnit(name=ExecutiveSupport4PU,
provider=oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider)
INFO - Adjusting ExecutiveSupport4PU <jta-data-source> to 'openejbDatasoure'
INFO - Adjusting ExecutiveSupport4PU <non-jta-data-source> to
'openejbDatasoureNonJta'
INFO - Configuring PersistenceUnit(name=edostPerformers-ejbPU)
INFO - Adjusting edostPerformers-ejbPU <jta-data-source> to
'openejbDatasoure'
INFO - Adjusting edostPerformers-ejbPU <non-jta-data-source> to
'openejbDatasoureNonJta'
ERROR - FAIL ... ContainerTransaction:	Referenced EJB does not exist: MFO on
method "*".
ERROR - Invalid
EjbModule(path=/home/jocel/svndostperf1/trunk/PROTOTYPE/ExecutiveSupport4/build/test/classes)
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 - Invalid
EjbModule(path=/home/jocel/svndostperf1/trunk/PROTOTYPE/edostPerformers/edostPerformers-ejb/dist/edostPerformers-ejb.jar)
INFO - Set the 'openejb.validation.output.level' system property to VERBOSE
for increased validation details.
WARN - Jar not loaded. classpath.ear.  Module failed validation.
AppModule(path=classpath.ear)
======= LOOKUP =======

===============================================
ph.dost.performers.exec4.test.UserTest
Total tests run: 1, Failures: 1, Skips: 0
===============================================

Java Result: 1
View test results in build/test/results/index.html

/home/jocel/svndostperf1/trunk/PROTOTYPE/ExecutiveSupport4/nbproject/build-impl.xml:878:
Some tests failed; see details above.
BUILD FAILED (total time: 6 seconds)

Here's the structure of my EAR project in Netbeans

edostPerformers-ejb
-- src
  -- dost.performers
       -- MFO.java
       -- MFOBean.java
       -- Mfos.java
ExecutiveSupport4 
-- src
   -- dost.exec
       -- MFOController.java
-- test
  -- dost.exec
       -- UserTest.java
  -- resources
     -- META-INF
       -- ejb-jar.xml
       -- persistence.xml
   


franz see wrote:
> 
> 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-tp19874503p22534364.html
Sent from the OpenEJB User mailing list archive at Nabble.com.


Re: OpenEJB with JUnit from NetBeans: NameNotFoundException

Posted by franz see <fr...@gmail.com>.
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

Posted by David Blevins <da...@visi.com>.
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

Posted by franz see <fr...@gmail.com>.
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

Posted by David Blevins <da...@visi.com>.
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

Posted by franz see <fr...@gmail.com>.
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:
> 
> 
>> <?xml version="1.0" encoding="UTF-8" ?>
>> <testsuite errors="2" skipped="0" tests="2" time="1.075" failures="0"
>> name="org.superbiz.calculator.CalculatorTest">
>>   <properties>
>>     <property value="3.0" name="openejb.version"/>
>>     <property value="Java(TM) 2 Runtime Environment, Standard Edition"
>> name="java.runtime.name"/>
>>     <property value="/usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386"
>> name="sun.boot.library.path"/>
>>     <property value="1.5.0_15-b04" name="java.vm.version"/>
>>     <property value="Sun Microsystems Inc." name="java.vm.vendor"/>
>>     <property value="http://java.sun.com/" name="java.vendor.url"/>
>>     <property value=":" name="path.separator"/>
>>     <property value="Java HotSpot(TM) Server VM" name="java.vm.name"/>
>>     <property value="sun.io" name="file.encoding.pkg"/>
>>     <property
>> value="org.apache.openejb.core.security.JaccProvider$Factory"
>> name="javax.security.jacc.PolicyConfigurationFactory.provider"/>
>>     <property value="PH" name="user.country"/>
>>     <property value="SUN_STANDARD" name="sun.java.launcher"/>
>>     <property value="unknown" name="sun.os.patch.level"/>
>>     <property value="Java Virtual Machine Specification"
>> name="java.vm.specification.name"/>
>>     <property
>> value="/home/franz/src/openejb-examples-3.0/simple-stateless"
>> name="user.dir"/>
>>     <property value="1.5.0_15-b04" name="java.runtime.version"/>
>>     <property
>> value="/home/franz/src/openejb-examples-3.0/simple-stateless"
>> name="derby.system.home"/>
>>     <property value="sun.awt.X11GraphicsEnvironment"
>> name="java.awt.graphicsenv"/>
>>     <property
>> value="/home/franz/src/openejb-examples-3.0/simple-stateless"
>> name="basedir"/>
>>     <property
>> value="/usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/endorsed"
>> name="java.endorsed.dirs"/>
>>     <property value="i386" name="os.arch"/>
>>     <property value="/tmp/surefirebooter58049.jar"
>> name="surefire.real.class.path"/>
>>     <property value="/tmp" name="java.io.tmpdir"/>
>>     <property value="
>> " name="line.separator"/>
>>     <property value="Sun Microsystems Inc."
>> name="java.vm.specification.vendor"/>
>>     <property value="org.apache.openejb.core.ivm.naming"
>> name="java.naming.factory.url.pkgs"/>
>>     <property value="Linux" name="os.name"/>
>>     <property value="true" name="derby.storage.fileSyncTransactionLog"/>
>>     <property value="UTF-8" name="sun.jnu.encoding"/>
>>     <property
>> 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"/>
>>     <property
>> 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"/>
>>     <property value="Java Platform API Specification"
>> name="java.specification.name"/>
>>     <property value="49.0" name="java.class.version"/>
>>     <property value="HotSpot Server Compiler"
>> name="sun.management.compiler"/>
>>     <property value="2.6.24-19-generic" name="os.version"/>
>>     <property value="/home/franz" name="user.home"/>
>>     <property value="Asia/Manila" name="user.timezone"/>
>>     <property value="sun.print.PSPrinterJob" name="java.awt.printerjob"/>
>>     <property value="1.5" name="java.specification.version"/>
>>     <property value="UTF-8" name="file.encoding"/>
>>     <property value="franz" name="user.name"/>
>>     <property
>> 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="java.class.path"/>
>>     <property value="log4j" name="openjpa.Log"/>
>>     <property value="true" name="noBanner"/>
>>     <property value="1.0" name="java.vm.specification.version"/>
>>     <property value="32" name="sun.arch.data.model"/>
>>     <property value="/usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre"
>> name="java.home"/>
>>     <property value="Sun Microsystems Inc."
>> name="java.specification.vendor"/>
>>     <property value="en" name="user.language"/>
>>     <property value="mixed mode" name="java.vm.info"/>
>>     <property value="1.5.0_15" name="java.version"/>
>>     <property
>> value="org.apache.openejb.core.security.jacc.BasicJaccProvider"
>> name="org.apache.openejb.core.security.JaccProvider"/>
>>     <property value="/usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/ext"
>> name="java.ext.dirs"/>
>>     <property
>> value="/usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/rt.jar:/usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i18n.jar:/usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/jsse.jar:/usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/jce.jar:/usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/charsets.jar:/usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/classes"
>> name="sun.boot.class.path"/>
>>     <property value="Sun Microsystems Inc." name="java.vendor"/>
>>     <property
>> value="jar:file:/shared/apps/.m2/repository/org/apache/openejb/openejb-core/3.0/openejb-core-3.0.jar!/login.config"
>> name="java.security.auth.login.config"/>
>>     <property value="/shared/apps/.m2/repository"
>> name="localRepository"/>
>>     <property value="/" name="file.separator"/>
>>     <property value="http://java.sun.com/cgi-bin/bugreport.cgi"
>> name="java.vendor.url.bug"/>
>>     <property value="little" name="sun.cpu.endian"/>
>>     <property value="UnicodeLittle" name="sun.io.unicode.encoding"/>
>>     <property value="gnome" name="sun.desktop"/>
>>     <property value="" name="sun.cpu.isalist"/>
>>   </properties>
>>   <testcase classname="org.superbiz.calculator.CalculatorTest"
>> time="1.039" name="testCalculatorViaRemoteInterface">
>>     <error type="javax.naming.NameNotFoundException" message="Name
>> &quot;CalculatorImplRemote&quot; not
>> found.">javax.naming.NameNotFoundException: Name
>> &quot;CalculatorImplRemote&quot; 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:351)
>> 	at
>> org.superbiz.calculator.CalculatorTest.testCalculatorViaRemoteInterface(CalculatorTest.java:55)
>> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> 	at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>> 	at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> 	at java.lang.reflect.Method.invoke(Method.java:585)
>> 	at junit.framework.TestCase.runTest(TestCase.java:164)
>> 	at junit.framework.TestCase.runBare(TestCase.java:130)
>> 	at junit.framework.TestResult$1.protect(TestResult.java:110)
>> 	at junit.framework.TestResult.runProtected(TestResult.java:128)
>> 	at junit.framework.TestResult.run(TestResult.java:113)
>> 	at junit.framework.TestCase.run(TestCase.java:120)
>> 	at junit.framework.TestSuite.runTest(TestSuite.java:228)
>> 	at junit.framework.TestSuite.run(TestSuite.java:223)
>> 	at
>> org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:35)
>> 	at
>> org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
>> 	at
>> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
>> 	at
>> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
>> 	at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
>> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> 	at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>> 	at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> 	at java.lang.reflect.Method.invoke(Method.java:585)
>> 	at
>> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
>> 	at
>> org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
>> </error>
>>     <system-out>Apache OpenEJB 3.0    build: 20080408-04:13
>> http://openejb.apache.org/
>> INFO - openejb.home =
>> /home/franz/src/openejb-examples-3.0/simple-stateless
>> INFO - openejb.base =
>> /home/franz/src/openejb-examples-3.0/simple-stateless
>> 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)
>> app =
>> jar:file:/shared/apps/.m2/repository/org/apache/openejb/openejb-core/3.0/openejb-core-3.0.jar!/META-INF/ejb-jar.xml
>> </system-out>
>>   </testcase>
>>   <testcase classname="org.superbiz.calculator.CalculatorTest"
>> time="0.001" name="testCalculatorViaLocalInterface">
>>     <error type="javax.naming.NameNotFoundException" message="Name
>> &quot;CalculatorImplLocal&quot; not
>> found.">javax.naming.NameNotFoundException: Name
>> &quot;CalculatorImplLocal&quot; 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:351)
>> 	at
>> org.superbiz.calculator.CalculatorTest.testCalculatorViaLocalInterface(CalculatorTest.java:72)
>> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> 	at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>> 	at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> 	at java.lang.reflect.Method.invoke(Method.java:585)
>> 	at junit.framework.TestCase.runTest(TestCase.java:164)
>> 	at junit.framework.TestCase.runBare(TestCase.java:130)
>> 	at junit.framework.TestResult$1.protect(TestResult.java:110)
>> 	at junit.framework.TestResult.runProtected(TestResult.java:128)
>> 	at junit.framework.TestResult.run(TestResult.java:113)
>> 	at junit.framework.TestCase.run(TestCase.java:120)
>> 	at junit.framework.TestSuite.runTest(TestSuite.java:228)
>> 	at junit.framework.TestSuite.run(TestSuite.java:223)
>> 	at
>> org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:35)
>> 	at
>> org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
>> 	at
>> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
>> 	at
>> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
>> 	at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
>> 
>> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> 	at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>> 	at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> 	at java.lang.reflect.Method.invoke(Method.java:585)
>> 	at
>> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
>> 	at
>> org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
>> </error>
>>     <system-out>app =
>> jar:file:/shared/apps/.m2/repository/org/apache/openejb/openejb-core/3.0/openejb-core-3.0.jar!/META-INF/ejb-jar.xml
>> </system-out>
>>   </testcase>
>> </testsuite>
>> 
>> 
> 
> 
> 
> David Blevins wrote:
>> 
>> 
>> 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.0    build: 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<URL> ejbJars =  
>> this.getClass().getClassLoader().getResources("META-INF/ejb-jar.xml");
>>          while (ejbJars.hasMoreElements()) {
>>              URL url = ejbJars.nextElement();
>>              System.out.println("app = " + url);
>>          }
>> 
>> 
>> -David
>> 
>> 
>> 
>> 
>> 
> 
> 

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


Re: OpenEJB with JUnit from NetBeans: NameNotFoundException

Posted by franz see <fr...@gmail.com>.
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:


> <?xml version="1.0" encoding="UTF-8" ?>
> <testsuite errors="2" skipped="0" tests="2" time="1.075" failures="0"
> name="org.superbiz.calculator.CalculatorTest">
>   <properties>
>     <property value="3.0" name="openejb.version"/>
>     <property value="Java(TM) 2 Runtime Environment, Standard Edition"
> name="java.runtime.name"/>
>     <property value="/usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i386"
> name="sun.boot.library.path"/>
>     <property value="1.5.0_15-b04" name="java.vm.version"/>
>     <property value="Sun Microsystems Inc." name="java.vm.vendor"/>
>     <property value="http://java.sun.com/" name="java.vendor.url"/>
>     <property value=":" name="path.separator"/>
>     <property value="Java HotSpot(TM) Server VM" name="java.vm.name"/>
>     <property value="sun.io" name="file.encoding.pkg"/>
>     <property
> value="org.apache.openejb.core.security.JaccProvider$Factory"
> name="javax.security.jacc.PolicyConfigurationFactory.provider"/>
>     <property value="PH" name="user.country"/>
>     <property value="SUN_STANDARD" name="sun.java.launcher"/>
>     <property value="unknown" name="sun.os.patch.level"/>
>     <property value="Java Virtual Machine Specification"
> name="java.vm.specification.name"/>
>     <property
> value="/home/franz/src/openejb-examples-3.0/simple-stateless"
> name="user.dir"/>
>     <property value="1.5.0_15-b04" name="java.runtime.version"/>
>     <property
> value="/home/franz/src/openejb-examples-3.0/simple-stateless"
> name="derby.system.home"/>
>     <property value="sun.awt.X11GraphicsEnvironment"
> name="java.awt.graphicsenv"/>
>     <property
> value="/home/franz/src/openejb-examples-3.0/simple-stateless"
> name="basedir"/>
>     <property
> value="/usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/endorsed"
> name="java.endorsed.dirs"/>
>     <property value="i386" name="os.arch"/>
>     <property value="/tmp/surefirebooter58049.jar"
> name="surefire.real.class.path"/>
>     <property value="/tmp" name="java.io.tmpdir"/>
>     <property value="
> " name="line.separator"/>
>     <property value="Sun Microsystems Inc."
> name="java.vm.specification.vendor"/>
>     <property value="org.apache.openejb.core.ivm.naming"
> name="java.naming.factory.url.pkgs"/>
>     <property value="Linux" name="os.name"/>
>     <property value="true" name="derby.storage.fileSyncTransactionLog"/>
>     <property value="UTF-8" name="sun.jnu.encoding"/>
>     <property
> 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"/>
>     <property
> 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"/>
>     <property value="Java Platform API Specification"
> name="java.specification.name"/>
>     <property value="49.0" name="java.class.version"/>
>     <property value="HotSpot Server Compiler"
> name="sun.management.compiler"/>
>     <property value="2.6.24-19-generic" name="os.version"/>
>     <property value="/home/franz" name="user.home"/>
>     <property value="Asia/Manila" name="user.timezone"/>
>     <property value="sun.print.PSPrinterJob" name="java.awt.printerjob"/>
>     <property value="1.5" name="java.specification.version"/>
>     <property value="UTF-8" name="file.encoding"/>
>     <property value="franz" name="user.name"/>
>     <property
> 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="java.class.path"/>
>     <property value="log4j" name="openjpa.Log"/>
>     <property value="true" name="noBanner"/>
>     <property value="1.0" name="java.vm.specification.version"/>
>     <property value="32" name="sun.arch.data.model"/>
>     <property value="/usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre"
> name="java.home"/>
>     <property value="Sun Microsystems Inc."
> name="java.specification.vendor"/>
>     <property value="en" name="user.language"/>
>     <property value="mixed mode" name="java.vm.info"/>
>     <property value="1.5.0_15" name="java.version"/>
>     <property
> value="org.apache.openejb.core.security.jacc.BasicJaccProvider"
> name="org.apache.openejb.core.security.JaccProvider"/>
>     <property value="/usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/ext"
> name="java.ext.dirs"/>
>     <property
> value="/usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/rt.jar:/usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/i18n.jar:/usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/jsse.jar:/usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/jce.jar:/usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/lib/charsets.jar:/usr/lib/jvm/java-1.5.0-sun-1.5.0.15/jre/classes"
> name="sun.boot.class.path"/>
>     <property value="Sun Microsystems Inc." name="java.vendor"/>
>     <property
> value="jar:file:/shared/apps/.m2/repository/org/apache/openejb/openejb-core/3.0/openejb-core-3.0.jar!/login.config"
> name="java.security.auth.login.config"/>
>     <property value="/shared/apps/.m2/repository" name="localRepository"/>
>     <property value="/" name="file.separator"/>
>     <property value="http://java.sun.com/cgi-bin/bugreport.cgi"
> name="java.vendor.url.bug"/>
>     <property value="little" name="sun.cpu.endian"/>
>     <property value="UnicodeLittle" name="sun.io.unicode.encoding"/>
>     <property value="gnome" name="sun.desktop"/>
>     <property value="" name="sun.cpu.isalist"/>
>   </properties>
>   <testcase classname="org.superbiz.calculator.CalculatorTest"
> time="1.039" name="testCalculatorViaRemoteInterface">
>     <error type="javax.naming.NameNotFoundException" message="Name
> &quot;CalculatorImplRemote&quot; not
> found.">javax.naming.NameNotFoundException: Name
> &quot;CalculatorImplRemote&quot; 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:351)
> 	at
> org.superbiz.calculator.CalculatorTest.testCalculatorViaRemoteInterface(CalculatorTest.java:55)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at junit.framework.TestCase.runTest(TestCase.java:164)
> 	at junit.framework.TestCase.runBare(TestCase.java:130)
> 	at junit.framework.TestResult$1.protect(TestResult.java:110)
> 	at junit.framework.TestResult.runProtected(TestResult.java:128)
> 	at junit.framework.TestResult.run(TestResult.java:113)
> 	at junit.framework.TestCase.run(TestCase.java:120)
> 	at junit.framework.TestSuite.runTest(TestSuite.java:228)
> 	at junit.framework.TestSuite.run(TestSuite.java:223)
> 	at
> org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:35)
> 	at
> org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
> 	at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
> 	at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
> 	at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at
> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
> 	at
> org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
> </error>
>     <system-out>Apache OpenEJB 3.0    build: 20080408-04:13
> http://openejb.apache.org/
> INFO - openejb.home =
> /home/franz/src/openejb-examples-3.0/simple-stateless
> INFO - openejb.base =
> /home/franz/src/openejb-examples-3.0/simple-stateless
> 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)
> app =
> jar:file:/shared/apps/.m2/repository/org/apache/openejb/openejb-core/3.0/openejb-core-3.0.jar!/META-INF/ejb-jar.xml
> </system-out>
>   </testcase>
>   <testcase classname="org.superbiz.calculator.CalculatorTest"
> time="0.001" name="testCalculatorViaLocalInterface">
>     <error type="javax.naming.NameNotFoundException" message="Name
> &quot;CalculatorImplLocal&quot; not
> found.">javax.naming.NameNotFoundException: Name
> &quot;CalculatorImplLocal&quot; 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:351)
> 	at
> org.superbiz.calculator.CalculatorTest.testCalculatorViaLocalInterface(CalculatorTest.java:72)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at junit.framework.TestCase.runTest(TestCase.java:164)
> 	at junit.framework.TestCase.runBare(TestCase.java:130)
> 	at junit.framework.TestResult$1.protect(TestResult.java:110)
> 	at junit.framework.TestResult.runProtected(TestResult.java:128)
> 	at junit.framework.TestResult.run(TestResult.java:113)
> 	at junit.framework.TestCase.run(TestCase.java:120)
> 	at junit.framework.TestSuite.runTest(TestSuite.java:228)
> 	at junit.framework.TestSuite.run(TestSuite.java:223)
> 	at
> org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:35)
> 	at
> org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
> 	at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140)
> 	at
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127)
> 	at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
> 
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:585)
> 	at
> org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345)
> 	at
> org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009)
> </error>
>     <system-out>app =
> jar:file:/shared/apps/.m2/repository/org/apache/openejb/openejb-core/3.0/openejb-core-3.0.jar!/META-INF/ejb-jar.xml
> </system-out>
>   </testcase>
> </testsuite>
> 
> 



David Blevins wrote:
> 
> 
> 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.0    build: 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<URL> ejbJars =  
> this.getClass().getClassLoader().getResources("META-INF/ejb-jar.xml");
>          while (ejbJars.hasMoreElements()) {
>              URL url = ejbJars.nextElement();
>              System.out.println("app = " + url);
>          }
> 
> 
> -David
> 
> 
> 
> 
> 

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


Re: OpenEJB with JUnit from NetBeans: NameNotFoundException

Posted by David Blevins <da...@visi.com>.
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.0    build: 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<URL> 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

Posted by Bernhard Humm <b....@fbi.h-da.de>.


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.0    build: 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.0    build: 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

Posted by David Blevins <da...@visi.com>.
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

Posted by Bernhard Humm <b....@fbi.h-da.de>.
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

Posted by David Blevins <da...@visi.com>.
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