I do trying convert my working source code from Weblogic to JBoss.
And I have problem while I want lookup EJB home, i got exception:
The client was unable to lookup the EJBHome. Please make sure that you have dep
loyed the ejb with the JNDI name EMailApplicationHome on the Application server
at
/**
Function for getting homes
@param String name = EMailApplicationHome
@param Class type = EMailApplicationHome.class
*/
private Object getHome(String name,Class type)
throws NamingException
{
System.setProperty("java.naming.factory.initial",
"org.jnp.interfaces.NamingContextFactory");
System.setProperty("java.naming.provider.url",
"localhost:1099");
InitialContext ctx = new InitialContext();
System.out.println("Got context");
try {
System.out.println("getHome:1");
Object home = ctx.lookup(name); // <-- Exception here
System.out.println("getHome:2");
return (Object) PortableRemoteObject.narrow(home, type);
}
catch (NamingException ne) {
String aText = "The client was unable to lookup the EJBHome. Please make sure "
+ "that you have deployed the ejb with the JNDI name "
+ name
+ " on the Application server at "
+ url;
log( aText );
throw ne;
}
}
My ejb-jar.xml
<?xml version="1.0" encoding="Cp1252"?>
<ejb-jar>
<enterprise-beans>
<entity>
<ejb-name>EMailApplication</ejb-name>
<home>com.ls.dialog.ejb.email.EMailApplicationHome</home>
<remote>com.ls.dialog.ejb.email.EMailApplication</remote>
<ejb-class>com.ls.dialog.ejb.email.EMailApplicationBean</ejb-class>
<persistence-type>Bean</persistence-type>
<prim-key-class>com.ls.dialog.ejb.vapp.VirtualApplicationPK</prim-key-class>
<reentrant>False</reentrant>
<resource-ref>
<res-ref-name>jdbc/oraclePool</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</entity>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>EMailApplication</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
My JBoss.xml:
<?xml version="1.0" encoding="Cp1252"?>
<jboss>
<enterprise-bean>
<entity>
<ejb-name>EMailApplication</ejb-name>
<jndi-name>EMailApplicationHome</jndi-name>
</entity>
</enterprise-bean>
</jboss>
BTW: when i starting JBoss server i got warning:
[Verifier] EMailApplication: The method return values in the home interface must
be of valid types for RMI/IIOP.
[Verifier] EMailApplication: The method return values in the home interface must
be of valid types for RMI/IIOP.
In my bean there are definitions of static final String objects but as it was said before it is just warning and nothing wrong with it can be.
Thanks all for any help
Living-Source GmbH, Lithuania-Germany;
Software development
Tel: +370 7 323682
