Re: Tomcat5.5 MySQL14.12 java.net.SocketException: Broken pipe

2010-10-18 Thread Steve Ryder
It has been 10 days so I am declaring that Jason's suggestion did indeed 
solve the problem.

Thanks Jason.
- Original Message - 
From: Steve Ryder sry...@jsrsys.com

To: Tomcat Users List users@tomcat.apache.org
Sent: Thursday, October 07, 2010 10:03 AM
Subject: Re: Tomcat5.5 MySQL14.12 java.net.SocketException: Broken pipe


Thanks Jason.  I have added the two parameters.  Hopefully I will have 
seen the last of this error.


- Original Message - 
From: Jason Britton jbritto...@gmail.com

To: Tomcat Users List users@tomcat.apache.org
Sent: Wednesday, October 06, 2010 11:57 PM
Subject: Re: Tomcat5.5 MySQL14.12 java.net.SocketException: Broken pipe



To your mysql Resource definition below I would add
validationQuery=SELECT 1

That should prevent your application from getting handed stale db
connections from your pool.  Take a look at the testOnBorrow and
validationQuery definitions here
http://commons.apache.org/dbcp/configuration.html

Jason



On Wed, Oct 6, 2010 at 8:18 PM, Steve Ryder sry...@jsrsys.com wrote:


I am getting this during mysql connection (about once a week).
I have read the thread on MySQL forum, which has a solution, but the 
link

to the solution is broken and points back to the same page.
Suggestions have been use autoconnect=true
Another was that the server timeout was shorter than the connection
time-out.
I have the following:
In server.xml:
Connector port=80 maxHttpHeaderSize=8192
 maxThreads=192 minSpareThreads=32 maxSpareThreads=128
 enableLookups=false redirectPort=8443 acceptCount=128
 connectionTimeout=2 disableUploadTimeout=true /
In context.xml
Resource name=jdbc/MySql auth=Container type=javax.sql.DataSource
 url=jdbc:mysql://localhost.localdomain/rsa?autoReconnect=true
   factory=org.apache.commons.dbcp.BasicDataSourceFactory
 driverClassName=com.mysql.jdbc.Driver
 password=jsrsys username=jsrsys
   maxWait=1   maxActive=200  maxIdle=5
 removeAbandoned=true removeAbandonedTimeout=300 logAbandoned=true
/
Note that maxWait is 1/2 of connectionTimeout and I have
autoReconnect=true.
Any ideas.   This is low priority as users are able to reconnect by just
pressing Refresh, but I would like this to go away.

-
To unsubscribe, e-mail: users-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




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



Re: Tomcat5.5 MySQL14.12 java.net.SocketException: Broken pipe

2010-10-07 Thread Steve Ryder
Thanks Jason.  I have added the two parameters.  Hopefully I will have seen 
the last of this error.


- Original Message - 
From: Jason Britton jbritto...@gmail.com

To: Tomcat Users List users@tomcat.apache.org
Sent: Wednesday, October 06, 2010 11:57 PM
Subject: Re: Tomcat5.5 MySQL14.12 java.net.SocketException: Broken pipe



To your mysql Resource definition below I would add
validationQuery=SELECT 1

That should prevent your application from getting handed stale db
connections from your pool.  Take a look at the testOnBorrow and
validationQuery definitions here
http://commons.apache.org/dbcp/configuration.html

Jason



On Wed, Oct 6, 2010 at 8:18 PM, Steve Ryder sry...@jsrsys.com wrote:


I am getting this during mysql connection (about once a week).
I have read the thread on MySQL forum, which has a solution, but the 
link

to the solution is broken and points back to the same page.
Suggestions have been use autoconnect=true
Another was that the server timeout was shorter than the connection
time-out.
I have the following:
In server.xml:
Connector port=80 maxHttpHeaderSize=8192
 maxThreads=192 minSpareThreads=32 maxSpareThreads=128
 enableLookups=false redirectPort=8443 acceptCount=128
 connectionTimeout=2 disableUploadTimeout=true /
In context.xml
Resource name=jdbc/MySql auth=Container type=javax.sql.DataSource
 url=jdbc:mysql://localhost.localdomain/rsa?autoReconnect=true
   factory=org.apache.commons.dbcp.BasicDataSourceFactory
 driverClassName=com.mysql.jdbc.Driver
 password=jsrsys username=jsrsys
   maxWait=1   maxActive=200  maxIdle=5
 removeAbandoned=true removeAbandonedTimeout=300 logAbandoned=true
/
Note that maxWait is 1/2 of connectionTimeout and I have
autoReconnect=true.
Any ideas.   This is low priority as users are able to reconnect by just
pressing Refresh, but I would like this to go away.

-
To unsubscribe, e-mail: users-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



Tomcat5.5 MySQL14.12 java.net.SocketException: Broken pipe

2010-10-06 Thread Steve Ryder

I am getting this during mysql connection (about once a week).
I have read the thread on MySQL forum, which has a solution, but the link 
to the solution is broken and points back to the same page.

Suggestions have been use autoconnect=true
Another was that the server timeout was shorter than the connection 
time-out.

I have the following:
In server.xml:
Connector port=80 maxHttpHeaderSize=8192
  maxThreads=192 minSpareThreads=32 maxSpareThreads=128
  enableLookups=false redirectPort=8443 acceptCount=128
  connectionTimeout=2 disableUploadTimeout=true /
In context.xml
Resource name=jdbc/MySql auth=Container type=javax.sql.DataSource
 url=jdbc:mysql://localhost.localdomain/rsa?autoReconnect=true
factory=org.apache.commons.dbcp.BasicDataSourceFactory
 driverClassName=com.mysql.jdbc.Driver
 password=jsrsys username=jsrsys
maxWait=1   maxActive=200  maxIdle=5
  removeAbandoned=true removeAbandonedTimeout=300 logAbandoned=true
/
Note that maxWait is 1/2 of connectionTimeout and I have autoReconnect=true.
Any ideas.   This is low priority as users are able to reconnect by just 
pressing Refresh, but I would like this to go away. 



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



Tomcat5.5: Apache Tomcat Native library ... not found

2010-10-01 Thread Steve Ryder
How do it fix this? 
INFO: The Apache Tomcat Native library which allows optimal performance in 
production environments was not found on the java.library.path: 

i.e., what library is missing and/ how do I put it in the java.library.path. 
I presume an update to JAVA_OPTS in etc/init.d/tomcat5.5 

Tomcat5.5: java.io.FilePermission access denied

2010-10-01 Thread Steve Ryder

Tomcat5.5: java.io.FilePermission access denied:
When I added the code on 02-08 it fixed the SocketPermission and
PropertyPermission exceptions for my servlets.  What am  I doing wrong that
I now get FilePermission exceptions.
I have changed Linux permissions for Data to 377.  Still get error.
But I have in policy.d/04webapps.policy file:
// == WEB APPLICATION PERMISSIONS
=
// These permissions are granted by default to all web applications
// In addition, a web application will be given a read FilePermission
// and JndiPermission for all files and directories in its document root.
grant {
   // Added by JSR 2010-09-13
permission java.io.FilePermission *, read,write;
  // Added by JSR 2010-02-08:
permission java.util.PropertyPermission *, read,write;
   permission java.net.SocketPermission*, connect,resolve;

Exception report:
Sep 30, 2010 12:05:46 PM org.apache.catalina.core.StandardWrapperValve
invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.security.AccessControlException: access denied (java.io.FilePermission
/home/sryder/app.rsoa.org/ROOT/Data/2010-09-30-at-1205.csv write)
at
java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
at
java.security.AccessController.checkPermission(AccessController.java:427)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
at java.lang.SecurityManager.checkWrite(SecurityManager.java:962)
at java.io.FileOutputStream.init(FileOutputStream.java:169)
at java.io.FileOutputStream.init(FileOutputStream.java:70)
at com.jsrsys.web.JsrLineOut.open(JsrLineOut.java:73)
at com.jsrsys.web.JsrLineOut.setName(JsrLineOut.java:118)
at org.apache.jsp.AbstractCsv_jsp._jspService(AbstractCsv_jsp.java:359)




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



Re: Tomcat5.5: java.io.FilePermission access denied

2010-10-01 Thread Steve Ryder
Sorry, I meant 777.   Typo on my part.Is the Java Permissions error tied 
to the file system permissions.  I really do want ALL my apps to be able to 
read and write from the file system.  I use this mainly for creating CSV 
downloads, and occasionally for reading uploaded files.


Thanks in advance for any suggestions you might have.  Since I personally 
control ALL the jsp files in all apps on this server, is there some global 
command that will allow ALL permissions for JSPs so I don't have to discover 
them one by one.  (Which is the way Tomcat 5.0 works).
- Original Message - 
From: Caldarale, Charles R chuck.caldar...@unisys.com

To: Tomcat Users List users@tomcat.apache.org
Sent: Friday, October 01, 2010 11:59 AM
Subject: RE: Tomcat5.5: java.io.FilePermission access denied



From: Steve Ryder [mailto:sry...@jsrsys.com]
Subject: Tomcat5.5: java.io.FilePermission access denied



I have changed Linux permissions for Data to 377.


If I'm reading that correctly, that means the owner can write but not read, 
and everyone else can read and write.  Sounds a bit odd...


- Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.




-
To unsubscribe, e-mail: users-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: Tomcat5.5: java.io.FilePermission access denied

2010-10-01 Thread Steve Ryder

Thanks.  I changed the following:
# Use the Java security manager? (yes/no)  2010-10-01--change to no.
TOMCAT5_SECURITY=no

which will cause the following to NOT happen:
if [ $TOMCAT5_SECURITY = yes ]; then
JAVA_OPTS=$JAVA_OPTS -Djava.security.manager 
-Djava.security.policy=$CATALINA_BASE/conf/catalina.policy
fi

Thanks.
- Original Message - 
From: Caldarale, Charles R chuck.caldar...@unisys.com

To: Tomcat Users List users@tomcat.apache.org
Sent: Friday, October 01, 2010 1:02 PM
Subject: RE: Tomcat5.5: java.io.FilePermission access denied



From: Steve Ryder [mailto:sry...@jsrsys.com]
Subject: Re: Tomcat5.5: java.io.FilePermission access denied



Since I personally control ALL the jsp files in all
apps on this server, is there some global command
that will allow ALL permissions for JSPs so I don't
have to discover them one by one.


Then just disable the security manager.  Look at the Tomcat startup script 
you're using, and take out the java.security.manager and 
java.security.policy settings.


- Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you received 
this in error, please contact the sender and delete the e-mail and its 
attachments from all computers.



-
To unsubscribe, e-mail: users-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: Tomcat5.5: java.io.FilePermission access denied

2010-10-01 Thread Steve Ryder
AS EXPECTED this solved the problem.  All I had to do was set the file 
permissions for the file I overwrite.  The application is now working just 
fine.
- Original Message - 
From: Steve Ryder sry...@jsrsys.com

To: Tomcat Users List users@tomcat.apache.org
Sent: Friday, October 01, 2010 5:48 PM
Subject: Re: Tomcat5.5: java.io.FilePermission access denied



Thanks.  I changed the following:
# Use the Java security manager? (yes/no)  2010-10-01--change to no.
TOMCAT5_SECURITY=no

which will cause the following to NOT happen:
if [ $TOMCAT5_SECURITY = yes ]; then
JAVA_OPTS=$JAVA_OPTS -Djava.security.manager 
-Djava.security.policy=$CATALINA_BASE/conf/catalina.policy
fi

Thanks.
- Original Message - 
From: Caldarale, Charles R chuck.caldar...@unisys.com

To: Tomcat Users List users@tomcat.apache.org
Sent: Friday, October 01, 2010 1:02 PM
Subject: RE: Tomcat5.5: java.io.FilePermission access denied



From: Steve Ryder [mailto:sry...@jsrsys.com]
Subject: Re: Tomcat5.5: java.io.FilePermission access denied



Since I personally control ALL the jsp files in all
apps on this server, is there some global command
that will allow ALL permissions for JSPs so I don't
have to discover them one by one.


Then just disable the security manager.  Look at the Tomcat startup script 
you're using, and take out the java.security.manager and 
java.security.policy settings.


- Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you 
received this in error, please contact the sender and delete the e-mail 
and its attachments from all computers.



-
To unsubscribe, e-mail: users-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




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



Re: Tomcat 5.5: java.io.FilePermission read access denied to logging.properties

2010-09-26 Thread Steve Ryder
Thanks.  It turns out the root cause of the error was not permissions at 
all, but another error caused by a left over web.xml reference to a class 
that did not exist.  When I discovered, and removed, that statement in the 
web.xml, the logging properties error went away as well.



- Original Message - 
From: Rainer Jung rainer.j...@kippdata.de

To: users@tomcat.apache.org
Sent: Sunday, September 26, 2010 6:50 AM
Subject: Re: Tomcat 5.5: java.io.FilePermission read access denied to 
logging.properties




On 15.09.2010 11:02, Pid wrote:

On 14/09/2010 23:35, André Warnier wrote:

Pid wrote:

On 14/09/2010 16:17, Steve Ryder wrote:

java.security.AccessControlException: access denied
(java.io.FilePermission
/home/sryder/JsrSystems.info/ROOT/WEB-INF/classes/logging.properties
read)

When I first noticed this I added the java.io.FilePermission to
catalina.policy under WEB APP PERMISSIONS
grant { // Added by JSR 2010-09-13:
  permission java.io.FilePermission *, read,write;
 // Added by JSR 2010-02-08:
  permission java.util.PropertyPermission *, read,write;
 permission java.net.SocketPermission*, connect,resolve;

I still get the error at startup!

I have no logging.properties file under either the classes or under
common/classes.
Do I need to add one?  Can it be just a blank line?


Silly question: does the file have the appropriate user permissions for
Tomcat to access it?


Considering that the OP writes, just above there, that he does not have
a file there, that does indeed sound like a silly question.


Yeah.  I completely misread that.  Maybe I need specs.


The method in the stack indicates it might be a missing permission on the 
directories. The code wants to check whether the logging.properties in the 
webapp exists, and it seems it can't read the necessary directory 
information. So


- check directory permissions for 
/home/sryder/JsrSystems.info/ROOT/WEB-INF/classes/ and above


and if that doesn't suffice

- try adding read permissions for the directories to the policy file

Regards,

Rainer

-
To unsubscribe, e-mail: users-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



Help with jasypt (Java Security). NoClassDefFoundError.

2010-09-24 Thread Steve Ryder

I am new to jasypt.  I have installed the commons libraries that came with
the jasypt download in Apache.../common/lib.
The class not being found is in one of the libraries.
Tomcat 5.0, Java 1.4 running on Windows.
Do I need to do something in addition to copying the jar files into
common/lib?
commons-codec-1.1.jar, commons-lang-2.1.jar, jasypt-1.6.jar from jasypt
dist.
icu4j-charsets-4_4_1_1.jar, icu4j-4_4_1_1.jar  from icu website.

Also, once I get past this error, will I need BOTH icu libraries.This
exception is on Windows
development machine.

java.lang.NoClassDefFoundError:
org/apache/commons/lang/exception/NestableRuntimeException
java.lang.ClassLoader.defineClass0(Native Method)
java.lang.ClassLoader.defineClass(ClassLoader.java:539)
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
java.net.URLClassLoader.access$100(URLClassLoader.java:55)
java.net.URLClassLoader$1.run(URLClassLoader.java:194)
java.security.AccessController.doPrivileged(Native Method)
java.net.URLClassLoader.findClass(URLClassLoader.java:187)
java.lang.ClassLoader.loadClass(ClassLoader.java:289)
java.lang.ClassLoader.loadClass(ClassLoader.java:235)
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
org.jasypt.util.text.BasicTextEncryptor.init(BasicTextEncryptor.java:67)
org.apache.jsp.jasyptExample_jsp._jspService(jasyptExample_jsp.java:83)
---this is mine...
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

Below is my  simple test servlet
page import=org.jasypt.util.text.*
String password = 2010-09-23 11:21;
String origText = 123456789abcdef,f6c;
BasicTextEncryptor textEncryptor = new
BasicTextEncryptor();textEncryptor.setPassword(password);
String quePaso = textEncryptor.encrypt(origText);
String plainText = textEncryptor.decrypt(quePaso);
out.println(password+/+origText+/+quePaso+/+plainText); 



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



Re: Help with jasypt (Java Security). NoClassDefFoundError. (works on Linux)

2010-09-24 Thread Steve Ryder
I wish that were true.  I did that (after similar advice from jasypt user 
list), did not help.  Same error.
However, I uploaded to Linux Tomcat 5.5 Java 1.5 system, restarted Tomcat, 
and it works!
Go figure.  I still have one application running on an old server at Tomcat 
5.5 Java 1.4 level.  As soon as I migrate it I will update my Windows 
environment to match.
I stayed with Tomcat 5.5 as it is the last stable release and am also at 
similar level for 1.5.


I have learned the hard way that putting up the latest release is rarely a 
good idea unless there is some compelling reason to do so.


Thanks for the advice.
- Original Message - 
From: Christopher Schultz ch...@christopherschultz.net

To: Tomcat Users List users@tomcat.apache.org
Sent: Friday, September 24, 2010 12:01 PM
Subject: Re: Help with jasypt (Java Security). NoClassDefFoundError.



-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Steve,

On 9/24/2010 12:17 PM, Steve Ryder wrote:

java.lang.NoClassDefFoundError:
org/apache/commons/lang/exception/NestableRuntimeException


This is likely to be due to your placement of libraries.

Aside from Chuck's comments (with which I completely agree: it's upgrade
time for you), I would suggest that you place /all/ libraries your web
application needs into the webapp's WEB-INF/lib directory, and not use
common/lib for any of that stuff.

Moving your libraries from the common to the webapp's lib directory is
likely to solve this problem for you.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkyc2XwACgkQ9CaO5/Lv0PC34QCdHmCZ8/01n9wQD3gvKvaH2hD1
MmkAoJt6H9CxBYbRvCyeHUo7HR3OR7lr
=F5qN
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-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 5.5: java.io.FilePermission read access denied to logging.properties

2010-09-14 Thread Steve Ryder
java.security.AccessControlException: access denied (java.io.FilePermission 
/home/sryder/JsrSystems.info/ROOT/WEB-INF/classes/logging.properties read)

When I first noticed this I added the java.io.FilePermission 
to catalina.policy under WEB APP PERMISSIONS
grant { 
// Added by JSR 2010-09-13:
 permission java.io.FilePermission *, read,write;
// Added by JSR 2010-02-08:
 permission java.util.PropertyPermission *, read,write;
permission java.net.SocketPermission*, connect,resolve;
 
I still get the error at startup!

I have no logging.properties file under either the classes or under 
common/classes.
Do I need to add one?  Can it be just a blank line?  

Full trace follows;
Sep 13, 2010 11:17:44 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5
Sep 13, 2010 11:17:44 PM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
Sep 13, 2010 11:17:45 PM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
Sep 13, 2010 11:17:46 PM org.apache.commons.modeler.Registry registerComponent
SEVERE: Error registering 
Catalina:type=Valve,name=StandardContextValve,path=/,host=la.jsrsystems.info
javax.management.MBeanException: Cannot instantiate ModelMBean of class 
org.apache.commons.modeler.BaseModelMBean
 at org.apache.commons.modeler.ManagedBean.createMBean(ManagedBean.java:385)
 at org.apache.commons.modeler.Registry.registerComponent(Registry.java:835)
 at 
org.apache.catalina.core.StandardPipeline.registerValve(StandardPipeline.java:302)
 at org.apache.catalina.core.StandardPipeline.start(StandardPipeline.java:234)
 at org.apache.catalina.core.StandardContext.start(StandardContext.java:4140)
 at 
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
 at org.apache.catalina.core.ContainerBase.access$0(ContainerBase.java:744)
 at 
org.apache.catalina.core.ContainerBase$PrivilegedAddChild.run(ContainerBase.java:144)
 at java.security.AccessController.doPrivileged(Native Method)
 at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:738)
 at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
 at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)
 at 
org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)
 at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
 at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
 at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
 at 
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)
 at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
 at org.apache.catalina.core.StandardService.start(StandardService.java:448)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:585)
 at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:585)
 at org.apache.commons.daemon.support.DaemonLoader.start(DaemonLoader.java:177)
Caused by: java.security.AccessControlException: access denied 
(java.io.FilePermission 
/home/sryder/JsrSystems.info/ROOT/WEB-INF/classes/logging.properties read)
 at 
java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)
 at java.security.AccessController.checkPermission(AccessController.java:427)
 at java.lang.SecurityManager.checkPermission(SecurityManager.java:532)
 at java.lang.SecurityManager.checkRead(SecurityManager.java:871)
 at java.io.File.exists(File.java:700)
 at org.apache.naming.resources.FileDirContext.file(FileDirContext.java:828)
 at org.apache.naming.resources.FileDirContext.lookup(FileDirContext.java:211)
 at org.apache.naming.resources.ProxyDirContext.lookup(ProxyDirContext.java:294)
 at 
org.apache.catalina.loader.WebappClassLoader.findResourceInternal(WebappClassLoader.java:1924)
 at 
org.apache.catalina.loader.WebappClassLoader.findResource(WebappClassLoader.java:936)
 at 
org.apache.juli.ClassLoaderLogManager.readConfiguration(ClassLoaderLogManager.java:299)
 at 

Re: Tomcat 5.5: java.io.FilePermission read access denied to logging.properties

2010-09-14 Thread Steve Ryder
Thanks for your response, I really do need some help.  After lots of testing 
(when mail was working), I migrated my production workload to a new server. 
Yesterday, Java Mail stopped working, I suspect because I added the wrong 
permission in the wrong place.  (see #2).

I have tried removing that, but the error still happens.HELP.

1)  There is no logging.properties file under any ROOT/WEB-INF/ classes, it
is the security check that is failing.
2)   permission java.io.FilePermission *, read,write;   was in
catalina.policy.I have been experimenting all day with alternate
permission statements.  I did notice that I should not be updating
catalina.policy so have since move the permission stuff down into policy.d
folder as recommended.  What I need to know is to WHAT DO I GIVE PERMISSION?

From the stack

com.jsrsys.web.JsrSendMail.sendMail(JsrSendMail.java:507)--- my code
gets to:
javax.activation.MailcapCommandMap.init(MailcapCommandMap.java:153)
 failing here because:
java.security.AccessControlException: access denied (java.io.FilePermission
/home/sryder/JsrSystems.info/ROOT/WEB-INF/classes/logging.properties read)
java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)3)application code in JsrSendMail has 
been working for years under Tomcat5.0and was working under Tomcat 5.5  until I apparently startedaddingpermissions 
because of a bunch of mBean failures at startup.  AfterthatMail started to fail.  Removing those permissions does not 
help.The codesnippet that fails is: msg.setSentDate(new Date());if(!connectionIsOpen) result = setTransport(); 
   if(!result.equals(OK)) return result;sysout.display(JsrSendMail--line 509: 
keepOpen=+keepOpen+ connectionIsOpen=+connectionIsOpen  +result=+result  
);msg.saveChanges();  // don'tforget this this is the linethat fails.
tr.sendMessage(msg,msg.getAllRecipients());here is the whole stack from my call to the 
securityfailurejava.security.AccessControlException: access 
denied(java.io.FilePermission/home/sryder/JsrSystems.info/ROOT/WEB-IN
F/classes/logging.properties 
read)java.security.AccessControlContext.checkPermission(AccessControlContext.java:264)java.security.AccessController.checkPermission(AccessController.java:427)java.lang.SecurityManager.checkPermission(SecurityManager.java:532)java.lang.SecurityManager.checkRead(SecurityManager.java:871)java.io.File.exists(File.java:700)org.apache.naming.resources.FileDirContext.file(FileDirContext.java:828)org.apache.naming.resources.FileDirContext.lookup(FileDirContext.java:211)org.apache.naming.resources.ProxyDirContext.lookup(ProxyDirContext.java:294)org.apache.catalina.loader.WebappClassLoader.findResourceInternal(WebappClassLoader.java:1924)org.apache.catalina.loader.WebappClassLoader.findResource(WebappClassLoader.java:936)org.apache.juli.ClassLoaderLogManager.readConfiguration(ClassLoaderLogManager.java:299)org.apache.juli.ClassLoaderLogManager$2.run(ClassLoaderLogManager.java:273)java.security.AccessController.doPrivileged(Native
 Method)org.apache.juli.Cl
assLoaderLogManager.getClassLoaderInfo(ClassLoaderLogManager.java:270)org.apache.juli.ClassLoaderLogManager.getLogger(ClassLoaderLogManager.java:175)
 
java.util.logging.Logger.getLogger(Logger.java:255)com.sun.activation.registries.LogSupport.clinit(LogSupport.java:60)javax.activation.MailcapCommandMap.init(MailcapCommandMap.java:153)failing
 
herejavax.activation.CommandMap.getDefaultCommandMap(CommandMap.java:74)javax.activation.DataHandler.getCommandMap(DataHandler.java:167)javax.activation.DataHandler.getDataContentHandler(DataHandler.java:625)javax.activation.DataHandler.writeTo(DataHandler.java:329)javax.mail.internet.MimeUtility.getEncoding(MimeUtility.java:264)javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1301)javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1008)javax.mail.internet.MimeMultipart.updateHeaders(MimeMultipart.java:415)javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1287)javax.mail.internet.MimeM
essage.updateHeaders(MimeMessage.java:2072)javax.mail.internet.MimeMessage.saveChanges(MimeMessage.java:2040)com.jsrsys.web.JsrSendMail.sendMail(JsrSendMail.java:507)--- mycode- Original Message 
-From: Pid p...@pidster.comTo: TomcatUsers List users@tomcat.apache.orgSent: Tuesday, September 14, 2010 3:33PMSubject: Re: Tomcat 5.5: java.io.FilePermission read 
access deniedtologging.propertiesOn 14/09/2010 16:17, Steve Ryder wrote:java.security.AccessControlException: 
accessdenied(java.io.FilePermission/home/sryder/JsrSystems.info/ROOT/WEB-INF/classes/logging.properties read) When I first noticed this I added thejava.io.FilePermission to catalina.policy under WEB 
APP PERMISSIONS grant{ // Added by JSR 2010-09-13:  permission java.io.FilePermission *,read,write; // Added by JSR 2010-02-08:  
permissionjava.util.PropertyPermission *, read,write

Re: Tomcat 5.5 org.apache.naming.ResourceRef cannot be cast to javax.sql.DataSource

2010-01-26 Thread Steve Ryder

Oops:
sry...@srv:~$ java -version
java version 1.5.0
gij (GNU libgcj) version 4.2.3 (Ubuntu 4.2.3-2ubuntu6)

Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
sry...@srv:~$ which java
/usr/bin/java
sry...@srv:~$

OK, I think I see the problem.  I contracted out the construction of this 
server.  I need to replace the java install with the Sun version.  Do you 
agree?
- Original Message - 
From: Bob Hall rfha...@yahoo.com

To: Tomcat Users List users@tomcat.apache.org
Sent: Tuesday, January 26, 2010 1:47 AM
Subject: Re: Tomcat 5.5 org.apache.naming.ResourceRef cannot be cast to 
javax.sql.DataSource




Steve,

--- On Mon, 1/25/10 at 10:50 PM, Steve Ryder sry...@jsrsys.com wrote:


I understand what you mean by don't
use, but I am not using it.
What do I need to change so that it is not used?
How might I track down the offending library?


What do you get when you type the following commands:

$  java -version

$  which java

- Bob





-
To unsubscribe, e-mail: users-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 5.5 org.apache.naming.ResourceRef cannot be cast to javax.sql.DataSource

2010-01-25 Thread Steve Ryder

When I remove the factory line I now get:  Cannot create resource instance
2010-01-25 15:56:06:*WARNING*Connection to jdbc/MySql:: connect Other 
exception: Cannot create resource instance

2010-01-25 15:56:06:Driver=com.mysql.jdbc.Driver

The libraries are all in common\lib.  The ones I have added since the 5.5 
install are:

jsrweb (my Java code), mysql-connector-java-5.0.8-bin.jar,
naming-common.jar, naming-java.jar, mail.jar, and activation.jar.

I picked 5.5 because it is not getting active develpment, yet supports Java 
1.5, and has all the features I need hoping to minimize incompatabilities.


My Java connect code reads:   (indentation was lost when I copied)
private void connect(String dbName)

{

lastException = OK;

try

{

// Class.forName(org.gjt.mm.mysql.Driver);  ---I changed this last night 
hoping to fix problem.


sysout.display(Driver=com.mysql.jdbc.Driver);

Class.forName(com.mysql.jdbc.Driver);

}

catch (Exception E) {lastException= Unable to load driver; 
E.printStackTrace();


sysout.display(lastException);}


try

{

sql = Connection to jdbc/MySql:;

Context myContext = new InitialContext();

Context envContext = (Context)myContext.lookup(java:comp/env);

javax.sql.DataSource ds = 
(javax.sql.DataSource)envContext.lookup(jdbc/MySql);


conn = ds.getConnection();

stmt = conn.createStatement();

sql = USE + dbName; // attempt to mymic jdbcConnect set for dbName!

stmt.execute(sql);

sysout.display(**+sql + : connection to jdbc/MySql established.);

}

catch (SQLException E)

{ lastException=*WARNING*+sql+ : connect SQL exception: 

+ E.getMessage();

sysout.display(lastException);

//System.exit(4);

}

catch(Exception eOther)

{ lastException=*WARNING*+sql+ : connect Other exception: 

+ eOther.getMessage();

sysout.display(lastException);

//System.exit(4);

}

}



- Original Message - 
From: Caldarale, Charles R chuck.caldar...@unisys.com

To: Tomcat Users List users@tomcat.apache.org
Sent: Monday, January 25, 2010 8:52 AM
Subject: RE: Tomcat 5.5 org.apache.naming.ResourceRef cannot be cast to 
javax.sql.DataSource




From: Steve Ryder [mailto:sry...@jsrsys.com]
Subject: Tomcat 5.5 org.apache.naming.ResourceRef cannot be cast to
javax.sql.DataSource

Resource name=jdbc/MySql auth=Container
type=javax.sql.Datasource
factory=org.apache.commons.dbcp.BasicDataSourceFactory


The specified factory is for the standard Apache commons DBCP, not the one 
bundled with Tomcat.  You might try removing it and let the Tomcat DBCP 
factory do its thing.



My jdbc driver jar is: mysql-connector-java-5.0.8-bin.jar


Where is the JDBC jar located?

Since you're upgrading, why not upgrade to 6.0.x?  (5.5 is not getting 
much in the way of active development these days.)


- Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you 
received this in error, please contact the sender and delete the e-mail 
and its attachments from all computers.



-
To unsubscribe, e-mail: users-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 5.5 org.apache.naming.ResourceRef cannot be cast to javax.sql.DataSource

2010-01-25 Thread Steve Ryder
Some more testing... I added displays before each of the connect 
statements.  I get (still with no factory):
2010-01-25 16:27:07:*WARNING*Connection to jdbc/MySql:: connect Other 
exception: Cannot create resource instance

2010-01-25 16:27:07:JsrSQL: Context cast successfull
2010-01-25 16:27:07:Driver=com.mysql.jdbc.Driver
which tells me the failure is on the DataSource cast statement.

I then added factory back in and got:
2010-01-25 16:35:01:*WARNING*Connection to jdbc/MySql:: connect Other 
exception: org.apache.naming.ResourceRef cannot be cast to 
javax.sql.DataSource

2010-01-25 16:35:01:JsrSQL: Context cast successfull
2010-01-25 16:35:01:Driver=com.mysql.jdbc.Driver

So, failure is in same place with factory, but a different error.

I appreciate your suggestions, and look forward to other things I might need 
to change.


- Original Message - 
From: Caldarale, Charles R chuck.caldar...@unisys.com

To: Tomcat Users List users@tomcat.apache.org
Sent: Monday, January 25, 2010 8:52 AM
Subject: RE: Tomcat 5.5 org.apache.naming.ResourceRef cannot be cast to 
javax.sql.DataSource




From: Steve Ryder [mailto:sry...@jsrsys.com]
Subject: Tomcat 5.5 org.apache.naming.ResourceRef cannot be cast to
javax.sql.DataSource

Resource name=jdbc/MySql auth=Container
type=javax.sql.Datasource
factory=org.apache.commons.dbcp.BasicDataSourceFactory


The specified factory is for the standard Apache commons DBCP, not the one 
bundled with Tomcat.  You might try removing it and let the Tomcat DBCP 
factory do its thing.



My jdbc driver jar is: mysql-connector-java-5.0.8-bin.jar


Where is the JDBC jar located?

Since you're upgrading, why not upgrade to 6.0.x?  (5.5 is not getting 
much in the way of active development these days.)


- Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
MATERIAL and is thus for use only by the intended recipient. If you 
received this in error, please contact the sender and delete the e-mail 
and its attachments from all computers.



-
To unsubscribe, e-mail: users-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 5.5 org.apache.naming.ResourceRef cannot be cast to javax.sql.DataSource

2010-01-25 Thread Steve Ryder

Starting from the bottom up of your suggestions:
1)  I tried removing the try/catch.  No can do, Java compiler forces me to 
catch the exceptions.
2)  However, Java does provide a getStackTrace.  There were 33 elements, but 
since pages that don't try to connect ARE working I think only the below 
apply:
2010-01-25 
19:37:09:Stack(5)javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
2010-01-25 
19:37:09:Stack(4)org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
2010-01-25 
19:37:09:Stack(3)org.apache.jsp.index_jsp._jspService(index_jsp.java:89)

2010-01-25 19:37:09:Stack(2)com.jsrsys.web.JsrSQL.(JsrSQL.java:42)
2010-01-25 
19:37:09:Stack(1)com.jsrsys.web.JsrSQL.setDataBaseName(JsrSQL.java:86)

2010-01-25 19:37:09:Stack(0)com.jsrsys.web.JsrSQL.connect(JsrSQL.java:503)
2010-01-25 19:37:09:*WARNING*Connection to jdbc/MySql:: connect Other 
exception: org.apache.naming.ResourceRef cannot be cast to 
javax.sql.DataSource

2010-01-25 19:37:09:JsrSQL: Context cast successfull
2010-01-25 19:37:09:Driver=com.mysql.jdbc.Driver
Not much help here, but it is very good to be able to print the trace when 
debugging so glad I was able to learn how.


I am now going to remove the Class.forName code and see if that changes any 
thing.
- Original Message - 
From: Christopher Schultz ch...@christopherschultz.net

To: Tomcat Users List users@tomcat.apache.org
Sent: Monday, January 25, 2010 12:07 PM
Subject: Re: Tomcat 5.5 org.apache.naming.ResourceRef cannot be cast to 
javax.sql.DataSource




-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Steve,

On 1/25/2010 11:16 AM, Steve Ryder wrote:
When I remove the factory line I now get:  Cannot create resource 
instance

2010-01-25 15:56:06:*WARNING*Connection to jdbc/MySql:: connect Other
exception: Cannot create resource instance


Ok.


The libraries are all in common\lib.  The ones I have added since the
5.5 install are:
jsrweb (my Java code), mysql-connector-java-5.0.8-bin.jar,
naming-common.jar, naming-java.jar, mail.jar, and activation.jar.

I picked 5.5 because it is not getting active develpment, yet supports
Java 1.5, and has all the features I need hoping to minimize
incompatabilities.


Fair enough.


My Java connect code reads:   (indentation was lost when I copied)
private void connect(String dbName)
{
lastException = OK;
try
{
// Class.forName(org.gjt.mm.mysql.Driver);  ---I changed this last
night hoping to fix problem.

sysout.display(Driver=com.mysql.jdbc.Driver);

Class.forName(com.mysql.jdbc.Driver);

}
catch (Exception E) {lastException= Unable to load driver;
E.printStackTrace();


You don't need any of the above if you are using a connection pool: the
pool will register the driver for you.


sysout.display(lastException);}


What does this print, including the stack trace from the catch block?


try
{
sql = Connection to jdbc/MySql:;
Context myContext = new InitialContext();
Context envContext = (Context)myContext.lookup(java:comp/env);


Ok.


javax.sql.DataSource ds =
(javax.sql.DataSource)envContext.lookup(jdbc/MySql);

conn = ds.getConnection();

stmt = conn.createStatement();


Ok.


sql = USE + dbName; // attempt to mymic jdbcConnect set for dbName!

stmt.execute(sql);


This is not necessary as you have already selected your db via the
connection URL.


catch (SQLException E)

{ lastException=*WARNING*+sql+ : connect SQL exception: 

+ E.getMessage();

sysout.display(lastException);

//System.exit(4);

}
catch(Exception eOther)

{ lastException=*WARNING*+sql+ : connect Other exception: 

+ eOther.getMessage();

sysout.display(lastException);

//System.exit(4);

}


So, the above is the source of the error message which has all your
extra stuff like *WARNING*Connection to jdbc/MySql:: connect SQL
exception: plus the message from the real exception. I don't recognize
Cannot create resource instance so it would be helpful to show the
full stack trace and the real exception that caused the message to print.

I would recommend not catching Exception unless there is a good reason
to do so: allow the exception to propagate up the stack to a place where
it can be appropriately caught and dealt with, or at least logged
properly. What happens when this code fails and the conn member isn't
set properly? I'm guessing you either get NullPointerExceptions later in
your code, or you have to have a bunch of null checking in your query
code which is kind of ugly.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEUEARECAAYFAktd3f0ACgkQ9CaO5/Lv0PD6CgCXWjgZIBoBQrgS7ciU7Y4L8TGt
TQCbBC+bDwqmlEgAeiCXp/PdeweDFWM=
=aaxM
-END PGP SIGNATURE-

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



-
To unsubscribe, e-mail: users-unsubscr

Re: Tomcat 5.5 org.apache.naming.ResourceRef cannot be cast to javax.sql.DataSource

2010-01-25 Thread Steve Ryder
Removing the Class.forName code did not change anything, I still get the 
same error.
2010-01-25 20:00:03:*WARNING*Connection to jdbc/MySql:: connect Other 
exception: org.apache.naming.ResourceRef cannot be cast to 
javax.sql.DataSource
2010-01-25 
20:00:03:Stack(4)=org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
2010-01-25 
20:00:03:Stack(3)=org.apache.jsp.index_jsp._jspService(index_jsp.java:89)

2010-01-25 20:00:03:Stack(2)=com.jsrsys.web.JsrSQL.(JsrSQL.java:42)
2010-01-25 
20:00:03:Stack(1)=com.jsrsys.web.JsrSQL.setDataBaseName(JsrSQL.java:86)

2010-01-25 20:00:03:Stack(0)=com.jsrsys.web.JsrSQL.connect(JsrSQL.java:504)
2010-01-25 20:00:03:JsrSQL: Context cast successfull

I have now changed my stack trace display code to stop when it hits the 
org.apache.jasper... code.
- Original Message - 
From: Christopher Schultz ch...@christopherschultz.net

To: Tomcat Users List users@tomcat.apache.org
Sent: Monday, January 25, 2010 12:07 PM
Subject: Re: Tomcat 5.5 org.apache.naming.ResourceRef cannot be cast to 
javax.sql.DataSource




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



Re: Tomcat 5.5 org.apache.naming.ResourceRef cannot be cast to javax.sql.DataSource

2010-01-25 Thread Steve Ryder

Sequence of events:
1)  With factory got cast error.
2)  Took out factory= and got Cannot create resource instance
3)  Put factory statement back in.  Is there a different one I should try?
The  cast exception is Thrown by this line
javax.sql.DataSource ds = 
(javax.sql.DataSource)envContext.lookup(jdbc/MySql);


in the connect method.   Here is the whole method as of the last test:

/**

* called by setDataBaseName

*/

private void connect(String dbName)

{

lastException = OK;

/* don't need this if have connection pools

try

{

// Class.forName(org.gjt.mm.mysql.Driver);

sysout.display(Driver=com.mysql.jdbc.Driver);

Class.forName(com.mysql.jdbc.Driver);

}

catch (Exception E) {lastException= Unable to load driver; 
E.printStackTrace();


sysout.display(lastException);}

*/

try

{

sql = Connection to jdbc/MySql:;

Context myContext = new InitialContext();

Context envContext = (Context)myContext.lookup(java:comp/env);

sysout.display(JsrSQL: Context cast successfull);

javax.sql.DataSource ds = 
(javax.sql.DataSource)envContext.lookup(jdbc/MySql);


sysout.display(JsrSQL: DataSource cast successfull);

conn = ds.getConnection();

sysout.display(JsrSQL: conn = ds successfull);

stmt = conn.createStatement();

sql = USE + dbName; // attempt to mymic jdbcConnect set for dbName!

stmt.execute(sql);

sysout.display(**+sql + : connection to jdbc/MySql established.);

}

catch (SQLException E)

{ lastException=*WARNING*+sql+ : connect SQL exception: 

+ E.getMessage();

sysout.display(lastException);

}

catch(Exception eOther)

{

StackTraceElement[] stack = eOther.getStackTrace();

for (int s=0; s  stack.length; s++)

{

lastException = Stack(+s+)= + stack[s];

sysout.display(lastException);

if (lastException.indexOf(org.apache.jasper)  -1)

break;

}

lastException=*WARNING*+sql+ : connect Other exception: 

+ eOther.getMessage();

sysout.display(lastException);

}

}

- Original Message - 
From: Christopher Schultz ch...@christopherschultz.net

To: Tomcat Users List users@tomcat.apache.org
Sent: Monday, January 25, 2010 2:40 PM
Subject: Re: Tomcat 5.5 org.apache.naming.ResourceRef cannot be cast to 
javax.sql.DataSource




-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Steve,

On 1/25/2010 2:56 PM, Steve Ryder wrote:

Starting from the bottom up of your suggestions:
1)  I tried removing the try/catch.  No can do, Java compiler forces me
to catch the exceptions.


Hmm... what method is declared as throwing Exception instead of
something more specific?


2)  However, Java does provide a getStackTrace.


Throwable.printStackTrace() will also do the trick.


2010-01-25
19:37:09:Stack(5)javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

2010-01-25
19:37:09:Stack(4)org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)

2010-01-25
19:37:09:Stack(3)org.apache.jsp.index_jsp._jspService(index_jsp.java:89)
2010-01-25 19:37:09:Stack(2)com.jsrsys.web.JsrSQL.(JsrSQL.java:42)
2010-01-25
19:37:09:Stack(1)com.jsrsys.web.JsrSQL.setDataBaseName(JsrSQL.java:86)
2010-01-25 
19:37:09:Stack(0)com.jsrsys.web.JsrSQL.connect(JsrSQL.java:503)


Is this the code you posted earlier? If so, which line is 503?


2010-01-25 19:37:09:*WARNING*Connection to jdbc/MySql:: connect Other
exception: org.apache.naming.ResourceRef cannot be cast to
javax.sql.DataSource


This isn't the error message you posted earlier. The one you posted
earlier was:


2010-01-25 15:56:06:*WARNING*Connection to jdbc/MySql:: connect Other
exception: Cannot create resource instance



Removing the Class.forName code did not change anything, I still get
the same error.


Right: the Class.forName simply wasn't necessary... I didn't expect it
to change anything.

2010-01-25 20:00:03:*WARNING*Connection to jdbc/MySql:: connect Other 
exception: org.apache.naming.ResourceRef cannot be cast to 
javax.sql.DataSource


2010-01-25 
20:00:03:Stack(4)=org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
2010-01-25 
20:00:03:Stack(3)=org.apache.jsp.index_jsp._jspService(index_jsp.java:89)

2010-01-25 20:00:03:Stack(2)=com.jsrsys.web.JsrSQL.(JsrSQL.java:42)
2010-01-25 
20:00:03:Stack(1)=com.jsrsys.web.JsrSQL.setDataBaseName(JsrSQL.java:86)
2010-01-25 
20:00:03:Stack(0)=com.jsrsys.web.JsrSQL.connect(JsrSQL.java:504)

2010-01-25 20:00:03:JsrSQL: Context cast successfull


Could you re-post the whole method? The object you get from the JNDI
context really /should/ be a javax.sql.DataSource object, not a
ResourceLink.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkteAdMACgkQ9CaO5/Lv0PAm7wCfSWyuzVUbJ1zXqaruicFBoUnS
R6wAn3JGjRZ7uMS5uf1tR8utZ7oWnzpT
=ymR0
-END PGP SIGNATURE-

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

Re: Tomcat 5.5 org.apache.naming.ResourceRef cannot be cast to javax.sql.DataSource

2010-01-25 Thread Steve Ryder
OK, I took factory out of context.xml, now I get Resource Instance again, 
but this time I have the trace!
2010-01-26 05:11:30:*WARNING*Connection to jdbc/MySql:: connect Other 
exception: Cannot create resource instance
2010-01-26 
05:11:30:Stack(10)=org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
2010-01-26 
05:11:30:Stack(9)=org.apache.jsp.AppList_jsp._jspService(AppList_jsp.java:157)

2010-01-26 05:11:30:Stack(8)=com.jsrsys.web.JsrSQL.(JsrSQL.java:42)
2010-01-26 
05:11:30:Stack(7)=com.jsrsys.web.JsrSQL.setDataBaseName(JsrSQL.java:86)

2010-01-26 05:11:30:Stack(6)=com.jsrsys.web.JsrSQL.connect(JsrSQL.java:504)
2010-01-26 
05:11:30:Stack(5)=org.apache.naming.NamingContext.lookup(NamingContext.java:153)
2010-01-26 
05:11:30:Stack(4)=org.apache.naming.NamingContext.lookup(NamingContext.java:781)
2010-01-26 
05:11:30:Stack(3)=org.apache.naming.NamingContext.lookup(NamingContext.java:140)
2010-01-26 
05:11:30:Stack(2)=org.apache.naming.NamingContext.lookup(NamingContext.java:793)
2010-01-26 
05:11:30:Stack(1)=javax.naming.spi.NamingManager.getObjectInstance(libgcj.so.81)
2010-01-26 
05:11:30:Stack(0)=org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:143)

2010-01-26 05:11:30:JsrSQL: Context cast successfull

line 504 is the middle line of:
503 get's executed (see above):  sysout.display(JsrSQL: Context cast 
successfull);


504 throws exception: javax.sql.DataSource ds = 
(javax.sql.DataSource)envContext.lookup(jdbc/MySql);


505 never gets here:  sysout.display(JsrSQL: DataSource 
cast successfull);



- Original Message - 
From: Christopher Schultz ch...@christopherschultz.net

To: Tomcat Users List users@tomcat.apache.org
Sent: Monday, January 25, 2010 2:40 PM
Subject: Re: Tomcat 5.5 org.apache.naming.ResourceRef cannot be cast to 
javax.sql.DataSource




-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Steve,

On 1/25/2010 2:56 PM, Steve Ryder wrote:

Starting from the bottom up of your suggestions:
1)  I tried removing the try/catch.  No can do, Java compiler forces me
to catch the exceptions.


Hmm... what method is declared as throwing Exception instead of
something more specific?


2)  However, Java does provide a getStackTrace.


Throwable.printStackTrace() will also do the trick.


2010-01-25
19:37:09:Stack(5)javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

2010-01-25
19:37:09:Stack(4)org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)

2010-01-25
19:37:09:Stack(3)org.apache.jsp.index_jsp._jspService(index_jsp.java:89)
2010-01-25 19:37:09:Stack(2)com.jsrsys.web.JsrSQL.(JsrSQL.java:42)
2010-01-25
19:37:09:Stack(1)com.jsrsys.web.JsrSQL.setDataBaseName(JsrSQL.java:86)
2010-01-25 
19:37:09:Stack(0)com.jsrsys.web.JsrSQL.connect(JsrSQL.java:503)


Is this the code you posted earlier? If so, which line is 503?


2010-01-25 19:37:09:*WARNING*Connection to jdbc/MySql:: connect Other
exception: org.apache.naming.ResourceRef cannot be cast to
javax.sql.DataSource


This isn't the error message you posted earlier. The one you posted
earlier was:


2010-01-25 15:56:06:*WARNING*Connection to jdbc/MySql:: connect Other
exception: Cannot create resource instance



Removing the Class.forName code did not change anything, I still get
the same error.


Right: the Class.forName simply wasn't necessary... I didn't expect it
to change anything.

2010-01-25 20:00:03:*WARNING*Connection to jdbc/MySql:: connect Other 
exception: org.apache.naming.ResourceRef cannot be cast to 
javax.sql.DataSource


2010-01-25 
20:00:03:Stack(4)=org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
2010-01-25 
20:00:03:Stack(3)=org.apache.jsp.index_jsp._jspService(index_jsp.java:89)

2010-01-25 20:00:03:Stack(2)=com.jsrsys.web.JsrSQL.(JsrSQL.java:42)
2010-01-25 
20:00:03:Stack(1)=com.jsrsys.web.JsrSQL.setDataBaseName(JsrSQL.java:86)
2010-01-25 
20:00:03:Stack(0)=com.jsrsys.web.JsrSQL.connect(JsrSQL.java:504)

2010-01-25 20:00:03:JsrSQL: Context cast successfull


Could you re-post the whole method? The object you get from the JNDI
context really /should/ be a javax.sql.DataSource object, not a
ResourceLink.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkteAdMACgkQ9CaO5/Lv0PAm7wCfSWyuzVUbJ1zXqaruicFBoUnS
R6wAn3JGjRZ7uMS5uf1tR8utZ7oWnzpT
=ymR0
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-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 5.5 org.apache.naming.ResourceRef cannot be cast to javax.sql.DataSource

2010-01-25 Thread Steve Ryder
 - 
From: Konstantin Kolinko knst.koli...@gmail.com

To: Tomcat Users List users@tomcat.apache.org
Sent: Monday, January 25, 2010 3:14 PM
Subject: Re: Tomcat 5.5 org.apache.naming.ResourceRef cannot be cast to 
javax.sql.DataSource




2010/1/25 Steve Ryder sry...@jsrsys.com:

Resource name=jdbc/MySql auth=Container type=javax.sql.Datasource


The above should be javax.sql.DataSource


Do you have any references to this resource in your web.xml file?


Best regards,
Konstantin Kolinko

-
To unsubscribe, e-mail: users-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 5.5 org.apache.naming.ResourceRef cannot be cast to javax.sql.DataSource

2010-01-25 Thread Steve Ryder
(Http11Processor.java:874) 
at 
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665) 
at 
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528) 
at 
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81) 
at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689) 
at java.lang.Thread.run(libgcj.so.81) ** END NESTED EXCEPTION ** Attempted 
reconnect 3 times. Giving up.)
2010-01-26 
05:38:29:Stack(6)=org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
2010-01-26 
05:38:29:Stack(5)=org.apache.jsp.AppList_jsp._jspService(AppList_jsp.java:157)

2010-01-26 05:38:29:Stack(4)=com.jsrsys.web.JsrSQL.(JsrSQL.java:42)
2010-01-26 
05:38:29:Stack(3)=com.jsrsys.web.JsrSQL.setDataBaseName(JsrSQL.java:86)

2010-01-26 05:38:29:Stack(2)=com.jsrsys.web.JsrSQL.connect(JsrSQL.java:506)
2010-01-26 
05:38:29:Stack(1)=org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
2010-01-26 
05:38:29:Stack(0)=org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1225)

2010-01-26 05:38:24:JsrSQL: DataSource cast successfull
2010-01-26 05:38:24:JsrSQL: Context cast successfull

- Original Message - 
From: Konstantin Kolinko knst.koli...@gmail.com

To: Tomcat Users List users@tomcat.apache.org
Sent: Monday, January 25, 2010 3:14 PM
Subject: Re: Tomcat 5.5 org.apache.naming.ResourceRef cannot be cast to 
javax.sql.DataSource




2010/1/25 Steve Ryder sry...@jsrsys.com:

Resource name=jdbc/MySql auth=Container type=javax.sql.Datasource


The above should be javax.sql.DataSource


Do you have any references to this resource in your web.xml file?


Best regards,
Konstantin Kolinko

-
To unsubscribe, e-mail: users-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 5.5 org.apache.naming.ResourceRef cannot be cast to javax.sql.DataSource

2010-01-25 Thread Steve Ryder

I understand what you mean by don't use, but I am not using it.
What do I need to change so that it is not used?
How might I track down the offending library?
- Original Message - 
From: Konstantin Kolinko knst.koli...@gmail.com

To: Tomcat Users List users@tomcat.apache.org
Sent: Tuesday, January 26, 2010 12:29 AM
Subject: Re: Tomcat 5.5 org.apache.naming.ResourceRef cannot be cast to 
javax.sql.DataSource




2010/1/26 Steve Ryder sry...@jsrsys.com:

at gnu.gcj.convert.Input_iconv.read(libgcj.so.81)


Stop right there. Do not use GNU Java for anything.

-
To unsubscribe, e-mail: users-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



Tomcat 5.5 org.apache.naming.ResourceRef cannot be cast to javax.sql.DataSource

2010-01-24 Thread Steve Ryder
I am migrating from Tomcat 5.0 w/ MSQL 4.1 to Tomcat 5.5 w/ MySQL Server 
version: 5.0.51a-3ubuntu5 (Ubuntu). I have followed the Tomcat Tutorials 
changing 
from: ResourceLink in context.xml - Resource in server.xml 
to: just Resource in context.xml. 

Resource name=jdbc/MySql auth=Container type=javax.sql.Datasource 
factory=org.apache.commons.dbcp.BasicDataSourceFactory 
url=jdbc:mysql://localhost.localdomain/rsa?autoReconnect=true 
driverClassName=com.mysql.jdbc.Driver 
password=** username=jsrsys 
maxWait=1 maxActive=200 maxIdle=5 
removeAbandoned=true removeAbandonedTimeout=300 logAbandoned=true 
/ 
Note: password ** not real password! 

My jdbc driver jar is: mysql-connector-java-5.0.8-bin.jar 
When my Java application tries to connect it throws the error: 
org.apache.naming.ResourceRef cannot be cast to javax.sql.DataSource 

The application code works fine with the old MySQL and Tomcat in both Fedora 
and Windows. I can't figure out what I may have done wrong or where to turn 
next. 

Any advice would be sincerely appreciated.