Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes EJB and other Java EE Technologies and the fly likes Entity Bean Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Entity Bean Problem" Watch "Entity Bean Problem" New topic
Author

Entity Bean Problem

Khuram Khan
Greenhorn

Joined: Dec 18, 2002
Posts: 25
I am facing problem with entity bean while using jboss3.04 application server
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////// EJB Code //////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
import tk.devware.customer.CustomerHome;
import tk.devware.customer.CustomerRemote;
import javax.naming.*;
import javax.rmi.PortableRemoteObject;
import java.util.*;
public class TestClient
{

public static void main(String[] args) throws Exception
{
Context con = getInitialContext();
Object objref = con.lookup("DevCustomer");
CustomerHome ch = (CustomerHome) javax.rmi.PortableRemoteObject.narrow(objref,CustomerHome.class);
System.out.println(ch);
CustomerRemote cr1 = ch.create(new Integer(1));
cr1.setFirstName("Khuram Khan");
cr1.setLastName("Pathan");





}
private static Context getInitialContext() throws NamingException
{
Properties pro = new Properties();
pro.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
pro.put(Context.PROVIDER_URL,"localhost:1099");
Context con = new InitialContext(pro);
return con;
}
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////// DEPLOYMENT TIME WARNINGS ////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
05:46:27,756 INFO [MainDeployer] Starting deployment of package: file:/D:/jboss
34/server/default/deploy/Customer.jar
05:46:28,077 INFO [EJBDeployer]
Bean : DevCustomer
Section: 9.2.2
Warning: The entity bean class must not be defined as abstract.
05:46:28,187 INFO [EJBDeployer]
Bean : DevCustomer
Section: 9.4.7.1
Warning: The primkey-field element must name a public field in the bean implemen
tation class.
05:46:28,758 INFO [EjbModule] Creating
05:46:28,868 INFO [EjbModule] Deploying CustomerCEJB
05:46:30,280 INFO [JDBCInitCommand] Created table 'CustomerCEJB' successfully.
05:46:30,290 INFO [EjbModule] Created
05:46:30,300 INFO [EjbModule] Starting
05:46:30,671 INFO [EjbModule] Started
05:46:30,681 INFO [MainDeployer] Deployed package: file:/D:/jboss34/server/defa
ult/deploy/Customer.jar
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////// CLIENT SIDE EXCEPTION AT RUN TIME /////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
DevCustomerHome
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.ServerException: EJBException:; nested exception is:
javax.ejb.EJBException: Could not instantiate bean; nested exception is: java.lang.InstantiationException
java.rmi.ServerException: EJBException:; nested exception is:
javax.ejb.EJBException: Could not instantiate bean; nested exception is: java.lang.InstantiationException
javax.ejb.EJBException: Could not instantiate bean; nested exception is: java.lang.InstantiationException
java.lang.InstantiationException
<<no stack trace available>>
javax.ejb.EJBException: Could not instantiate bean; nested exception is: java.lang.InstantiationException
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:245)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:220)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:122)
at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:138)
at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:108)
at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:77)
at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:80)
at org.jboss.proxy.ejb.HomeInterceptor.invoke(HomeInterceptor.java:198)
at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)
at $Proxy0.create(Unknown Source)
at TestClient.main(TestClient.java:23)
Exception in thread "main"
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////// SERVER SIDE EXCEPTION AT RUN TIME ////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
06:02:15,850 ERROR [LogInterceptor] EJBException, causedBy:
java.lang.InstantiationException
at sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance
(InstantiationExceptionConstructorAccessorImpl.java:33)
at java.lang.reflect.Constructor.newInstance(Constructor.java:273)
at java.lang.Class.newInstance0(Class.java:290)
at java.lang.Class.newInstance(Class.java:249)
at org.jboss.ejb.plugins.jaws.JAWSPersistenceManager.createBeanClassInst
ance(JAWSPersistenceManager.java:165)
at org.jboss.ejb.plugins.CMPPersistenceManager.createBeanClassInstance(C
MPPersistenceManager.java:165)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.crea
teBeanClassInstance(CachedConnectionInterceptor.java:251)
at org.jboss.ejb.EntityContainer.createBeanClassInstance(EntityContainer
.java:294)
at org.jboss.ejb.plugins.AbstractInstancePool.get(AbstractInstancePool.j
ava:209)
at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInst
anceInterceptor.java:78)
at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInte
rceptor.java:79)
at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCrea
tionInterceptor.java:44)
at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInte
rceptor.java:111)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxIntercep
torCMT.java:178)
at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.ja
va:52)
at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityIntercep
tor.java:105)
at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:1
29)
at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:487)
at org.jboss.ejb.Container.invoke(Container.java:730)
at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1058)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:
382)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:30)
at sun.reflect.InflatableMethodAccessorImpl.invoke(InflatableMethodAcces
sorImpl.java:48)
at java.lang.reflect.Method.invoke(Method.java:306)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:256)
at sun.rmi.transport.Transport$1.run(Transport.java:156)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:152)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:4
69)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport
.java:706)
at java.lang.Thread.run(Thread.java:579)


Kamal Khan<p>Sun Certified Programmer for Java2<br />Sun Certified Web Component Developer<br />SCBCD
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Entity Bean Problem