[jboss-user] [JNDI/Naming/Network] - context.list() shows Object, but context.lookup() fails with

johannes.martin do-not-reply at jboss.com
Thu Aug 31 02:57:01 EDT 2006


The following problem occurs while looking up an EJB within an EAR in JBoss 4.0.4SP1.

When I try to lookup an EJB like
  ... =  new InitialContext().lookup("local/SomeService");
a "javax.naming.NameNotFoundException: SomeService not bound" is thrown.

Obvious reason would be that something is wrong with ejb-jar.xml or jboss.xml, but they look right (see below).

Also, when I use the following code to list the contents of "local", the TRXService appears:
		   ne = new InitialContext.list("local");
		   while (ne.hasMore()) {
		       NameClassPair p = (NameClassPair) ne.next();
		       System.out.println(p.getName() + ":\t" + p.getClassName());
		   }
...
08:42:03,703 INFO  [STDOUT] SomeService at 12594563:        $Proxy180
...

Also, the lookup seems to work fine with JBoss 3.2.1.

Any hints?

Thanks
  Johannes 

-----
jboss.xml:
<?xml version="1.0" encoding="UTF-8"?>

    <enterprise-beans>
        
            <ejb-name>SomeService</ejb-name>
            <jndi-name>local/SomeService</jndi-name>
        
    </enterprise-beans>

-----
ejb-jar.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC
   "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
      "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar>
    <enterprise-beans>
        
            <display-name>SomeService</display-name>
            <ejb-name>SomeService</ejb-name>
            <local-home>de.mycompany.SomeServiceHome</local-home>
            de.mycompany.SomeService
            <ejb-class>de.mycompany.SomeServiceBean</ejb-class>
            <session-type>Stateless</session-type>
            <transaction-type>Container</transaction-type>
            <security-identity>
                
                <use-caller-identity />
            </security-identity>
        
    </enterprise-beans>

    <assembly-descriptor>
        <container-transaction>
            
                <ejb-name>SomeService</ejb-name>
                <method-name>*</method-name>
            
            <trans-attribute>Required</trans-attribute>
        </container-transaction>
        <container-transaction>
            
                <ejb-name>SomeService</ejb-name>
                <method-name>execute</method-name>
            
            <trans-attribute>RequiresNew</trans-attribute>
        </container-transaction>
    </assembly-descriptor>
</ejb-jar>
-----

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3968538#3968538

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3968538



More information about the jboss-user mailing list