Re: cannot setup JNDI with MySQL

2005-10-06 Thread Andrés Glez .
The problem is not JDNI. The problem is you can't connect to MySQL. Probably 
it's you have to check your MySQL access permissions...


Can you connect to MySQL using the same parameters with another tool like 
MySQL Control Center?


- Original Message - 
From: John Cherouvim [EMAIL PROTECTED]

To: tomcat-user@jakarta.apache.org
Sent: Thursday, October 06, 2005 11:17 AM
Subject: cannot setup JNDI with MySQL



Hello

I've been trying to setup a mysql connection pool using JNDI as shown in 
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html

But no luck.

I never get to see the datasource registered Tomcat Administration Tool.
I've included in server.xml the following lines somewhere inside the 
Host .. /Host

DefaultContext
Resource name=jdbc/DBTest auth=Container 
type=javax.sql.DataSource/

ResourceParams name=jdbc/DBTest
   parameter namefactory/name 
valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter
   parameter namedriverClassName/name 
valuecom.mysql.jdbc.Driver/value /parameter
   parameter nameurl/name 
valuejdbc:mysql://localhost:3306/dea?autoReconnect=true/value 
/parameter
   parameter nameusername/name valuemyusername/value 
/parameter
   parameter namepassword/name valuemypassword/value 
/parameter

   parameter namemaxActive/name value20/value /parameter
   parameter namemaxIdle/name value10/value /parameter
   parameter namemaxWait/name value40/value /parameter
/ResourceParams
/DefaultContext

I have Tomcat/5.0.28

And the following files in common\lib
mysql-connector-java-3.1.10-bin.jar
commons-collections-3.1.jar
commons-dbcp-1.2.1.jar
commons-pool-1.2.jar
*

*What I get in tomcat\logs\stdout.log is:
NotifyUtil::java.net.ConnectException: Connection refused: connect
   at java.net.PlainSocketImpl.socketConnect(Native Method)
   at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:295)
   at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:161)
   at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:148)
   at java.net.Socket.connect(Socket.java:425)
   at java.net.Socket.connect(Socket.java:375)
   at sun.net.NetworkClient.doConnect(NetworkClient.java:139)
   at sun.net.www.http.HttpClient.openServer(HttpClient.java:366)
   at sun.net.www.http.HttpClient.openServer(HttpClient.java:582)
   at sun.net.www.http.HttpClient.init(HttpClient.java:292)
   at sun.net.www.http.HttpClient.init(HttpClient.java:253)
   at sun.net.www.http.HttpClient.New(HttpClient.java:321)
   at sun.net.www.http.HttpClient.New(HttpClient.java:306)
   at sun.net.www.http.HttpClient.New(HttpClient.java:301)
   at 
sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:469)
   at 
sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:460)
   at 
sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:516)
   at 
org.netbeans.modules.web.monitor.server.NotifyUtil$RecordSender.run(NotifyUtil.java:237)



What did I miss? I've even tried setting up the JNDI in the 
conf\Catalina\localhost\myapp.xml
And also tried Context path=/myapp docBase=app instead of 
DefaultContext

I also tried all that with the org.gjt.mm.mysql.Driver

Regards,
I.

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






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



Re: ClassCastException while sharing objects accross applications

2005-10-04 Thread Andrés Glez .

What about using JNDI to share objects between webapps?

I think that:

init(){
...
String context = java:comp/env/;
InitialContext ic = new InitialContext();
ClassX c = (ClassX) ic.lookup(sContexto);
...
}
should return the same object to different servlets/webapps, if you define 
the jndi-resource globally, i.e., in conf/server.xml



- Original Message - 
From: Seva Popov [EMAIL PROTECTED]
To: Tomcat Users List Surya Mishra 
[EMAIL PROTECTED]@gmail.com; Tomcat Users 
List tomcat-user@jakarta.apache.org

Sent: Tuesday, October 04, 2005 8:41 AM
Subject: RE: ClassCastException while sharing objects accross applications


The type in Java is a combination of a fully qualified class name and its 
defining classloader. So the two objects with the same class name are 
considered different types in your two web applications because each web 
application is loaded by the dedicated webapp classloader.


To solve your problem you can use object serialization or if your objects 
are the java beans you can use the java.beans encoding.


The XMLEncoder class is a complementary alternative to the 
ObjectOutputStream and can used to generate a textual representation of a 
JavaBean in the same way that the ObjectOutputStream can be used to create 
binary representation of Serializable objects. 


--Seva



From: Surya Mishra [mailto:[EMAIL PROTECTED]
Sent: Mon 10/3/2005 4:12 PM
To: Tomcat Users List
Subject: ClassCastException while sharing objects accross applications



Hi,

I am trying to share an object between 2 applications deployed on the same
tomcat server. I have put the object in the ServletContext in my first
application. I access the object using
ServletContext.getContext(firstApp).getAttribute(object);.
The object comes in fine but it won't let me cast it to the actual Object
Type. I get a ClassCastException. I tried printing the name of the class.
That also came fine (same class name).

Thanks in advance.
-Surya




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



Re: log4j log viewer for tomcat

2005-10-04 Thread Andrés Glez .

chainsaw

- Original Message - 
From: Leon Rosenberg [EMAIL PROTECTED]

To: Tomcat Users List tomcat-user@jakarta.apache.org
Sent: Sunday, October 02, 2005 1:17 PM
Subject: Re: log4j log viewer for tomcat


lf5

regards
Leon

On 10/2/05, matador [EMAIL PROTECTED] wrote:

win200x
tomcat 5.5.9
jdk 1.5.x
log4j 1.2.9 (i think)

standard log4j setup with logs going into logs dir under tomcat install.

does anyone have any recommendations for a webapp or workaround that 
allows

me to view these files.  the obvious ways (e.g. ftp, ssh, etc) are not an
option.

thx


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




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




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



Re: Running Tomcat as Non-Root under Linux listen for port 80

2005-09-27 Thread Andrés Glez .

Use jsvc.

- Original Message - 
From: NoKideen [EMAIL PROTECTED]

To: tomcat-user@jakarta.apache.org
Sent: Tuesday, September 27, 2005 6:13 PM
Subject: Running Tomcat as Non-Root under Linux listen for port 80



is there anybody know how to do this ?
Running Tomcat as Non-Root under Linux listen for port 80

I'd try as tomcat , but there is error even if 
I do

# chown -R tomcat:root /usr/tomcat/*


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





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



Re: Context at Host Level

2005-06-03 Thread Andrés Glez.

Exactly what i was looking for. Thanks!

- Original Message - 
From: Mark Thomas [EMAIL PROTECTED]

To: Tomcat Users List tomcat-user@jakarta.apache.org
Sent: Thursday, June 02, 2005 9:03 PM
Subject: Re: Context at Host Level



Andrés Glez. wrote:


there is no ContainerListener or something like that?



Look at http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/engine.html 
and

http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/host.html

You need to seach for lifecycle listener. Not part of the spec but might 
help you.


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



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



Context at Host Level

2005-06-02 Thread Andrés Glez.

Hi

If i define a jndi resource at the host level, how can i know when tomcat is 
being stopped to finalize that resource?


I mean, in a webapp context level, i can define a ServletContextListener so 
i can get the event ContextDestroyed and close, say, some opened files.


I've been searching and have only found

- ServletContextListener
- HttpSessionListener

there is no ContainerListener or something like that? 



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



Re: Defining DBCP resources in web.xml?

2005-04-26 Thread Andrés Glez.
Do it better in the web app. META-INF/context.xml


- Original Message - 
From: Josh McDonald [EMAIL PROTECTED]
To: 'Tomcat Users List' tomcat-user@jakarta.apache.org
Sent: Tuesday, April 26, 2005 2:37 PM
Subject: Defining DBCP resources in web.xml?


 The heading says it all - can it be done? If so, how do I go about it? I'd
 rather not have a dozen different references in the server.xml if I can
 avoid it, tho it's looking like I'll have to :-(



 Anyway, any pointers much appreciated.

 -Josh

 --

 Until a man is twenty-five, he still thinks, every so often, that under
the
 right circumstances he could be the baddest mother in the world.

 Josh 'G-Funk' McDonald :: Pirion Systems, Brisbane

 07 3257 0490 :: 0437 221 380 :: [EMAIL PROTECTED]






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