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.

Reply via email to