Re: Using J2EE datasources

2002-09-23 Thread JohnsBrn

Also, I'd check out the commons source to see what exactly it's choking on.

[EMAIL PROTECTED] wrote:

>This looks like a Tomcat issue to me at this point. After looking around at some 
>Tomcat docs, the only two suggestions I have are that you do not have an AuthType 
>specified in your Resource tag (auth="Container"). I don't know if this is required. 
>Also, did you check to make sure you updated the name in your ResourceParams entry to 
>add jdbc/. Everything seems to be working OK on the Cocoon side I think.
>
>Ugo Cei <[EMAIL PROTECTED]> wrote:
>
>>[EMAIL PROTECTED] wrote:
>>> Are you sure you have a valid datasource in Tomcat? Looks like it's having trouble 
>creating a connection. I noticed 
>>> oracl.jdbc.driver.OracleDriver 
>>> contains a type-o. Shouldn't it be oracle.jdbc.driver.OracleDriver instead of 
>oracl with no e?
>>
>>The error is just a typo due to cut&paste. The name of the class is 
>>correct in the server.xml file. But yes, it looks like Tomcat has 
>>troubles creating a connection, even though all it reports in his logs 
>>is the following:
>>
>>DBCP DataSource configured without a 'username'
>>
>>which I can't figure out because I sure have a username in the 
>>datasource configuration.
>>
>>Ugo
>>
>>-- 
>>Ugo Cei - Consorzio di Bioingegneria e Informatica Medica
>>P.le Volontari del Sangue, 2 - 27100 Pavia - Italy
>>Phone: +39.0382.525100 - E-mail: [EMAIL PROTECTED]
>>
>>
>>-
>>Please check that your question  has not already been answered in the
>>FAQ before posting. 
>>
>>To unsubscribe, e-mail: <[EMAIL PROTECTED]>
>>For additional commands, e-mail:   <[EMAIL PROTECTED]>
>>
>>
>
>__
>The NEW Netscape 7.0 browser is now available. Upgrade now! 
>http://channels.netscape.com/ns/browsers/download.jsp 
>
>Get your own FREE, personal Netscape Mail account today at 
>http://webmail.netscape.com/
>
>-
>Please check that your question  has not already been answered in the
>FAQ before posting. 
>
>To unsubscribe, e-mail: <[EMAIL PROTECTED]>
>For additional commands, e-mail:   <[EMAIL PROTECTED]>
>
>

__
The NEW Netscape 7.0 browser is now available. Upgrade now! 
http://channels.netscape.com/ns/browsers/download.jsp 

Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/

-
Please check that your question  has not already been answered in the
FAQ before posting. 

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>




Re: Using J2EE datasources

2002-09-23 Thread JohnsBrn

This looks like a Tomcat issue to me at this point. After looking around at some 
Tomcat docs, the only two suggestions I have are that you do not have an AuthType 
specified in your Resource tag (auth="Container"). I don't know if this is required. 
Also, did you check to make sure you updated the name in your ResourceParams entry to 
add jdbc/. Everything seems to be working OK on the Cocoon side I think.

Ugo Cei <[EMAIL PROTECTED]> wrote:

>[EMAIL PROTECTED] wrote:
>> Are you sure you have a valid datasource in Tomcat? Looks like it's having trouble 
>creating a connection. I noticed 
>> oracl.jdbc.driver.OracleDriver 
>> contains a type-o. Shouldn't it be oracle.jdbc.driver.OracleDriver instead of oracl 
>with no e?
>
>The error is just a typo due to cut&paste. The name of the class is 
>correct in the server.xml file. But yes, it looks like Tomcat has 
>troubles creating a connection, even though all it reports in his logs 
>is the following:
>
>DBCP DataSource configured without a 'username'
>
>which I can't figure out because I sure have a username in the 
>datasource configuration.
>
>Ugo
>
>-- 
>Ugo Cei - Consorzio di Bioingegneria e Informatica Medica
>P.le Volontari del Sangue, 2 - 27100 Pavia - Italy
>Phone: +39.0382.525100 - E-mail: [EMAIL PROTECTED]
>
>
>-
>Please check that your question  has not already been answered in the
>FAQ before posting. 
>
>To unsubscribe, e-mail: <[EMAIL PROTECTED]>
>For additional commands, e-mail:   <[EMAIL PROTECTED]>
>
>

__
The NEW Netscape 7.0 browser is now available. Upgrade now! 
http://channels.netscape.com/ns/browsers/download.jsp 

Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/

-
Please check that your question  has not already been answered in the
FAQ before posting. 

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>




Re: Using J2EE datasources

2002-09-23 Thread Ugo Cei

[EMAIL PROTECTED] wrote:
> Are you sure you have a valid datasource in Tomcat? Looks like it's having trouble 
>creating a connection. I noticed 
> oracl.jdbc.driver.OracleDriver 
> contains a type-o. Shouldn't it be oracle.jdbc.driver.OracleDriver instead of oracl 
>with no e?

The error is just a typo due to cut&paste. The name of the class is 
correct in the server.xml file. But yes, it looks like Tomcat has 
troubles creating a connection, even though all it reports in his logs 
is the following:

DBCP DataSource configured without a 'username'

which I can't figure out because I sure have a username in the 
datasource configuration.

Ugo

-- 
Ugo Cei - Consorzio di Bioingegneria e Informatica Medica
P.le Volontari del Sangue, 2 - 27100 Pavia - Italy
Phone: +39.0382.525100 - E-mail: [EMAIL PROTECTED]


-
Please check that your question  has not already been answered in the
FAQ before posting. 

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>




Re: Using J2EE datasources

2002-09-23 Thread JohnsBrn

Are you sure you have a valid datasource in Tomcat? Looks like it's having trouble 
creating a connection. I noticed 
oracl.jdbc.driver.OracleDriver 
contains a type-o. Shouldn't it be oracle.jdbc.driver.OracleDriver instead of oracl 
with no e?


Ugo Cei <[EMAIL PROTECTED]> wrote:

>Ugo Cei wrote:
>> I am trying to use a J2EE datasource, but am having troubles.
>
>Update: I have deduced that the datasource name in Tomcat must be 
>prefixed by "jdbc/". Somehow I thought this was implicit. I have thus 
>made progress, but now I get this:
>
>Original exception : org.apache.commons.dbcp.DbcpException: 
>java.sql.SQLException: invalid arguments in call
>at 
>org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:85)
>at 
>org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:184)
>at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(Unknown 
>Source)
>at 
>org.apache.commons.dbcp.AbandonedObjectPool.borrowObject(AbandonedObjectPool.java:117)
>at 
>org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:110)
>at 
>org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:312)
>at 
>org.apache.avalon.excalibur.datasource.J2eeDataSource.getConnection(J2eeDataSource.java:124)
>
>What call is it talking about?
>
>Ugo
>
>-- 
>Ugo Cei - Consorzio di Bioingegneria e Informatica Medica
>P.le Volontari del Sangue, 2 - 27100 Pavia - Italy
>Phone: +39.0382.525100 - E-mail: [EMAIL PROTECTED]
>
>
>-
>Please check that your question  has not already been answered in the
>FAQ before posting. 
>
>To unsubscribe, e-mail: <[EMAIL PROTECTED]>
>For additional commands, e-mail:   <[EMAIL PROTECTED]>
>
>

__
The NEW Netscape 7.0 browser is now available. Upgrade now! 
http://channels.netscape.com/ns/browsers/download.jsp 

Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/

-
Please check that your question  has not already been answered in the
FAQ before posting. 

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>




RE: Using J2EE datasources

2002-09-23 Thread JohnsBrn

By default org.apache.avalon.excalibur.datasource.J2eeDataSource looks for your J2EE 
datasource in the java:/comp/env/jdbc context. You can change this using the 
lookup-name parameter:

java:/FirebirdDS

I'm not that familiar with Tomcat or it's config files, but you need to store your 
J2EE datasource in JNDI to access it from this component.

Ugo Cei <[EMAIL PROTECTED]> wrote:

>I am trying to use a J2EE datasource, but am having troubles.
>
>Environment:
>
>Cocoon 2.0.3
>Jakarta Tomcat 4.1.9
>Sun JDK 1.3.1
>Solaris 8
>
>I have defined a datasource in Tomcat via the Administrator interface. 
>It has put the following in server.xml, under the appropriate Context:
>
>   type="javax.sql.DataSource"/>
>   
> 
>   validationQuery
>   select 1 from dual
> 
> 
>   user
>   resl
> 
> 
>   url
>   jdbc:oracle:thin:@ias:1521:ORCL
> 
> 
>   password
>   xxx
> 
> 
>   maxActive
>   4
> 
> 
>   maxWait
>   5000
> 
> 
>   driverClassName
>   oracl.jdbc.driver.OracleDriver
> 
> 
>   maxIdle
>   2
> 
>   
>
>These are the parameters I used with the jdbc datasource and they worked 
>well.
>
>I have added the following datasource definition in cocoon.xconf:
>
> 
>   resl
> 
>
>but when I try to use the datasource in XSP, I get the following error:
>
>org.apache.avalon.framework.component.ComponentException: Could not find 
>component
>
>Browsing through error.log, I think I found the origin of the problem here:
>
>ERROR   (2002-09-23) 18:10.42:478   [core.manager] (Unknown-URI) 
>Unknown-thread/J2eeDataSource: Problem with JNDI lookup of datasource
>javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
> at org.apache.naming.NamingContext.lookup(NamingContext.java:811)
> at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
> at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
> at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
> at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
> at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
> at 
>org.apache.naming.SelectorContext.lookup(SelectorContext.java:183)
> at javax.naming.InitialContext.lookup(InitialContext.java:350)
> at 
>org.apache.avalon.excalibur.datasource.J2eeDataSource.configure(J2eeDataSource.java:95)
>...
>
>I am afraid I am doing something wrong, but the docs, either the Cocoon 
>or the Tomcat ones don't help much.
>
>Ugo
>
>
>-- 
>Ugo Cei - Consorzio di Bioingegneria e Informatica Medica
>P.le Volontari del Sangue, 2 - 27100 Pavia - Italy
>Phone: +39.0382.525100 - E-mail: [EMAIL PROTECTED]
>
>
>-
>Please check that your question  has not already been answered in the
>FAQ before posting. 
>
>To unsubscribe, e-mail: <[EMAIL PROTECTED]>
>For additional commands, e-mail:   <[EMAIL PROTECTED]>
>
>

__
The NEW Netscape 7.0 browser is now available. Upgrade now! 
http://channels.netscape.com/ns/browsers/download.jsp 

Get your own FREE, personal Netscape Mail account today at http://webmail.netscape.com/

-
Please check that your question  has not already been answered in the
FAQ before posting. 

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>




Re: Using J2EE datasources

2002-09-23 Thread Ugo Cei

Ugo Cei wrote:
> I am trying to use a J2EE datasource, but am having troubles.

Update: I have deduced that the datasource name in Tomcat must be 
prefixed by "jdbc/". Somehow I thought this was implicit. I have thus 
made progress, but now I get this:

Original exception : org.apache.commons.dbcp.DbcpException: 
java.sql.SQLException: invalid arguments in call
at 
org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:85)
at 
org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:184)
at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(Unknown 
Source)
at 
org.apache.commons.dbcp.AbandonedObjectPool.borrowObject(AbandonedObjectPool.java:117)
at 
org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:110)
at 
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:312)
at 
org.apache.avalon.excalibur.datasource.J2eeDataSource.getConnection(J2eeDataSource.java:124)

What call is it talking about?

Ugo

-- 
Ugo Cei - Consorzio di Bioingegneria e Informatica Medica
P.le Volontari del Sangue, 2 - 27100 Pavia - Italy
Phone: +39.0382.525100 - E-mail: [EMAIL PROTECTED]


-
Please check that your question  has not already been answered in the
FAQ before posting. 

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>




Using J2EE datasources

2002-09-23 Thread Ugo Cei

I am trying to use a J2EE datasource, but am having troubles.

Environment:

Cocoon 2.0.3
Jakarta Tomcat 4.1.9
Sun JDK 1.3.1
Solaris 8

I have defined a datasource in Tomcat via the Administrator interface. 
It has put the following in server.xml, under the appropriate Context:

   
   
 
   validationQuery
   select 1 from dual
 
 
   user
   resl
 
 
   url
   jdbc:oracle:thin:@ias:1521:ORCL
 
 
   password
   xxx
 
 
   maxActive
   4
 
 
   maxWait
   5000
 
 
   driverClassName
   oracl.jdbc.driver.OracleDriver
 
 
   maxIdle
   2
 
   

These are the parameters I used with the jdbc datasource and they worked 
well.

I have added the following datasource definition in cocoon.xconf:

 
   resl
 

but when I try to use the datasource in XSP, I get the following error:

org.apache.avalon.framework.component.ComponentException: Could not find 
component

Browsing through error.log, I think I found the origin of the problem here:

ERROR   (2002-09-23) 18:10.42:478   [core.manager] (Unknown-URI) 
Unknown-thread/J2eeDataSource: Problem with JNDI lookup of datasource
javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
 at org.apache.naming.NamingContext.lookup(NamingContext.java:811)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:181)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:822)
 at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
 at 
org.apache.naming.SelectorContext.lookup(SelectorContext.java:183)
 at javax.naming.InitialContext.lookup(InitialContext.java:350)
 at 
org.apache.avalon.excalibur.datasource.J2eeDataSource.configure(J2eeDataSource.java:95)
...

I am afraid I am doing something wrong, but the docs, either the Cocoon 
or the Tomcat ones don't help much.

Ugo


-- 
Ugo Cei - Consorzio di Bioingegneria e Informatica Medica
P.le Volontari del Sangue, 2 - 27100 Pavia - Italy
Phone: +39.0382.525100 - E-mail: [EMAIL PROTECTED]


-
Please check that your question  has not already been answered in the
FAQ before posting. 

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>




Re: J2EE Datasources

2002-06-27 Thread Russell Castagnaro

Hello Joshua,

You might try looking up:

myhms-datasource

or
jdbc/myhms-datasource

instead of

jdbc/MysqlDS


The documentation from Orion should help you on this.  I know I did
the same thing using weblogic, but it took a couple of tries to get it
to work.

Also keep in mind that datasources can be webapp specific, so if you
haven't set up a datasource in the webapp itself, you'll never find it
using the "java:comp/env/jdbc/".


I'd also recommend making getting a list of the names of all of the
objects in your JNDI tree for future reference (after reading the
Orion docs) :)

Here's some code to help:

package com.synctank.labs.jndi;

import javax.naming.*;

public class JNDILister {
public static void main(String _arg[]){
Object o = null;  InitialContext ctx= null;
String start = "foo.bar";
if (_arg.length > 0) start = _arg[0];
try{
ctx = getInitialContext();
Context c = (Context)ctx.lookup(start);
list(c);

} catch (ClassCastException e) {
System.out.println("Found a "+o.getClass().getName() +": 
"+o.toString() );
} catch (NamingException ne) {
System.out.println("We have a problem!");
ne.printStackTrace();
} finally {
try {  ctx.close(); }catch (Exception e ) {}
}
}

public static void list(Context _ctx) 
{
StringBuffer sb = new StringBuffer();
try {
NamingEnumeration enum = _ctx.listBindings("");
while (enum.hasMore()) {
javax.naming.Binding binding = 
(javax.naming.Binding)enum.next();
Object obj = (Object)binding.getObject();
if (obj instanceof Context) 
{
System.out.print("---> ");
System.out.print(binding.getName());
System.out.print(".");
list((Context)obj);
} else {
String name = binding.getName();
System.out.print("LEAF: "+name);// + " is "+ 
obj.getClass().getName()) ;

}
}
} catch (NamingException e) {
System.out.println(e);
}
}
public static InitialContext getInitialContext() throws NamingException {
// use the factory from your provider, this is an LDAP
provider
String factory = "com.sun.jndi.ldap.LdapCtxFactory";
// use the url of
String url = "ldap://ldap.bigfoot.com:389";;
String user = null; //the user name, if any
String password = null; // password if any;

java.util.Hashtable p = new java.util.Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY, factory);
p.put(Context.PROVIDER_URL, url);

if (user != null && password != null ) {
System.out.println("user: " + user);
p.put(Context.SECURITY_PRINCIPAL, user);
p.put(Context.SECURITY_CREDENTIALS, password);
}

return new InitialContext(p);
}


}

Thursday, June 27, 2002, 9:00:44 AM, you wrote:

JM> Hello,

JM> I'd like to know if anyone is using J2EE defined
JM> datasources in Cocoon? 
JM> I'm trying unsucessfully to connect to a MySQL
JM> database using the Orion J2EE server. I've defined a
JM> datasource in Orion:

JM>  name="Mysql" 
JM> class="com.evermind.sql.DriverManagerDataSource"
JM> schema="database-schemas/mysql.xml" 
JM> location="jdbc/MysqlDS" 
JM> xa-location="jdbc/xa/MysqlXADS" 
JM> ejb-location="jdbc/MysqlDS" 
JM> connection-driver="org.gjt.mm.mysql.Driver" 
JM> username="root" 
JM> password="" 
JM> url="jdbc:mysql://localhost/myhms" 
JM> inactivity-timeout="30" 
JM> />

JM> I can get a javax.sql.DataSource using the following
JM> code from within a custom class called by a custom
JM> Transformer:

JM> DataSource ds = (DataSource) new
JM> InitialContext().lookup("jdbc/MysqlDS");


JM> I then defined this datasource in cocoon.xconf:

JM> 
JM>   MysqlDS
JM> 





-- 
Best regards,
 Russell   

J2EE Datasources

2002-06-27 Thread Joshua McCulloch

Hello,

I'd like to know if anyone is using J2EE defined
datasources in Cocoon? 
I'm trying unsucessfully to connect to a MySQL
database using the Orion J2EE server. I've defined a
datasource in Orion:



I can get a javax.sql.DataSource using the following
code from within a custom class called by a custom
Transformer:

DataSource ds = (DataSource) new
InitialContext().lookup("jdbc/MysqlDS");


I then defined this datasource in cocoon.xconf:


  MysqlDS


When Cocoon starts, this occurs in the error.log:

ERROR   (2002-06-27) 11:58.24:441  
[core.datasources.myhms-datasource] (Unknown-URI)
Unknown-thread/LogKitLogger: Problem with JNDI lookup
of datasource
javax.naming.NameNotFoundException: jdbc/MysqlDS not
found in Cocoon2 Demo
at com.evermind._lj.lookup(.:49)
at com.evermind._bm._es(.:121)
at com.evermind._bm.lookup(.:63)
at
javax.naming.InitialContext.lookup(InitialContext.java:345)
at
org.apache.avalon.excalibur.datasource.J2eeDataSource.configure(J2eeDataSource.java:63)
at
org.apache.avalon.excalibur.component.DefaultComponentFactory.newInstance(DefaultComponentFactory.java:172)
at
org.apache.avalon.excalibur.component.ThreadSafeComponentHandler.initialize(ThreadSafeComponentHandler.java:84)
at
org.apache.avalon.excalibur.component.ExcaliburComponentSelector.addComponent(ExcaliburComponentSelector.java:467)
at
org.apache.avalon.excalibur.component.ExcaliburComponentSelector.configure(ExcaliburComponentSelector.java:354)
at
org.apache.avalon.excalibur.component.DefaultComponentFactory.newInstance(DefaultComponentFactory.java:172)
at
org.apache.avalon.excalibur.component.ThreadSafeComponentHandler.initialize(ThreadSafeComponentHandler.java:84)
at
org.apache.avalon.excalibur.component.ExcaliburComponentManager.initialize(ExcaliburComponentManager.java:167)
at
org.apache.cocoon.Cocoon.initialize(Cocoon.java:269)
at
org.apache.cocoon.servlet.CocoonServlet.createCocoon(CocoonServlet.java:1212)
at
org.apache.cocoon.servlet.CocoonServlet.init(CocoonServlet.java:407)


I haven't worked with JNDI before. What am I missing?
I looked at J2eeDataSource.java and found it was
calling InitialContext.lookup( "java:comp/env/jdbc/" +
"MysqlDS")

I tried changing the datasource location attribute to
"java:comp/env/jdbc/MysqlDS" which didn't do anything,
not that I was really expecting it to...

__
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

-
Please check that your question  has not already been answered in the
FAQ before posting. 

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>