Is there some magic required or something to get Servlets and EJBs that are in the same JVM to communicate properly? I've tried both JBoss 3.0.7 and 3.1.2 with the embedded version of Tomcat and I cannot seem to get any CMP entity beans to retrieve anything from the database. Everytime findByPrimaryKey() is called I always get ObjectNotFoundExceptions even though I know the PK I'm specifying should return something from the database.
When I try my EJBs out by connecting to JBoss from a remote system or even a JVM that is separate from the JBoss/Tomcat JVM everything works. But when I try to retrieve data through the CMP container from a Servlet that runs within the same JVM I can't retrieve any data at all.
We've followed a pattern where all entity beans have local interfaces only and our remote session beans have remote interfaces. All access to entity beans is done through the session beans. On the servlet side of things I can get a Home reference to a session bean and create a remote interface and make method calls but when the session bean attempts to perform a findByPrimaryKey method invocation on any entity bean I'm always getting ObjectNotFoundExceptions.
Other strange things I notice is that when I used to deploy my EJBs I'd see the actual SQL table name each entity bean mapped to. Now all of a sudden the table names are appearing as the entity bean names instead and all of the DEBUG level SQL statement messages use the entity bean names rather than the actual Oracle table names.