You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by Bill Weir <bi...@outsourceadvice.com> on 2002/12/05 23:21:09 UTC

Connecting Jetspeed to Torque to Oracle

Hi,

I've spent two or three days trying to figure some of this stuff out, and
I'd be *really* happy if someone could help me.

Basically I'm trying to add a portlet in the style of DatabaseBrowserTest,
but connecting to an Oracle database of my own instead of to the default
HSQL coffees table. I don't mind if the user/turbine tables are kept in HSQL
or Oracle.

So here's what I've done succesfully:
* Gotten the distributed jetspeed binary (of 12/3/02) up: it works fine.
* Established a workable JDBC connection to the (remote) Oracle 732 database
using Oracle JDBC drivers and JDK1.4

But I'm having trouble connecting jetspeed-turbine to JDBC
* I tried configuring the Torque.properties like this:
--------------------
database.default=default
database.default.driver=oracle.jdbc.driver.OracleDriver
database.default.url=jdbc:oracle:thin:@oraclehost:1521:eza
database.default.username=<valid login>
database.default.password=<valid password>
database.adaptor=DBOracle
#database.adaptor.DBOracle=oracle.jdbc.driver.OracleDriver
database.adaptor.DBOracle=org.apache.turbine.util.db.adapter.DBOracle
--------------------
...and I have DBOracle.class in turbine-2.2-b2-dev.jar, in my CLASSPATH...
...I also tried Oracle's own driver (commented out above)...
but in both cases I got this:
------------------
Horrible Exception: java.lang.Error: Error in
BasePeer.initTableSchema(TURBINE_USER): No suitable driver
	at
org.apache.jetspeed.om.security.turbine.BaseTurbineUserPeer.initClass(BaseTu
rbineUserPeer.java:130)
	at
org.apache.jetspeed.om.security.turbine.BaseTurbineUserPeer.<clinit>(BaseTur
bineUserPeer.java:109)
	at
org.apache.jetspeed.services.security.turbine.TurbineUserManagement.getUser(
TurbineUserManagement.java:164)
	at
org.apache.jetspeed.services.JetspeedUserManagement.getUser(JetspeedUserMana
gement.java:98)
-------------------
* Then I tried turning my own demonstrably working jdbc test app into a
portlet. I deployed it with ant, but something about the (valid) Oracle
calls makes the entire display frame disappear.
* Then I tried deploying a standalone Turbine in it's own little sandbox to
see if I could get some good configuration data. I *was* able to get "ant
init" to connect and build the turbine tables, but the resulting test app
site kept asking me to login, never actually giving me any data.


SO!

I can't think of anything else to try.

Can someone point me in a productive direction? I'm biting my leg off with
frustration.

Thanks,

Bill


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Connecting Jetspeed to Torque to Oracle

Posted by Bill Weir <bi...@outsourceadvice.com>.
So I have worked for a couple of days on the sources and learned much about
Jetspeed, Turbine, Torque, Maven and finally log4j. Because I'm on the early
learning curve here, I may be making another dumb mistake, but when I get
everything else in place, I still get an Oracle eror (see below). I couldn't
find reference to this in the Users List.

I was able to get debug from log4j that said the SQL being executed is:

SELECT TURBINE_USER_GROUP_ROLE.USER_ID, TURBINE_USER_GROUP_ROLE.GROUP_ID,
TURBINE_USER_GROUP_ROLE.ROLE_ID FROM TURBINE_USER_GROUP_ROLE WHERE
TURBINE_USER_GROUP_ROLE.USER_ID='anon'

...whereas src/sql/external/turbine_oracle.sql says:

CREATE TABLE TURBINE_USER_GROUP_ROLE
(
    USER_ID NUMBER NOT NULL,
    GROUP_ID NUMBER NOT NULL,
    ROLE_ID NUMBER NOT NULL
);

...and populate-oracle.sql says:

INSERT INTO TURBINE_USER_GROUP_ROLE
VALUES(getUserId('turbine'),getGroupId('Jetspeed'),getRoleId('user'));
INSERT INTO TURBINE_USER_GROUP_ROLE
VALUES(getUserId('admin'),getGroupId('Jetspeed'),getRoleId('user'));
INSERT INTO TURBINE_USER_GROUP_ROLE
VALUES(getUserId('admin'),getGroupId('Jetspeed'),getRoleId('admin'));
INSERT INTO TURBINE_USER_GROUP_ROLE
VALUES(getUserId('anon'),getGroupId('Jetspeed'),getRoleId('guest'));

...and as you'd expect:
SQL> select * from turbine_user_group_role;
...gives:
   USER_ID   GROUP_ID    ROLE_ID
---------- ---------- ----------
         2          1          1
         1          1          1
         1          1          2
         3          1          3

...in other words, the query's where clause is comparing a string value with
a numeric value, hence ORA-01722.

I apologize if I simply have the wrong versions of something. I'm using
torque-3.0 (turbine-2.2), jetspeed 1.4. Basically, everything taken from CVS
as at 04-Dec-2002.

Am I missing something?

Bill

> > -----Original Message-----
> > From: Bill Weir [mailto:bill.weir@outsourceadvice.com]
> > Sent: Thursday, December 05, 2002 6:19 PM
...
> >     [junit] Failed to get anonymous user:
> > org.apache.jetspeed.services.security.RoleException: Failed to retrieve
> > roles : ORA-01722: invalid number
> >
> >     [junit] org.apache.jetspeed.services.security.LoginException:
> > Failed to
> > get anonymous user: org.apache.jetspeed.services.security.RoleException:
> > Failed to retrieve roles : ORA-01722: invalid number
> >     [junit]     at
> > org.apache.jetspeed.services.security.turbine.TurbineAuthenticatio
> > n.getAnony
> > mousUser(TurbineAuthentication.java:22
...
> Did you run the database populate script too?
> (populate-oracle.sql)
>
  (yes, after I got my classpath right, doh!)


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Connecting Jetspeed to Torque to Oracle

Posted by David Sean Taylor <da...@bluesunrise.com>.
> -----Original Message-----
> From: Bill Weir [mailto:bill.weir@outsourceadvice.com]
> Sent: Thursday, December 05, 2002 6:19 PM
> To: Jetspeed Users List
> Subject: RE: Connecting Jetspeed to Torque to Oracle
>
>
> David,
>
> Thank you much for your help.
>
> I've followed your instruction by re-installing Tomcat, building Jetspeed
> from the most recent source (12/4), by using your Torque.properties
> (including variants), and running "ant unittest-security", which
> reports all
> OK on HSQL. Further, I used the src/sql scripts for oracle (from the JS
> source) to recreate the database in Oracle.
>
> But jetspeed is insistent that, against Oracle:
>
> ---------------------------------------------------
> Horrible Exception: java.lang.Error: Error in
> BasePeer.initTableSchema(TURBINE_USER): There was no DataSourceFactory
> configured for the connection default

Isnt that the cryptic error when the driver isn't found.
Where did you put the driver?
Is it a jar or a zip?

> 	at
> org.apache.jetspeed.om.security.turbine.BaseTurbineUserPeer.initCl
> ass(BaseTu
> rbineUserPeer.java:154)
> 	at
> org.apache.jetspeed.om.security.turbine.BaseTurbineUserPeer.<clini
> t>(BaseTur
> bineUserPeer.java:128)
> ---------------------------------------------------
>
> The Torque.properties now read
> #--------------------------------------------------
> torque.database.default.adapter=oracle
>
> torque.dsfactory.default.factory=org.apache.torque.dsfactory.Torqu
> eDataSourc
> eFactory
> torque.dsfactory.default.pool.defaultMaxConnections=10
> torque.dsfactory.default.pool.maxExpiryTime=3600
> torque.dsfactory.default.pool.connectionWaitTimeout=10
> torque.dsfactory.default.connection.driver=oracle.jdbc.driver.OracleDriver
> torque.dsfactory.default.connection.url=jdbc:oracle:thin:@<valid
> host>:<valid port>:eza
> torque.dsfactory.default.connection.user=<valid user>
> torque.dsfactory.default.connection.password=<valid password>
> #----------------------------------------------------
>

looks fine

>
> strangely, "ant unittest-security" test is saying
> #----------------------------------------------------
>     [junit] Failed to get anonymous user:
> org.apache.jetspeed.services.security.RoleException: Failed to retrieve
> roles : ORA-01722: invalid number
>
>     [junit] org.apache.jetspeed.services.security.LoginException:
> Failed to
> get anonymous user: org.apache.jetspeed.services.security.RoleException:
> Failed to retrieve roles : ORA-01722: invalid number
>     [junit]     at
> org.apache.jetspeed.services.security.turbine.TurbineAuthenticatio
> n.getAnony
> mousUser(TurbineAuthentication.java:22
> #----------------------------------------------------
>
>
> I'm trolling through source right now, but you have any other suggestions?
>
invalid number?
Search the mailing list. Think I've seen that one before too, but don't
remember why

Did you run the database populate script too?
(populate-oracle.sql)



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Connecting Jetspeed to Torque to Oracle

Posted by Bill Weir <bi...@outsourceadvice.com>.
David,

Thank you much for your help.

I've followed your instruction by re-installing Tomcat, building Jetspeed
from the most recent source (12/4), by using your Torque.properties
(including variants), and running "ant unittest-security", which reports all
OK on HSQL. Further, I used the src/sql scripts for oracle (from the JS
source) to recreate the database in Oracle.

But jetspeed is insistent that, against Oracle:

---------------------------------------------------
Horrible Exception: java.lang.Error: Error in
BasePeer.initTableSchema(TURBINE_USER): There was no DataSourceFactory
configured for the connection default
	at
org.apache.jetspeed.om.security.turbine.BaseTurbineUserPeer.initClass(BaseTu
rbineUserPeer.java:154)
	at
org.apache.jetspeed.om.security.turbine.BaseTurbineUserPeer.<clinit>(BaseTur
bineUserPeer.java:128)
---------------------------------------------------

The Torque.properties now read
#--------------------------------------------------
torque.database.default.adapter=oracle

torque.dsfactory.default.factory=org.apache.torque.dsfactory.TorqueDataSourc
eFactory
torque.dsfactory.default.pool.defaultMaxConnections=10
torque.dsfactory.default.pool.maxExpiryTime=3600
torque.dsfactory.default.pool.connectionWaitTimeout=10
torque.dsfactory.default.connection.driver=oracle.jdbc.driver.OracleDriver
torque.dsfactory.default.connection.url=jdbc:oracle:thin:@<valid
host>:<valid port>:eza
torque.dsfactory.default.connection.user=<valid user>
torque.dsfactory.default.connection.password=<valid password>
#----------------------------------------------------


strangely, "ant unittest-security" test is saying
#----------------------------------------------------
    [junit] Failed to get anonymous user:
org.apache.jetspeed.services.security.RoleException: Failed to retrieve
roles : ORA-01722: invalid number

    [junit] org.apache.jetspeed.services.security.LoginException: Failed to
get anonymous user: org.apache.jetspeed.services.security.RoleException:
Failed to retrieve roles : ORA-01722: invalid number
    [junit]     at
org.apache.jetspeed.services.security.turbine.TurbineAuthentication.getAnony
mousUser(TurbineAuthentication.java:22
#----------------------------------------------------


I'm trolling through source right now, but you have any other suggestions?

Bill


-----Original Message-----
From: David Sean Taylor [mailto:david@bluesunrise.com]
Sent: Thursday, December 05, 2002 2:57 PM
To: Jetspeed Users List
Subject: RE: Connecting Jetspeed to Torque to Oracle


> -----Original Message-----
> From: Bill Weir [mailto:bill.weir@outsourceadvice.com]
> Sent: Thursday, December 05, 2002 2:21 PM
> To: jetspeed-user@jakarta.apache.org
> Subject: Connecting Jetspeed to Torque to Oracle
>
>
> Hi,
>
> I've spent two or three days trying to figure some of this stuff out, and
> I'd be *really* happy if someone could help me.
>
> Basically I'm trying to add a portlet in the style of DatabaseBrowserTest,
> but connecting to an Oracle database of my own instead of to the default
> HSQL coffees table. I don't mind if the user/turbine tables are
> kept in HSQL
> or Oracle.
>
> So here's what I've done succesfully:
> * Gotten the distributed jetspeed binary (of 12/3/02) up: it works fine.
> * Established a workable JDBC connection to the (remote) Oracle
> 732 database
> using Oracle JDBC drivers and JDK1.4
>
> But I'm having trouble connecting jetspeed-turbine to JDBC
> * I tried configuring the Torque.properties like this:
> --------------------
> database.default=default
> database.default.driver=oracle.jdbc.driver.OracleDriver
> database.default.url=jdbc:oracle:thin:@oraclehost:1521:eza
> database.default.username=<valid login>
> database.default.password=<valid password>
> database.adaptor=DBOracle
> #database.adaptor.DBOracle=oracle.jdbc.driver.OracleDriver
> database.adaptor.DBOracle=org.apache.turbine.util.db.adapter.DBOracle

The properties above are not from the webapp/WEB-INF/conf/Torque.properties
from Dec.02, 2002 build.
That's the old format from Torque. Go here to see a valid Torque.properties:

http://cvs.apache.org/viewcvs/jakarta-jetspeed/webapp/WEB-INF/conf/Torque.pr
operties?rev=1.7&content-type=text/vnd.viewcvs-markup

I just downloaded the Dec.02 build and verified. The lines above we're not
taken from the Dec.02 build of Torque.properties.

Recommend starting with a clean build.
Try makin these changes to the Torque.properties from the Dec.02, 2002
build.

----------------------------------------------------------------------------
-------

torque.database.default=default
###torque.database.default.adapter=hypersonic
torque.database.default.adapter=oracle

###torque.dsfactory.default.connection.driver = org.hsqldb.jdbcDriver
###torque.dsfactory.default.connection.url =
jdbc:hsqldb:${webappRoot}/WEB-INF/db/jetspeed
###torque.dsfactory.default.connection.user = sa
###torque.dsfactory.default.connection.password =

torque.dsfactory.default.connection.driver = oracle.jdbc.driver.OracleDriver
 torque.dsfactory.default.connection.url =
jdbc:oracle:thin:@nirvana:1521:bluesun3
### torque.dsfactory.default.connection.user =  jetspeed
### torque.dsfactory.default.connection.password = jetspeed

----------------------------------------------------------------------------
-------

I always test new drivers with the unit tests. (You need to dl the src to do
so.)
1. Setup up your Torque.properties.
2. Put your Oracle driver in the lib directory.
3. Run "ant unittest-security" from the build directory.



--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Connecting Jetspeed to Torque to Oracle

Posted by David Sean Taylor <da...@bluesunrise.com>.
> -----Original Message-----
> From: Bill Weir [mailto:bill.weir@outsourceadvice.com]
> Sent: Thursday, December 05, 2002 2:21 PM
> To: jetspeed-user@jakarta.apache.org
> Subject: Connecting Jetspeed to Torque to Oracle
>
>
> Hi,
>
> I've spent two or three days trying to figure some of this stuff out, and
> I'd be *really* happy if someone could help me.
>
> Basically I'm trying to add a portlet in the style of DatabaseBrowserTest,
> but connecting to an Oracle database of my own instead of to the default
> HSQL coffees table. I don't mind if the user/turbine tables are
> kept in HSQL
> or Oracle.
>
> So here's what I've done succesfully:
> * Gotten the distributed jetspeed binary (of 12/3/02) up: it works fine.
> * Established a workable JDBC connection to the (remote) Oracle
> 732 database
> using Oracle JDBC drivers and JDK1.4
>
> But I'm having trouble connecting jetspeed-turbine to JDBC
> * I tried configuring the Torque.properties like this:
> --------------------
> database.default=default
> database.default.driver=oracle.jdbc.driver.OracleDriver
> database.default.url=jdbc:oracle:thin:@oraclehost:1521:eza
> database.default.username=<valid login>
> database.default.password=<valid password>
> database.adaptor=DBOracle
> #database.adaptor.DBOracle=oracle.jdbc.driver.OracleDriver
> database.adaptor.DBOracle=org.apache.turbine.util.db.adapter.DBOracle

The properties above are not from the webapp/WEB-INF/conf/Torque.properties
from Dec.02, 2002 build.
That's the old format from Torque. Go here to see a valid Torque.properties:

http://cvs.apache.org/viewcvs/jakarta-jetspeed/webapp/WEB-INF/conf/Torque.pr
operties?rev=1.7&content-type=text/vnd.viewcvs-markup

I just downloaded the Dec.02 build and verified. The lines above we're not
taken from the Dec.02 build of Torque.properties.

Recommend starting with a clean build.
Try makin these changes to the Torque.properties from the Dec.02, 2002
build.

----------------------------------------------------------------------------
-------

torque.database.default=default
###torque.database.default.adapter=hypersonic
torque.database.default.adapter=oracle

###torque.dsfactory.default.connection.driver = org.hsqldb.jdbcDriver
###torque.dsfactory.default.connection.url =
jdbc:hsqldb:${webappRoot}/WEB-INF/db/jetspeed
###torque.dsfactory.default.connection.user = sa
###torque.dsfactory.default.connection.password =

torque.dsfactory.default.connection.driver = oracle.jdbc.driver.OracleDriver
 torque.dsfactory.default.connection.url =
jdbc:oracle:thin:@nirvana:1521:bluesun3
### torque.dsfactory.default.connection.user =  jetspeed
### torque.dsfactory.default.connection.password = jetspeed

----------------------------------------------------------------------------
-------

I always test new drivers with the unit tests. (You need to dl the src to do
so.)
1. Setup up your Torque.properties.
2. Put your Oracle driver in the lib directory.
3. Run "ant unittest-security" from the build directory.



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>