Strang problem over here...well actually two of them.
Jboss-PRE-2.1/Jetty3.0.0-rc6
PostgreSQL database
Problem 1)
I have written an entity bean with a composite primary key...therefore
neccesitating a special Prim Key class. The relevant table's name is "CONFLICT", and
the entity bean is ConflictEntity{Bean, BI, Home, PK, _}.
The problem is this: when I start up jboss/jetty, and clean the database
(re-load the schema from scratch...nothing in any of the tables), and then use a jsp
front-end (or a java command-line client...tried both, same problem) to add some data
to the tables, all goes well.
If I then use the same jsp front-end, or java client to retreive the data from
the tables, via the aforementioned EJB, all goes well. The problem arises when I stop
and then re-start jboss/jetty. If I do this, and then re-start the server, when I
first try to access any of the fields of the Bean, I get a HUGE exception stack on the
server side. Here's an example.
Step 1)
InitialContext...
Object o = context.lookup("ConflictEntity");
ConflictEntityHome home = (ConflictEntity) PortableRemoteObject.narrow(o,
ConflictEntityHome.class);
home.create("saul",new Integer(1), "Saturday");
Step 2)
Stop jboss/jetty,
Start jboss/jetty
Step 3)
InitialContext...
Object o = context.lookup("ConflictEntity");
ConflictEntityHome home = (ConflictEntity) PortableRemoteObject.narrow(o,
ConflictEntityHome.class);
ConflictEntityPK key = new ConflictEntityPK();
key.name="saul";
key.time=new Integer(1);
key.day="Saturday";
ConflictEntity c = home.findByPrimaryKey(key);
//All is well up to here...
System.out.println("Conflict's name is : " + c.getName());
//AHHH.... Big blowup on last line!
Here is the exception:
[ConflictEntity] TRANSACTION ROLLBACK EXCEPTION:Load failed; nested exception
is:
java.lang.IllegalArgumentException: object is not an instance of declaring
class; nested exception is:
java.rmi.ServerException: Load failed; nested exception is:
java.lang.IllegalArgumentException: object is not an instance of declaring
class
[ConflictEntity] java.rmi.ServerException: Load failed; nested exception is:
[ConflictEntity] java.lang.IllegalArgumentException: object is not an instance
of declaring class
[ConflictEntity] java.lang.IllegalArgumentException: object is not an instance of
declaring class
[ConflictEntity] at java.lang.reflect.Field.get(Native Method)
[ConflictEntity] at
org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand.getPkFieldValue(JDBCCommand.java:598)
[ConflictEntity] at
org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand.setPrimaryKeyParameters(JDBCCommand.java:344)
[ConflictEntity] at
org.jboss.ejb.plugins.jaws.jdbc.JDBCLoadEntityCommand.setParameters(JDBCLoadEntityCommand.java:92)
[ConflictEntity] at
org.jboss.ejb.plugins.jaws.jdbc.JDBCCommand.jdbcExecute(JDBCCommand.java:157)
[ConflictEntity] at
org.jboss.ejb.plugins.jaws.jdbc.JDBCLoadEntityCommand.execute(JDBCLoadEntityCommand.java:77)
[ConflictEntity] at
org.jboss.ejb.plugins.jaws.JAWSPersistenceManager.loadEntity(JAWSPersistenceManager.
java:150)
[ConflictEntity] at
org.jboss.ejb.plugins.CMPPersistenceManager.loadEntity(CMPPersistenceManager.java:277)
[ConflictEntity] at
org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke(EntitySynchronizationInterceptor.java:192)
[ConflictEntity] at
org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:204)
[ConflictEntity] at
org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxInterceptorCMT.java:133)
[ConflictEntity] at
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:263)
[ConflictEntity] at
org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:99)
[ConflictEntity] at
org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:144)
[ConflictEntity] at
org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
[ConflictEntity] at
org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:323)
[ConflictEntity] at
org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke(JRMPContainerInvoker.java:163)
[ConflictEntity] at
org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invoke(JRMPContainerInvoker.java:228)
[ConflictEntity] at
org.jboss.ejb.plugins.jrmp.interfaces.EntityProxy.invoke(EntityProxy.java:146)
[ConflictEntity] at
org.jboss.proxy.ProxyCompiler$Runtime.invoke(ProxyCompiler.java:74)
[ConflictEntity] at
edu.cornell.univrelations.schedulize.ejb.conflictentity.ConflictEntity$Proxy.getDay(Unknown
Source)
[ConflictEntity] at
UserManager._0002fUserManager_0002fdispConflict_0002ejspdispConflict_jsp_0._jspService(_0002fUserManager_0002fdispConflict_0002ejspdispConflict_jsp_0.java:111)
[ConflictEntity] at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java)
[ConflictEntity] at javax.servlet.http.HttpServlet.service(HttpServlet.java)
[ConflictEntity] at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java)
[ConflictEntity] at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java)
[ConflictEntity] at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java)
[ConflictEntity] at javax.servlet.http.HttpServlet.service(HttpServlet.java)
[ConflictEntity] at
com.mortbay.HTTP.Handler.Servlet.ServletHolder.handle(ServletHolder.java:453)
[ConflictEntity] at
com.mortbay.HTTP.Handler.Servlet.ServletHandler.handle(ServletHandler.java:408)
[ConflictEntity] at
com.mortbay.HTTP.Handler.Servlet.ServletHandler.handle(ServletHandler.java:264)
[ConflictEntity] at
com.mortbay.HTTP.HandlerContext.handle(HandlerContext.java:1034)
[ConflictEntity] at com.mortbay.HTTP.HttpServer.service(HttpServer.java:628)
[ConflictEntity] at
com.mortbay.HTTP.HttpConnection.service(HttpConnection.java:464)
[ConflictEntity] at
com.mortbay.HTTP.HttpConnection.handle(HttpConnection.java:317)
[ConflictEntity] at
com.mortbay.HTTP.SocketListener.handleConnection(SocketListener.java:99)
[ConflictEntity] at
com.mortbay.Util.ThreadedServer.handle(ThreadedServer.java:254)
[ConflictEntity] at
com.mortbay.Util.ThreadPool$PoolThreadRunnable.run(ThreadPool.java:592)
[ConflictEntity] at java.lang.Thread.run(Thread.java:475)
The key line is the really long one (its a jsp class). That's the line where the
first call to "getXXX()" is made on the bean. This whole scenario is also repeated if
the data is entered by hand into the database, but is (attempted to?) retreived by EJB.
What is going on here? Where to start looking for answers? I've checked a LOT of
things, and all my other Entity beans seem to work! Just this one. The stack trace's
mention of a PK makes me think that it's the special primary key class that is the
problem...but that doesn't make any sense to me...I have done the same thing with
other entity beans, and they all work just fine.
Hmmm.
Problem 2) (This one is much easier)
When I place two jar files in the auto-deploy directory, both get bound to the
same JNDI-Name. Here's an example:
[Container factory] Starting
[Container factory] Started
[Auto deploy] Starting
[Auto deploy] Auto deploy of
file:/usr/local/jboss_jetty/jboss-PRE-2.1/deploy/UserEntity.jar
[J2EE Deployer] Deploy J2EE application:
file:/usr/local/jboss_jetty/jboss-PRE-2.1/deploy/UserEntity.jar
[J2EE Deployer] Create application UserEntity.jar
[J2EE Deployer] Installing EJB package: UserEntity.jar
[J2EE Deployer] Starting module UserEntity.jar
[Container factory]
Deploying:file:/usr/local/jboss_jetty/jboss-PRE-2.1/tmp/deploy/UserEntity.jar/ejb1002.jar
[Verifier] Verifying
file:/usr/local/jboss_jetty/jboss-PRE-2.1/tmp/deploy/UserEntity.jar/ejb1002.jar
[Container factory] Deploying UserEntity
[Bean Cache] Cache policy scheduler started
[Container factory] Deployed application:
file:/usr/local/jboss_jetty/jboss-PRE-2.1/tmp/deploy/UserEntity.jar/ejb1002.jar
[J2EE Deployer] J2EE application:
file:/usr/local/jboss_jetty/jboss-PRE-2.1/deploy/UserEntity.jar is deployed.
[Auto deploy] Auto deploy of
file:/usr/local/jboss_jetty/jboss-PRE-2.1/deploy/ConflictEntity.jar
[J2EE Deployer] Deploy J2EE application:
file:/usr/local/jboss_jetty/jboss-PRE-2.1/deploy/ConflictEntity.jar
[J2EE Deployer] Create application ConflictEntity.jar
[J2EE Deployer] Installing EJB package: ConflictEntity.jar
[J2EE Deployer] Starting module ConflictEntity.jar
[Container factory]
Deploying:file:/usr/local/jboss_jetty/jboss-PRE-2.1/tmp/deploy/ConflictEntity.jar/ejb1004.jar
[Verifier] Verifying
file:/usr/local/jboss_jetty/jboss-PRE-2.1/tmp/deploy/ConflictEntity.jar/ejb1004.jar
[Container factory] Deploying UserEntity
<***AHHHHHH This should be "Deploying ConflictEntity", not
"UserEntity". Look at the jar file that is being deployed...***>
[Container factory] Deployed application:
file:/usr/local/jboss_jetty/jboss-PRE-2.1/tmp/deploy/ConflictEntity.jar/ejb1004.jar
[J2EE Deployer] J2EE application:
file:/usr/local/jboss_jetty/jboss-PRE-2.1/deploy/ConflictEntity.jar isdeployed.
[Auto deploy] Started
[J2EE Deployer] Starting
[J2EE Deployer] Cleaning up deployment directory
file:/usr/local/jboss_jetty/jboss-PRE-2.1/bin/../tmp/deploy/
[J2EE Deployer] Started
Notice that the second name is "UserEntity". Not "ConflictEntity" as it should be.
This itself isn't terrible, but the fact that both beans seem to get bound to
"UserEntity" is! At least, when I try to do a jndi lookup on "ConflictEntity" after
the server has started up in the preceeding manner, I get the error:
javax.naming.NamingException: "ConflictEntity" not bound
Any ideas from anyone? All help appreciated!
saul
--