CMP with Postgres
g_spelvin Dec 15, 2002 6:06 PMProblem: entity bean not stored in postgres, but is looked up there.
Result: postgres returns SQLException: Relation "helloentity" does not exist
JBoss postgress datasource config:
Removed both hs plugin and driver jars from server/default/lib/
Removed hsqldb-service.xml from server/default/deploy/
Added postgres-service.xml to server/default/deploy/
(tried both jndi names as PostgresDS or DefaultDS and matched name in server/default/conf/standardjaws.xml and server/default/conf/standardjbosscmp-jdbc.xml)
Edited server/default/conf/login-config.xml
Added postgress pg73j2ee.jar to lib/
JBoss in its default configuration worked well with the Hypersonic db and was able to persist and look up entity beans. In the current config, this is what JBoss writes out when deploying the app:
14:44:00,250 INFO [MainDeployer] Starting deployment of package: file:/usr/local/jboss/jboss-3.0.4_tomcat-4.1.12/server/default/deploy/HelloEntity.ear
14:44:00,289 INFO [EARDeployer] Init J2EE application: file:/usr/local/jboss/jboss-3.0.4_tomcat-4.1.12/server/default/deploy/HelloEntity.ear
14:44:01,373 INFO [EjbModule] Creating
14:44:01,446 INFO [EjbModule] Deploying HelloEntity
14:44:04,143 INFO [JDBCInitCommand] Table 'HelloEntity' already exists
14:44:04,329 INFO [EjbModule] Created
14:44:04,334 INFO [EjbModule] Starting
14:44:04,573 INFO [EjbModule] Started
14:44:04,979 INFO [EmbeddedCatalinaService41] deploy, ctxPath=/HelloEntity, warUrl=file:/usr/local/jboss/jboss-3.0.4_tomcat-4.1.12/server/default/tmp/deploy/server/default/deploy/HelloEntity.ear/87.HelloEntity.ear-contents/HelloEntity.war
14:44:05,208 INFO [Engine] WebappLoader[/HelloEntity]: Deploying class repositories to work directory /usr/local/jboss/jboss-3.0.4_tomcat-4.1.12/tomcat-4.1.x/work/MainEngine/localhost/HelloEntity
14:44:05,252 INFO [Engine] WebappLoader[/HelloEntity]: Deploy class files /WEB-INF/classes to /usr/local/jboss/jboss-3.0.4_tomcat-4.1.12/tomcat-4.1.x/work/MainEngine/localhost/HelloEntity/WEB-INF/classes
14:44:06,370 INFO [Engine] ContextConfig[/HelloEntity]: Added certificates -> request attribute Valve
14:44:07,539 INFO [EmbeddedCatalinaService41] Using Java2 parent classloader delegation: true
14:44:07,543 INFO [Engine] StandardManager[/HelloEntity]: Seeding random number generator class java.security.SecureRandom
14:44:07,548 INFO [Engine] StandardManager[/HelloEntity]: Seeding of random number generator has been completed
14:44:07,651 INFO [Engine] StandardWrapper[/HelloEntity:default]: Loading container servlet default
14:44:07,656 INFO [Engine] StandardWrapper[/HelloEntity:invoker]: Loading container servlet invoker
14:44:07,765 INFO [MainDeployer] Deployed package: file:/usr/local/jboss/jboss-3.0.4_tomcat-4.1.12/server/default/deploy/HelloEntity.ear
Servlet code:
ctx = new InitialContext();
home = (HelloEntityHome) PortableRemoteObject.narrow(ctx.lookup("HelloEntity"),
HelloEntityHome.class);
ejb-jar.xml:
Person bean
<ejb-name>HelloEntity</ejb-name>
HelloEntityHome
HelloEntity
<ejb-class>HelloEntityEJB</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.String</prim-key-class>
<primkey-field>name</primkey-field>
False
<cmp-field><field-name>name</field-name></cmp-field>
<cmp-field><field-name>email</field-name></cmp-field>
Where then is the bean stored? Could this be a problem in tomcat config? I logged in to psql monitor and can't see any HelloEntity table, but I see the error as it occurs.
Any help will be greatly appreciated.