Hello Everybody
I have made database in access that consist of 4fields id,name,position,salary .first three are Text and last is number ,also id is primary key.
I set classpath with jbossall-client.jar as well as jboss-j2ee.jar files.
In META-INF,I put jboss.xml,ejb-jar.xml and jbosscmp-jdbc.xml.
This is the code in jbosscmp-jdbc.xml
<jbosscmp-jdbc>
<enterprise-beans>
<entity>
<ejb-name>abc</ejb-name>
<create-table>true</create-table>
<remove-table>true</remove-table>
<table-name>PlayerBean</table-name>
<cmp-field>
<field-name>id</field-name>
<column-name>id</column-name>
</cmp-field>
<cmp-field>
<field-name>name</field-name>
<column-name>name</column-name>
</cmp-field>
<cmp-field>
<field-name>position</field-name>
<column-name>position</column-name>
</cmp-field>
<cmp-field>
<field-name>salary</field-name>
<column-name>salary</column-name>
</cmp-field>
</entity>
</enterprise-beans>
</jbosscmp-jdbc>
and i put msaccess-ds.xml in server-default-deploy directory with following changes:
<datasources>
<local-tx-datasource>
<jndi-name>MSAccessDS</jndi-name>
<!-- format of URL is "jdbc
dbc
SNNAME" -->
<connection-url>
jdbc dbc:STG</connection-url>
<driver-class>sun.jdbc.odbc.JdbcOdbcDriver</driver-class>
<user-name></user-name>
<password></password>
</local-tx-datasource>
</datasources>
and i made changes in standardjbosscmp-jdbc.xml of conf directory
as :
<jbosscmp-jdbc>
<defaults>
<datasource>
java:/MSAccessDS</datasource>
<datasource-mapping>MS ACCESS</datasource-mapping>
</jbosscmp-jdbc>
Now if i made client as:
import javax.rmi.*;
import javax.ejb.*;
import javax.naming.*;
import java.util.*;
public class CmpClient
{
public static void main(
String s[])
{
try
{
Properties prop=new Properties();
prop.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.InitialContextFactory");
prop.put(Context.PROVIDER_URL,"localhost:1099");
Context context=new InitialContext(prop);
Object object=context.lookup("cmp");
CmpHome home=(CmpHome)PortableRemoteObject.narrow(object,CmpHome.class);
CmpRemote remote=home.create("ao1","sachine","j2ee",1222);
System.out.println("id of customer"+remote.getId());
}
catch(Exception c)
{
System.out.println(c.getMessage());
}
}
}
and try to run this program ,it throws following RuntimeException
as
the bean class CmpBean does not have id.
But i saw several times that program is running quite well in weblogic server .Now try to help me out in
jboss server.May i am lacking in any process or files.