Whoa! Total wierdness! Rickard, I have done what you said even before
you suggested it, and it just wasn't working that way. Until I removed
the resource-ref from ejb-jar.xml. Now it works fine! If I put the ref
back in again and re-deploy, goes back to using the default db!!!!
WTF! That seems a little twisted. Could this be a bug? Or am I
totally misconstruing what a resource-ref is for?
Here is what I see in the log, first without the resource-ref, then with
it:
[Auto deploy] Auto deploy of file:/usr/local/jboss2/deploy/simplecmp.jar
[Container factory]
Undeploying:file:/usr/local/jboss2/deploy/simplecmp.jar
[Container factory] Undeployed application:
file:/usr/local/jboss2/deploy/simplecmp.jar
[Container factory]
Deploying:file:/usr/local/jboss2/deploy/simplecmp.jar
[Container factory] Loading ejb-jar.xml :
jar:file:/tmp/tmpejbjar8622.jar!/META-INF/ejb-jar.xml
[Container factory] Loading standardjboss.xml :
jar:file:/usr/local/jboss2/lib/ext/jboss.jar!/org/jboss/metadata/standardjboss.xml
[Container factory] Deploying SimpleCmp
[JAWS] Initializing JAWS plugin for SimpleCmp
[Container factory] Caught SQL NPE on JawsCMPField!
[Container factory] Caught JDBC NPE on JawsCMPField!
[Container factory] Caught SQL NPE on JawsCMPField!
[Container factory] Caught JDBC NPE on JawsCMPField!
[Container factory] Caught SQL NPE on JawsCMPField!
[Container factory] Caught JDBC NPE on JawsCMPField!
[Container factory] Caught SQL NPE on JawsCMPField!
[Container factory] Caught JDBC NPE on JawsCMPField!
[Container factory] Caught SQL NPE on JawsCMPField!
[Container factory] Caught JDBC NPE on JawsCMPField!
[JAWS] Init SQL: CREATE TABLE SimpleCmp (id INTEGER,title
VARCHAR(256),lastName VARCHAR(256),middleName VARCHAR(256),firstName
VARCHAR(256))
[JAWS] Destroy SQL: DROP TABLE SimpleCmp
[JAWS] Exists SQL: SELECT COUNT(*) AS Total FROM SimpleCmp WHERE id=?
[JAWS] Create SQL: INSERT INTO SimpleCmp
(id,title,lastName,middleName,firstName) VALUES (?,?,?,?,?)
[JAWS] Remove SQL: DELETE FROM SimpleCmp WHERE id=?
[JAWS] Load SQL: SELECT id,title,lastName,middleName,firstName FROM
SimpleCmp WHERE id=?
[JAWS] Store SQL: UPDATE SimpleCmp SET
id=?,title=?,lastName=?,middleName=?,firstName=? WHERE id=?
[Container factory] Bound SimpleCmp to SimpleCmp
[Container factory] Deployed application:
file:/usr/local/jboss2/deploy/simplecmp.jar
Now, with the ref:
[Auto deploy] Auto deploy of file:/usr/local/jboss2/deploy/simplecmp.jar
[Container factory]
Undeploying:file:/usr/local/jboss2/deploy/simplecmp.jar
[Container factory] Undeployed application:
file:/usr/local/jboss2/deploy/simplecmp.jar
[Container factory]
Deploying:file:/usr/local/jboss2/deploy/simplecmp.jar
[Container factory] Loading ejb-jar.xml :
jar:file:/tmp/tmpejbjar8623.jar!/META-INF/ejb-jar.xml
[Container factory] Loading standardjboss.xml :
jar:file:/usr/local/jboss2/lib/ext/jboss.jar!/org/jboss/metadata/standardjboss.xml
[Container factory] Deploying SimpleCmp
[Container factory] Using default DataSource:InstantDB
[JAWS] Initializing JAWS plugin for SimpleCmp
[Container factory] Caught SQL NPE on JawsCMPField!
[Container factory] Caught JDBC NPE on JawsCMPField!
[Container factory] Caught SQL NPE on JawsCMPField!
[Container factory] Caught JDBC NPE on JawsCMPField!
[Container factory] Caught SQL NPE on JawsCMPField!
[Container factory] Caught JDBC NPE on JawsCMPField!
[Container factory] Caught SQL NPE on JawsCMPField!
[Container factory] Caught JDBC NPE on JawsCMPField!
[Container factory] Caught SQL NPE on JawsCMPField!
[Container factory] Caught JDBC NPE on JawsCMPField!
[JAWS] Init SQL: CREATE TABLE SimpleCmp (middleName VARCHAR(256),id
INTEGER,title VARCHAR(256),firstName VARCHAR(256),lastName VARCHAR(256))
[JAWS] Destroy SQL: DROP TABLE SimpleCmp
[JAWS] Exists SQL: SELECT COUNT(*) AS Total FROM SimpleCmp WHERE id=?
[JAWS] Create SQL: INSERT INTO SimpleCmp
(middleName,id,title,firstName,lastName) VALUES (?,?,?,?,?)
[JAWS] Remove SQL: DELETE FROM SimpleCmp WHERE id=?
[JAWS] Load SQL: SELECT middleName,id,title,firstName,lastName FROM
SimpleCmp WHERE id=?
[JAWS] Store SQL: UPDATE SimpleCmp SET
middleName=?,id=?,title=?,firstName=?,lastName=? WHERE id=?
[Container factory] Bound SimpleCmp to SimpleCmp
[Container factory] Deployed application:
file:/usr/local/jboss2/deploy/simplecmp.jar
Rickard �berg wrote:
>
> Hi!
>
> Jeffrey Bonevich wrote:
> > I am using Jboss (CVS build) and PostgreSQL for my entity bean
> > experimentation. As the discussion on this list has oh so amply
> > described it, I should not need to create a jboss.xml. I create an
> > ejb-jar.xml file with the appropriate cmp fields as well as a resource
> > ref:
> >
> > <resource-ref>
> > <res-ref-name>Postgresql</res-ref-name>
> > <res-type>javax.sql.DataSource</res-type>
> > <res-auth>Container</res-auth>
> > </resource-ref>
> >
> > I also create a jaws.xml file that sets the mapping of the bean to
> > PostgreSQL type-mappings, etc. I understand that soon, this too will
> > not be needed for deployment.
> >
> > When I deploy the beans, they always end up using the default datasource
> > (InstantDB) despite the resource ref mentioned in ejb-jar.xml. (Yes, I
> > have PostgreSQL setup as a datasource in jboss.conf, etc., bound to
> > Postgresql jndi name). Why? Is this the correct behavior?
> >
> > I can only get the bean to use postgres if I create a jboss.xml file
> > that contains the same info - the bean is an entity bean, Default CMP
> > EntityBean conf, resource-ref is Postgresql. Seems like overkill to
> > have to do this twice? Or am I confusing the meaning of the two
> > resource-refs?
>
> To use a new DataSource you need to do two things:
> * Create it in jboss.conf
> * Point to it in jaws.xml (use GUI editor to edit)
>
> Note: no need for resource ref in ejb-jar.xml!
>
> That will be enough.
>
> regards,
> Rickard
>
> --
> Rickard �berg
>
> Email: [EMAIL PROTECTED]
> http://www.telkel.com
> http://www.jboss.org
> http://www.dreambean.com
>
> --
> --------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> Problems?: [EMAIL PROTECTED]
--
Jeffrey & Nikole Bonevich
Maxmillian Bonevich
Ann Arbor, Michigan
[EMAIL PROTECTED]
http://www.bonevich.com
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]