Re: [Tomcat 6.0.29] Why do I have to configure the datasource in the context.xml of the server and in the context.xml of the application?

2011-08-02 Thread Ron McNulty

Hi AN

We use Oracle 11g with Jetspeed portal on Tomcat.

1. The resource definition goes in conf/context.xml just like for any web 
application. The portal does not change this.
2. You need to put Oracle's ojdbc6.jar into the /lib directory of Tomcat so 
that the driver class can be loaded by Tomcat
3. If you are using XMLType fields in your database, add Oracle's xdb.jar 
and xmlparserv2.jar to the same directory
4. Make sure that the web application does NOT include any of these Oracle 
jars in the .war file.


The Oracle jars are included in the Oracle client pack that you probably 
have, or can download from oracle.com. Make sure you use all three from the 
same release.


If there is a problem, the logs should contain enough info to sort it out. I 
don't have a copy of our resorce definition at home, but if you are still 
having problems reply to this and I will send a copy.


Regards

Ron


- Original Message - 
From: AN daraii.t...@gmail.com

To: Tomcat Users List users@tomcat.apache.org
Sent: Sunday, July 31, 2011 8:34 AM
Subject: Re: [Tomcat 6.0.29] Why do I have to configure the datasource in 
the context.xml of the server and in the context.xml of the application?




That was only a typo. The thing is that if I remove it from any of the two
places it doesn't work. I don't see anything in
$CATALINA_BASE/conf/[enginename]/[hostname]/ besides the ROOT.xml but I'm
using Liferay (the application is a portlet).

On Mon, Jul 25, 2011 at 11:18 AM, Ognjen Blagojevic 
ognjen.d.blagoje...@gmail.com wrote:


On 25.7.2011 16:57, AN wrote:


I don't understand why do I have to place the Resource element in both
files.



You don't. It seems that you misconfigured something.



 Resource auth=Container driverClassName=oracle.jdbc.**

OracleDriver



Could  be the source of the problem?

If you deploy as WAR file, check if context.xml is indeed copied to
$CATALINA_BASE/conf/[**enginename]/[hostname]/[**appname].xml, and that 
it

contains correct resource definition.

Also, check for errors in log files and console.

-Ognjen

--**--**-
To unsubscribe, e-mail: 
users-unsubscribe@tomcat.**apache.orgusers-unsubscr...@tomcat.apache.org

For additional commands, e-mail: users-h...@tomcat.apache.org







-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: [Tomcat 6.0.29] Why do I have to configure the datasource in the context.xml of the server and in the context.xml of the application?

2011-08-01 Thread Ognjen Blagojevic

Hi AN,

On 30.7.2011 22:34, AN wrote:

(...) I'm using Liferay (the application is a portlet).


I believe that you cannot apply webapp configuration to portlets. It is 
probably better if you ask your question at Liferay mailing lists.


-Ognjen

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: [Tomcat 6.0.29] Why do I have to configure the datasource in the context.xml of the server and in the context.xml of the application?

2011-07-30 Thread AN
That was only a typo. The thing is that if I remove it from any of the two
places it doesn't work. I don't see anything in
$CATALINA_BASE/conf/[enginename]/[hostname]/ besides the ROOT.xml but I'm
using Liferay (the application is a portlet).

On Mon, Jul 25, 2011 at 11:18 AM, Ognjen Blagojevic 
ognjen.d.blagoje...@gmail.com wrote:

 On 25.7.2011 16:57, AN wrote:

 I don't understand why do I have to place the Resource element in both
 files.


 You don't. It seems that you misconfigured something.



  Resource auth=Container driverClassName=oracle.jdbc.**
 OracleDriver


 Could  be the source of the problem?

 If you deploy as WAR file, check if context.xml is indeed copied to
 $CATALINA_BASE/conf/[**enginename]/[hostname]/[**appname].xml, and that it
 contains correct resource definition.

 Also, check for errors in log files and console.

 -Ognjen

 --**--**-
 To unsubscribe, e-mail: 
 users-unsubscribe@tomcat.**apache.orgusers-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: users-h...@tomcat.apache.org




[Tomcat 6.0.29] Why do I have to configure the datasource in the context.xml of the server and in the context.xml of the application?

2011-07-25 Thread AN
Hello,

I've following the examples in
http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.htmlyo
configure a data-source for an Oracle 10g database. In the context
configuration section it mention that the resource element must be placed in
the Context and the section
http://tomcat.apache.org/tomcat-6.0-doc/config/context.html explains that it
can be included in the $CATALINA_BASE/conf/context.xml or in the
/META-INF/context.xml inside the WAR.

I have placed the resource element in the $CATALINA_BASE/conf/context.xml
file so it is copied to all the webapps but the application cannot find the
data-source. I placed it on the META-INF/context.xml without removing it
from $CATALINA_BASE/conf/context.xml a$CATALINA_BASE/conf/context.xml nd it
worked. After that I remove it from the $CATALINA_BASE/conf/context.xml
leaving only the configuration in the META-INF/context.xml and it did not
work again. I got to have in both META-INF/context.xml and
META-INF/context.xml in order for the data source to work.

I don't understand why do I have to place the Resource element in both
files.

-
This is my context.xml inside $CATALINA_BASE/conf/.

?xml version='1.0' encoding='utf-8'?
Context
WatchedResourceWEB-INF/web.xml/WatchedResource
Resource name=jdbc/oracleDS auth=Container
  type=javax.sql.DataSource
driverClassName=oracle.jdbc.OracleDriver
  url=jdbc:oracle:thin:@oracle:1521:xe
  username=x password=x maxActive=1000 maxIdle=20
  maxWait=200/
/Context
--

This is my context.xml inside META-INF/context.xml.

?xml version=1.0 encoding=UTF-8?
Context path=/application_name
Resource auth=Container driverClassName=oracle.jdbc.OracleDriver
maxActive=1000 maxIdle=20 maxWait=200 name=jdbc/oracleDS
password=x
type=javax.sql.DataSource url=jdbc:oracle:thin:@oracle:1521:xe
username=x /
/Context

---

The reference in the web.xml.

resource-ref
descriptionOracle DataSource/description
res-ref-namejdbc/oracleDS/res-ref-name
res-typejavax.sql.DataSource/res-type
res-authContainer/res-auth
/resource-ref


Re: [Tomcat 6.0.29] Why do I have to configure the datasource in the context.xml of the server and in the context.xml of the application?

2011-07-25 Thread Ognjen Blagojevic

On 25.7.2011 16:57, AN wrote:

I don't understand why do I have to place the Resource element in both
files.


You don't. It seems that you misconfigured something.



 Resource auth=Container driverClassName=oracle.jdbc.OracleDriver


Could  be the source of the problem?

If you deploy as WAR file, check if context.xml is indeed copied to 
$CATALINA_BASE/conf/[enginename]/[hostname]/[appname].xml, and that it 
contains correct resource definition.


Also, check for errors in log files and console.

-Ognjen

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org