Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem locating session bean's home interface from client

Status
Not open for further replies.

keano6

Programmer
Feb 25, 2003
4
CN
Hi,

I am relatively new to j2ee, and am having problems getting the basics working.
I am using sun's j2ee application server, and sun's deploytool to deploy the application.
The application deploys no problem, but when I run it I get the following error -

Application threw an exception:java.lang.NoClassDefFoundError: provisioning.ProvisioningHome

where provisioning is the package name, and ProvisioningHome is the home interface of the Provisioning session bean.

Here is the home interface code -

package provisioning;

import java.rmi.RemoteException;
import javax.ejb.CreateException;
import javax.ejb.EJBHome;

public interface ProvisioningHome extends EJBHome {

public Provisioning create()
throws RemoteException, CreateException;
}

...and the client code -

package client;

import java.util.*;
import java.io.*;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import provisioning.*;

public class ProvisioningClient {

public static void main(String[] args) {

try {
InitialContext initial = new InitialContext();
Object objref = initial.lookup("java:comp/env/ejb/Provisioning");

ProvisioningHome home =
(ProvisioningHome)PortableRemoteObject.narrow(objref, ProvisioningHome.class);

Provisioning myProvisioning = home.create();

System.exit(0);

} catch (Exception ex) {
System.err.println("Caught an exception:");
ex.printStackTrace();
}
}
} // class


I've obviously missed something obvious, but just can't see it.

Here is the xml generated by the deploytool -

<?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?>

<!DOCTYPE application PUBLIC '-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN' '
<application>
<display-name>PrototypeApp</display-name>
<description>Application description</description>
<module>
<ejb>ejb-jar-ic0.jar</ejb>
</module>
<module>
<java>app-client-ic.jar</java>
</module>
<module>
<ejb>ejb-jar-ic.jar</ejb>
</module>
</application>



<?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?>

<!DOCTYPE j2ee-ri-specific-information PUBLIC '-//Sun Microsystems Inc.//DTD J2EE Reference Implementation 1.3//EN' '
<j2ee-ri-specific-information>
<rolemapping />
<enterprise-beans>
<module-name>ejb-jar-ic0.jar</module-name>
<unique-id>0</unique-id>
<ejb>
<ejb-name>ProvisioningBean</ejb-name>
<jndi-name>MyProvisioning</jndi-name>
<ior-security-config>
<transport-config>
<integrity>supported</integrity>
<confidentiality>supported</confidentiality>
<establish-trust-in-target>supported</establish-trust-in-target>
<establish-trust-in-client>supported</establish-trust-in-client>
</transport-config>
<as-context>
<auth-method>username_password</auth-method>
<realm>default</realm>
<required>false</required>
</as-context>
<sas-context>
<caller-propagation>supported</caller-propagation>
</sas-context>
</ior-security-config>
<ejb-ref>
<ejb-ref-name>ejb/LogicalElement</ejb-ref-name>
<jndi-name></jndi-name>
</ejb-ref>
<gen-classes />
</ejb>
</enterprise-beans>
<enterprise-beans>
<module-name>ejb-jar-ic.jar</module-name>
<unique-id>0</unique-id>
<ejb>
<ejb-name>LogicalElementBean</ejb-name>
<jndi-name>MyLogicalElement</jndi-name>
<ior-security-config>
<transport-config>
<integrity>supported</integrity>
<confidentiality>supported</confidentiality>
<establish-trust-in-target>supported</establish-trust-in-target>
<establish-trust-in-client>supported</establish-trust-in-client>
</transport-config>
<as-context>
<auth-method>username_password</auth-method>
<realm>default</realm>
<required>false</required>
</as-context>
<sas-context>
<caller-propagation>supported</caller-propagation>
</sas-context>
</ior-security-config>
<gen-classes />
<ejb20-cmp>
<sql-statement>
<operation>storeRow</operation>
<sql>UPDATE &quot;LogicalElementBeanTable&quot; SET &quot;adminState&quot; = ? , &quot;opState&quot; = ? , &quot;reasonCode&quot; = ? WHERE &quot;logicalElementId&quot; = ? </sql>
</sql-statement>
<sql-statement>
<operation>loadRow</operation>
<sql>SELECT &quot;adminState&quot; , &quot;opState&quot; , &quot;reasonCode&quot; FROM &quot;LogicalElementBeanTable&quot; WHERE &quot;logicalElementId&quot; = ? </sql>
</sql-statement>
<sql-statement>
<operation>deleteRow</operation>
<sql>DELETE FROM &quot;LogicalElementBeanTable&quot; WHERE &quot;logicalElementId&quot; = ? </sql>
</sql-statement>
<sql-statement>
<operation>createRow</operation>
<sql>INSERT INTO &quot;LogicalElementBeanTable&quot; ( &quot;adminState&quot; , &quot;logicalElementId&quot; , &quot;opState&quot; , &quot;reasonCode&quot; ) VALUES ( ? , ? , ? , ? )</sql>
</sql-statement>
<sql-statement>
<operation>deleteTable</operation>
<sql>DROP TABLE &quot;LogicalElementBeanTable&quot;</sql>
</sql-statement>
<sql-statement>
<operation>findByPrimaryKey</operation>
<sql>SELECT &quot;logicalElementId&quot; FROM &quot;LogicalElementBeanTable&quot; WHERE &quot;logicalElementId&quot; = ? </sql>
</sql-statement>
<sql-statement>
<operation>createTable</operation>
<sql>CREATE TABLE &quot;LogicalElementBeanTable&quot; (&quot;adminState&quot; INTEGER NOT NULL , &quot;logicalElementId&quot; VARCHAR(255) , &quot;opState&quot; INTEGER NOT NULL , &quot;reasonCode&quot; INTEGER NOT NULL, CONSTRAINT &quot;pk_LogicalElementBeanTabl&quot; PRIMARY KEY (&quot;logicalElementId&quot;) )</sql>
</sql-statement>
<create-table-deploy>true</create-table-deploy>
<delete-table-undeploy>false</delete-table-undeploy>
</ejb20-cmp>
</ejb>
<cmpresource>
<ds-jndi-name>jdbc/Cloudscape</ds-jndi-name>
<default-resource-principal>
<name></name>
<password></password>
</default-resource-principal>
</cmpresource>
</enterprise-beans>
</j2ee-ri-specific-information>



<?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?>

<!DOCTYPE application-client PUBLIC '-//Sun Microsystems, Inc.//DTD J2EE Application Client 1.3//EN' '
<application-client>
<display-name>ProvisioningClient</display-name>
<ejb-ref>
<ejb-ref-name>ejb/Provisioning</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>provisioning.ProvisioningHome</home>
<remote>provisioning.Provisioning</remote>
</ejb-ref>
</application-client>



<?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?>

<!DOCTYPE j2ee-ri-specific-information PUBLIC '-//Sun Microsystems Inc.//DTD J2EE Reference Implementation 1.3//EN' '
<j2ee-ri-specific-information>
<app-client>
<ejb-ref>
<ejb-ref-name>ejb/Provisioning</ejb-ref-name>
<jndi-name>MyProvisioning</jndi-name>
</ejb-ref>
</app-client>
</j2ee-ri-specific-information>



<?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?>

<!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN' '
<ejb-jar>
<display-name>provisioning</display-name>
<enterprise-beans>
<session>
<display-name>ProvisioningBean</display-name>
<ejb-name>ProvisioningBean</ejb-name>
<home>provisioning.ProvisioningHome</home>
<remote>provisioning.Provisioning</remote>
<ejb-class>provisioning.ProvisioningBean</ejb-class>
<session-type>Stateful</session-type>
<transaction-type>Container</transaction-type>
<ejb-local-ref>
<ejb-ref-name>ejb/LogicalElement</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>entities.LocalLogicalElementHome</local-home>
<local>entities.LocalLogicalElement</local>
<ejb-link>LogicalElementBean</ejb-link>
</ejb-local-ref>
<security-identity>
<description></description>
<use-caller-identity></use-caller-identity>
</security-identity>
</session>
</enterprise-beans>
<assembly-descriptor>
<method-permission>
<unchecked />
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Home</method-intf>
<method-name>remove</method-name>
<method-params>
<method-param>java.lang.Object</method-param>
</method-params>
</method>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>createLogicalElement</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</method>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getHandle</method-name>
<method-params />
</method>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Home</method-intf>
<method-name>remove</method-name>
<method-params>
<method-param>javax.ejb.Handle</method-param>
</method-params>
</method>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Home</method-intf>
<method-name>getHomeHandle</method-name>
<method-params />
</method>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getPrimaryKey</method-name>
<method-params />
</method>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>remove</method-name>
<method-params />
</method>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Home</method-intf>
<method-name>getEJBMetaData</method-name>
<method-params />
</method>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getLogicalElement</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</method>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Home</method-intf>
<method-name>create</method-name>
<method-params />
</method>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>isIdentical</method-name>
<method-params>
<method-param>javax.ejb.EJBObject</method-param>
</method-params>
</method>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getEJBHome</method-name>
<method-params />
</method>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>submit</method-name>
<method-params />
</method>
</method-permission>
<container-transaction>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>submit</method-name>
<method-params />
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>getLogicalElement</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>ProvisioningBean</ejb-name>
<method-intf>Remote</method-intf>
<method-name>createLogicalElement</method-name>
<method-params>
<method-param>java.lang.String</method-param>
</method-params>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>


sorry for all the xml...

Thanks,

Eamon.
 
**I use Jboss and I write download the code I get from jboss example Interest.jar
**you should have a folder and files c:\com\web_tomorrow\interest\InterestClient.java
c:\META-INF
jar cvf Interest.jar com META-INF
** and create Interest.jar

**your classpath may be
set CLASSPATH=.;c:\j\Interest.jar;CLASSPATH


import com.web_tomorrow.interest.*;
import javax.naming.*;
import java.util.Hashtable;
import javax.rmi.PortableRemoteObject;
class InterestClient {
public static void main(String[] args) {
Object ref = jndiContext.lookup(&quot;interest/Interest&quot;);
}
}
** The code is not complete
**you search download example about jboss + Interest.jar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top