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 Hammad Sophie <ha...@sibisoft.com> on 2002/05/08 02:25:22 UTC

Using Turbine's TurbineDB.getConnection with jetspeed

Hi.

Here is a problem I am facing. Does anyone know how to solve it?

1. I have configured jetspeed 1.3a3 on tomcat 4.0.3 to use mysql database
for user authentication etc by changing the database connection params in
the Torque.properties file. It works fine.
2. Now I want jetspeed to pick up data from another db in addition to the
one i already have. Piecing together instructions from Turbine, jetspeed,
Torque pages :), I did the following:
a. added the following lines in Torque.properties to access my new database:
(
#testing turbine's dbconnection pooling by adding another db
database.ns=northstar
database.northstar.driver=org.gjt.mm.mysql.Driver
database.northstar.url=jdbc:mysql://localhost:3306/northstar
database.northstar.username=northstar
database.northstar.password=northstar

b. Wrote a simple standalone DBTest class which connects to this database
using: TurbineDB.getConnection("northstar"), does some selects etc. and
displays the information on the screen.

c. The class compiles properly but when I run it I get the following error.
Here is the screen dump:
C:\src\java\northstar>java -classpath
c:\jakarta-tomcat-4.0.3\webapps\testportal\web-inf\lib\turbine-2.2-b2-dev.ja
r;c:\j
akarta-tomcat-4.0.3\webapps\testportal\web-inf\lib\stratum-1.0-b2-dev.jar;.
DBTest
org.apache.turbine.services.InstantiationException: ServiceBroker: unknown
service PoolBrokerService requested
        at
org.apache.turbine.services.BaseServiceBroker.getServiceInstance(BaseService
Broker.java:356)
        at
org.apache.turbine.services.BaseServiceBroker.getService(BaseServiceBroker.j
ava:298)
        at
org.apache.turbine.services.db.TurbineDB.getPoolBroker(TurbineDB.java:340)
        at
org.apache.turbine.services.db.TurbineDB.getConnection(TurbineDB.java:199)
        at DBTest.test(DBTest.java:21) [This is the line where I have the
DBConnection dbConn = TurbineDB.getConnection("northstar");]
        at DBTest.main(DBTest.java:67)

3. I noticed that in the TurbineResources.properties file shipped with
Jetspeed has the following lines:
#services.PoolBrokerService.classname=org.apache.turbine.services.db.Turbine
PoolBrokerService
services.PoolBrokerService.classname=org.apache.jetspeed.services.torquewrap
per.TorquePoolServiceAdaptor

a. When I uncomment the first line, I still get the above mentioned
exception in addition to no longer being able to login to jetspeed... I get
the 'horrible exception'.... :(

b. Even when I change the TurbineDB.getConnection("northstar") to
TurbineDB.getConnection() to make it get the default connection ,it still
doesn't work.

Am I using the TurbineDB object improperly? Would appreciate any help on
this.

Thanks.

Hammad.


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


Re: Using Turbine's TurbineDB.getConnection with jetspeed

Posted by Hugh Brien <hp...@comcast.net>.
Check out your Torque DBTestMap class and  check the database entry
in the following method:

public void doBuild() throws TorqueException
{
        dbMap = Torque.getDatabaseMap("default");  <-- this should be "ns"
...
}

----- Original Message -----
From: "Hammad Sophie" <ha...@sibisoft.com>
To: "Jetspeed Users List" <je...@jakarta.apache.org>
Sent: Tuesday, May 07, 2002 7:25 PM
Subject: Using Turbine's TurbineDB.getConnection with jetspeed


> Hi.
>
> Here is a problem I am facing. Does anyone know how to solve it?
>
> 1. I have configured jetspeed 1.3a3 on tomcat 4.0.3 to use mysql database
> for user authentication etc by changing the database connection params in
> the Torque.properties file. It works fine.
> 2. Now I want jetspeed to pick up data from another db in addition to the
> one i already have. Piecing together instructions from Turbine, jetspeed,
> Torque pages :), I did the following:
> a. added the following lines in Torque.properties to access my new
database:
> (
> #testing turbine's dbconnection pooling by adding another db
> database.ns=northstar
> database.northstar.driver=org.gjt.mm.mysql.Driver
> database.northstar.url=jdbc:mysql://localhost:3306/northstar
> database.northstar.username=northstar
> database.northstar.password=northstar
>
> b. Wrote a simple standalone DBTest class which connects to this database
> using: TurbineDB.getConnection("northstar"), does some selects etc. and
> displays the information on the screen.
>
> c. The class compiles properly but when I run it I get the following
error.
> Here is the screen dump:
> C:\src\java\northstar>java -classpath
>
c:\jakarta-tomcat-4.0.3\webapps\testportal\web-inf\lib\turbine-2.2-b2-dev.ja
> r;c:\j
>
akarta-tomcat-4.0.3\webapps\testportal\web-inf\lib\stratum-1.0-b2-dev.jar;.
> DBTest
> org.apache.turbine.services.InstantiationException: ServiceBroker: unknown
> service PoolBrokerService requested
>         at
>
org.apache.turbine.services.BaseServiceBroker.getServiceInstance(BaseService
> Broker.java:356)
>         at
>
org.apache.turbine.services.BaseServiceBroker.getService(BaseServiceBroker.j
> ava:298)
>         at
> org.apache.turbine.services.db.TurbineDB.getPoolBroker(TurbineDB.java:340)
>         at
> org.apache.turbine.services.db.TurbineDB.getConnection(TurbineDB.java:199)
>         at DBTest.test(DBTest.java:21) [This is the line where I have the
> DBConnection dbConn = TurbineDB.getConnection("northstar");]
>         at DBTest.main(DBTest.java:67)
>
> 3. I noticed that in the TurbineResources.properties file shipped with
> Jetspeed has the following lines:
>
#services.PoolBrokerService.classname=org.apache.turbine.services.db.Turbine
> PoolBrokerService
>
services.PoolBrokerService.classname=org.apache.jetspeed.services.torquewrap
> per.TorquePoolServiceAdaptor
>
> a. When I uncomment the first line, I still get the above mentioned
> exception in addition to no longer being able to login to jetspeed... I
get
> the 'horrible exception'.... :(
>
> b. Even when I change the TurbineDB.getConnection("northstar") to
> TurbineDB.getConnection() to make it get the default connection ,it still
> doesn't work.
>
> Am I using the TurbineDB object improperly? Would appreciate any help on
> this.
>
> Thanks.
>
> Hammad.
>
>
> --
> 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: How to find jetspeed directory in daemon

Posted by Stefan Kuhn <sk...@ice.mpg.de>.
Hi,
digging a bit into jetspeed I found a solution and I thought I could share 
that with you, so here it is:
Actually I don't need RunData, but the servletConfig, so I did:
1) In JetspeedDaemonFactoryService there is inti(ServletConfig). So I put 
ServletConfig in an attribute and instantiate the DaemonThread with it: 
DaemonThread dt = new DaemonThread( entries[i], servcon);         
2) The DaemonThread has a new Constructor    
public DaemonThread( DaemonEntry entry, ServletConfig servcon ) 
Here the ServletConfig is put into an attribute again. In the runDaemon 
method I do
if(daemon.getDaemonEntry().getName().equals("deleteoldmolfiles"))
	((org.openscience.nmrshiftdb.daemons.DeleteOldMolfiles)daemon).run(servcon);
else
	daemon.run();                        
instead of simply daemon.run().
My class, which is run as deleteoldmolfiles, has got an additional run method 
run(ServletConfig servcon) and so I've got the ServletConfig in the run 
method.
If somebody has some improvements ... always wellcome
Stefan




Am Mittwoch, 8. Mai 2002 09:53 schrieben Sie:
> Hi everybody,
> in my code I need to get the jetspeed directory (i. e. something like
> /usr/local/jakarta-tomcat-3.3a/webapps/jetspeed).
> Usually I did that with
> 	String nmrpropsFile =
> ServletUtils.expandRelative(runData.getServletConfig(),
> "/WEB-INF/conf/NMRShiftDB.properties");
>
> Now I need to do that in a jetspeed daemon. The problem is that I do not
> have a rundata object there. So does somebody know either
> 1)How to get the runddata object into the run method of a daemon
> or
> 2)Some other trick to find the jetspeed directory?
> Thanks in advance
> Stefan

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


velocity actions and javascript

Posted by Karen Schuchardt <kl...@pnl.gov>.
Can somebody provide some pointers on  how velocity actions work in relation to
javascript concepts like

location="" in menus
document.myform.action() and
document.myform.submit()

I'm able to do things like create a popup javascript menu with menu options that
create new windows to view documents that are at absolute or relative urls.  This
is good for some of my requirements but I'd also like to be able to define the
button such that it executes a velocity action just as if I had a button on my
form like:
<input type="submit" name="eventSubmit_doSomething" value="Something" />

For the location= assignment in the menu item, I see that I can put absolute urls
and I can put relative urls that jetspeed then puts together with the current
context.  But I don't know how to specify an action to execute and haven't been
able to figure it out from the jetspeed/turbine docs.



I also looked at using a javascript function but again don't know how to specify
an action.  I looked at jlink and how its used in sample .vm scripts but couldn't
find any similar examples.


Any pointers would be appreciated.
Karen



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


How to find jetspeed directory in daemon

Posted by Stefan Kuhn <sk...@ice.mpg.de>.
Hi everybody,
in my code I need to get the jetspeed directory (i. e. something like 
/usr/local/jakarta-tomcat-3.3a/webapps/jetspeed).
Usually I did that with 
	String nmrpropsFile =
ServletUtils.expandRelative(runData.getServletConfig(), 
"/WEB-INF/conf/NMRShiftDB.properties");

Now I need to do that in a jetspeed daemon. The problem is that I do not have 
a rundata object there. So does somebody know either
1)How to get the runddata object into the run method of a daemon
or
2)Some other trick to find the jetspeed directory?
Thanks in advance
Stefan 

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


RE: Using Turbine's TurbineDB.getConnection with jetspeed

Posted by Chris Kimpton <ki...@yahoo.com>.
Hi,

--- Hammad Sophie <ha...@sibisoft.com> wrote:
> 
> It worked using Torque. I wish this kind of stuff was documented
> somewhere!
> 
> Basically I had to do the following:
> 1. import the following classes:
> 	import org.apache.torque.pool.DBConnection;
> 	import org.apache.torque.Torque;
> 
> 2. Initialize Torque and call the classes:
> 			if (Torque.isInit() == false)
>
Torque.init("c:/jakarta-tomcat-4.0.3/webapps/testportal/web-inf/conf/Torque.
> properties");

This shouldn't be needed - as it should be being done inside
Jetspeed...

> 
> I was hoping if you could answer this question as well:
> All the example portlets/actions included with Jetspeed that access
> the db
> are using TurbineDB to manage the connection which is why I had set
> out to
> use TurbineDB as well. If I'm writing my own portlets, will I have
> to use
> TurbineDB.getConnection() or Torque.getConnection()? I am kind of
> confused
> now.....
> 

Turbine is moving from the embedded Torque (ie using TurbineDB) to a
separate Torque (using Torque directly).

So, old code will use TurbineDB and will need to change eventually.

The reason the old code still works is that I've put in a Turbine
like wrapper around the new Torque Pool connection - so it thinks its
talking to the old TurbineDB stuff, but really talks to Torque.

I guess that the wrapper does not quite work for non-default db's -
which is why you got a problem.  

I am surprised that you needed to do the Torque init.  I think this
should be being done by the Turbine component bootstrap processing...

HTH,
Chris

=====
------------------------------------------
http://www.soccer2002.org.uk - The Game is On!

__________________________________________________
Do You Yahoo!?
Yahoo! Shopping - Mother's Day is May 12th!
http://shopping.yahoo.com

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


RE: Using Turbine's TurbineDB.getConnection with jetspeed

Posted by Hammad Sophie <ha...@sibisoft.com>.
Thanks Chris. I appreciate your help!

It worked using Torque. I wish this kind of stuff was documented somewhere!

Basically I had to do the following:
1. import the following classes:
	import org.apache.torque.pool.DBConnection;
	import org.apache.torque.Torque;

2. Initialize Torque and call the classes:
			if (Torque.isInit() == false)
Torque.init("c:/jakarta-tomcat-4.0.3/webapps/testportal/web-inf/conf/Torque.
properties");
			else System.out.println("Torque has been inited");
			dbConn = Torque.getConnection("northstar");
			Connection con = dbConn.getConnection();

I was hoping if you could answer this question as well:
All the example portlets/actions included with Jetspeed that access the db
are using TurbineDB to manage the connection which is why I had set out to
use TurbineDB as well. If I'm writing my own portlets, will I have to use
TurbineDB.getConnection() or Torque.getConnection()? I am kind of confused
now.....

Thanks once again.

Hammad.


-----Original Message-----
From: Chris Kimpton [mailto:kimptoc_mail@yahoo.com]
Sent: Wednesday, May 08, 2002 12:13 AM
To: Jetspeed Users List
Subject: Re: Using Turbine's TurbineDB.getConnection with jetspeed


Hi,

--- Hammad Sophie <ha...@sibisoft.com> wrote:
>
> 1. I have configured jetspeed 1.3a3 on tomcat 4.0.3 to use mysql

I don't think Jetspeed and Tomcat4.0.3 play together - I reccomend
using 3.3.1... although this is unlikely to be your current problem -
but you will probably get other problems due to this later...

[snip]
looks good so far...


>
> 3. I noticed that in the TurbineResources.properties file shipped
> with
> Jetspeed has the following lines:
>
#services.PoolBrokerService.classname=org.apache.turbine.services.db.Turbine
> PoolBrokerService
>
services.PoolBrokerService.classname=org.apache.jetspeed.services.torquewrap
> per.TorquePoolServiceAdaptor
>
> a. When I uncomment the first line, I still get the above mentioned
> exception in addition to no longer being able to login to
> jetspeed... I get
> the 'horrible exception'.... :(

When you did this, you enabled the old Turbine DB pool mechanism -
this will try and look for configuration in the TR.props file...

>
> b. Even when I change the TurbineDB.getConnection("northstar") to
> TurbineDB.getConnection() to make it get the default connection ,it
> still
> doesn't work.
>

I think the problem is down to using TurbineDB - its trying to use
the old Turbine db pooling.

You should use Torque.getConnection("northstar")

HTH,
Chris

=====
------------------------------------------
http://www.soccer2002.org.uk - The Game is On!

__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com

--
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: Using Turbine's TurbineDB.getConnection with jetspeed

Posted by Chris Kimpton <ki...@yahoo.com>.
Hi,

--- Hammad Sophie <ha...@sibisoft.com> wrote:
> 
> 1. I have configured jetspeed 1.3a3 on tomcat 4.0.3 to use mysql

I don't think Jetspeed and Tomcat4.0.3 play together - I reccomend
using 3.3.1... although this is unlikely to be your current problem -
but you will probably get other problems due to this later...

[snip]
looks good so far...


> 
> 3. I noticed that in the TurbineResources.properties file shipped
> with
> Jetspeed has the following lines:
>
#services.PoolBrokerService.classname=org.apache.turbine.services.db.Turbine
> PoolBrokerService
>
services.PoolBrokerService.classname=org.apache.jetspeed.services.torquewrap
> per.TorquePoolServiceAdaptor
> 
> a. When I uncomment the first line, I still get the above mentioned
> exception in addition to no longer being able to login to
> jetspeed... I get
> the 'horrible exception'.... :(

When you did this, you enabled the old Turbine DB pool mechanism -
this will try and look for configuration in the TR.props file...

> 
> b. Even when I change the TurbineDB.getConnection("northstar") to
> TurbineDB.getConnection() to make it get the default connection ,it
> still
> doesn't work.
> 

I think the problem is down to using TurbineDB - its trying to use
the old Turbine db pooling.

You should use Torque.getConnection("northstar")

HTH,
Chris

=====
------------------------------------------
http://www.soccer2002.org.uk - The Game is On!

__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com

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