-
1. Re: is support ejb2.0 in jboss2.4.4? why lookup() is wrong?
sebaseba May 9, 2002 5:12 AM (in response to zheng)You need to post the relevant parts of your code.
/Sebastian -
2. this wrong coding.
zheng May 9, 2002 7:39 AM (in response to zheng)public class test {
public test() {
}
public static EJBLocalHome findLocal(String jndi) throws NamingException{
javax.naming.Context t;
EJBLocalHome info = null;
try {
Context contextIntial = getContext();
//context = (Context)contextIntial.lookup("java:comp/env/ejb/"+jndi) ;
info = (EJBLocalHome) contextIntial.lookup(jndi);
} catch (NamingException e) {
e.printStackTrace() ;
throw e;
} finally {
return info;
// context.close();
}
}
public static Context getContext() throws NamingException{
java.util.Hashtable ht = new java.util.Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY, EnvContextMgr.getContextName("java.naming.factory.initial"));
ht.put(Context.PROVIDER_URL, EnvContextMgr.getContextName("java.naming.provider.url"));
ht.put(Context.URL_PKG_PREFIXES, EnvContextMgr.getContextName("prefixes"));
return new InitialContext(ht);
}
public static void main(String[] args){
try {
System.out.println("adfafsd");
test.findLocal("com.xinghe.wuye.SBCarParkLocalLocal") ;
}catch(Exception e){e.printStackTrace() ;}
}
} -
3. properity file init.
zheng May 9, 2002 7:43 AM (in response to zheng)java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.provider.url=jnp://localhost:1099
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
prefixes=org.jboss.naming; -
4. Sebastian help me.
zheng May 9, 2002 7:49 AM (in response to zheng)my ejb-jar.xml and joss.xml whether right?
------ jboxx.xml-----------
<enterprise-beans>
<ejb-name>SBCarParkLocal</ejb-name>
<jndi-name>com.xinghe.wuye.SBCarParkLocalLocal</jndi-name>
<configuration-name></configuration-name>
</enterprise-beans>
----------ejb-jar.xml----------
<ejb-jar>
<enterprise-beans>
<ejb-name>SBCarParkLocal</ejb-name>
<local-home>com.xinghe.wuye.SBCarParkLocalLocalHome</local-home>
com.xinghe.wuye.SBCarParkLocalLocal
<ejb-class>com.xinghe.wuye.SBCarParkLocalBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<ejb-name>SBCarParkLocal</ejb-name>
<method-name>*</method-name>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar> -
5. Re: Sebastian help me.
adrian.brock May 9, 2002 10:44 AM (in response to zheng)java:comp/env can only be used inside the same
deployment. It is not accessible to a client.
From a client you need to use the global <jndi-name>
com.xinghe.wuye.SBCarParkLocalLocal
But then the local interface cannot be used outside
the virtual machine.
Regards,
Adrian -
6. Re: Sebastian help me.
zheng May 9, 2002 11:19 AM (in response to zheng)my client coding and ejb in same virtual machine
my *.xml is true? -
7. Re: Sebastian help me.
sebaseba May 10, 2002 7:58 AM (in response to zheng)Can't see any obvious mistakes in your deployment descriptors (there still might be some - I am fairly new to J2EE and JBoss myself).
As Adrian already pointed out, you need to use the global JNDI name for lookups from a client. Alternatively, you can also use the EJB name.
You may know this already - it is often quite useful to look at JBoss' JNDI browser at http://localhost:8082/InvokeAction//DefaultDomain%3Aservice%3DJNDIView/action=list?action=list¶m0%2Bboolean=true
/Sebastian