HI sesques
As per your suggestions
1) I declared the primary key class of type java.lang.Object
2 ) I declared the return type of ejbCreate of java.lang.Object given bellow

public java.lang.Object ejbCreate( java.lang.String empFirstName ) throws javax.ejb.CreateException {
//setId(id);
this. setEmpFirstName(empFirstName);
// setEmpLastName(empLastName);
return null;
}


3 declared the unknow-pk and added an entity command
(( i added these changes simply at the bottom of jbosscmp-jdbc.xml , with out removing the existing cmp-field declarations for emp_ id


<cmp-field>
           <field-name>id</field-name>
           <column-name>emp_id</column-name>
        <jdbc-type>INTEGER</jdbc-type>
       <sql-type>INTEGER</sql-type>
       <auto-increment></auto-increment></cmp-field>

)

After these changes , i tried to deploy but deployment was unsuccessful and i got following error

[color=red]waring:The type of the primkey-field must match the primary key class.[/color]

Then i made primary key class of type java.lang.Integer
After this change deployment was successful, but when i run my
client I got bellow error
[color=red](client code [/color]
package com.emp.clients;
import com.emp.empdata.*;
import javax.naming.InitialContext;
import javax.naming.Context;
import javax.naming.NamingException;
import javax.rmi.PortableRemoteObject;
import java.rmi.RemoteException;
import java.util.*;
import java.text.*;
public class Client_emp
{
public static void main(String [] args)
{
try
{
Context jndiContext = getInitialContext(); Object ref = jndiContext.lookup("EmployeeBean");
EmployeeHome home = (EmployeeHome)
PortableRemoteObject.narrow(ref,EmployeeHome.class);
[color=green] // Employee emp_1 = home.create("Ramu","Vurumi"); // before changes working fine
Employee emp_1 = home.create("Ramu"); // before changes when i call set method
// getting error emp_1.setEmpLastName(new String("vurumi")); // Attemt to get lock ref with a null
//object[/color]




     }
     catch (java.rmi.RemoteException re){re.printStackTrace();}
     catch (javax.naming.NamingException ne){ne.printStackTrace();}
     catch (javax.ejb.CreateException ce){ce.printStackTrace();}
    // catch (javax.ejb.FinderException fe){fe.printStackTrace();}
   // catch (javax.ejb.RemoveException de){de.printStackTrace();}
  }

public static Context getInitialContext()
throws javax.naming.NamingException
{
return new InitialContext();
/**** context initialized by jndi.properties file
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
p.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");
p.put(Context.PROVIDER_URL, "localhost:1099");
return new javax.naming.InitialContext(p);
*/
}
}
)



[java] javax.ejb.CreateException: Could not create entity:java.lang.ClassNotFoundException: com.mysql.jdbc.PreparedStatement
[java] at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractVendorCreateCommand.insertEntity(JDBCAbstractVendorCreateCommand.java:136)
[java] at org.jboss.ejb.plugins.cmp.jdbc.JDBCAbstractVendorCreateCommand.execute(JDBCAbstractVendorCreateCommand.java:76)
[java] at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.createEntity(JDBCStoreManager.java:569)
[java] at org.jboss.ejb.plugins.CMPPersistenceManager.createEntity(CMPPersistenceManager.java:225)
[java] at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.createEntity(CachedConnectionInterceptor.java:270)
[java] at org.jboss.ejb.EntityContainer.createHome(EntityContainer.java:725)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:324)
[java] at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityContainer.java:998)
[java] at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:88)
[java] at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(EntitySynchronizationInterceptor.java:188)
[java] at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invokeHome(CachedConnectionInterceptor.java:215)
[java] at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractInterceptor.java:88)
[java] at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:91)
[java] at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:61)
[java] at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreationInterceptor.java:28)
[java] at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:88)
[java] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:243)
[java] at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:74)
[java] at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:92)
[java] at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:120)
[java] at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:93)
[java] at org.jboss.ejb.EntityContainer.internalInvokeHome(EntityContainer.java:477)
[java] at org.jboss.ejb.Container.invoke(Container.java:694)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:324)
[java] at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
[java] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
[java] at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:359)
[java] at sun.reflect.GeneratedMethodAccessor68.invoke(Unknown Source)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:324)
[java] at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
[java] at sun.rmi.transport.Transport$1.run(Transport.java:148)
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
[java] at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
[java] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
[java] at java.lang.Thread.run(Thread.java:534)
[java] at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
[java] at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
[java] at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
[java] at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
[java] at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:135)
[java] at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:87)
[java] at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
[java] at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:45)
[java] at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:173)
[java] at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:85)
[java] at $Proxy0.create(Unknown Source)
[java] at com.emp.clients.Client_emp.main(Client_emp.java:22)


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

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




Please help me vamsi




------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to