Exception when trying to configure a pool of connections for use of WS
Hello everybody, I am trying to set up the configuration for a pool of connections to a MySQL DB and I get the following exception when deploying on Tomcat. I followed the steps at http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html. The application actually consists of a web service that performs a query to the DB. Any hints or suggestions? Thank you! Context file Web.xml http://java.sun.com/xml/ns/javaee"; xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation=" http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd";> com.sun.xml.ws.transport.http.servlet.WSServletContextListener DBAccess com.sun.xml.ws.transport.http.servlet.WSServlet 1 DBAccessService com.sun.xml.ws.transport.http.servlet.WSServlet 1 DBAccess /DBAccess DBAccessService /DBAccessService 30 index.jsp The database DataSource for the Acme web application. jdbc/MySQL_cellmlrep javax.sql.DataSource Container Exception java.lang.ClassCastException: org.apache.tomcat.dbcp.dbcp.BasicDataSource cannot be cast to javax.naming.Context at org.apache.catalina.core.NamingContextListener.createSubcontexts(NamingContextListener.java:1203) at org.apache.catalina.core.NamingContextListener.addResource(NamingContextListener.java:1015) at org.apache.catalina.core.NamingContextListener.createNamingContext(NamingContextListener.java:633) at org.apache.catalina.core.NamingContextListener.lifecycleEvent(NamingContextListener.java:237) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4252) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:627) at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at org.apache.catalina.core.StandardHost.start(StandardHost.java:719) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:516) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:578) 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:597) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Re: Exception when trying to configure a pool of connections for use of WS
Thanks David! The code is: Class.forName("com.mysql.jdbc.Driver"); String url = "jdbc:mysql://localhost:3306/cellmlrep"; Connection con = DriverManager.getConnection(url, "root", ""); Statement stmt = con.createStatement(); String query = "SELECT * FROM user_accounts u;"; stmt.executeQuery(query); Daniele On Fri, Sep 5, 2008 at 6:00 PM, David Smith <[EMAIL PROTECTED]> wrote: > And the code you use to get a connection? Looks like the database pool > should be fine, you are getting a javax.sql.DataSource object but treating > it as a java.naming.Context object. > > As an aside and definitely not things affecting the issue you describe > below: > 1. Do not use the root user in the database service for a web application. > It's a potential security flaw big enough to fit a jumbo jet into. > 2. Do use strong passwords on the database (especially for the root > account) with at least three character classes (upper case, lower case, > punctuation, numbers) and no dictionary words present. > 2. Add a validatonQuery="select 1" attribute to your > element so connections are tested and regenerated as needed. > > --David > > > Daniele Development-ML wrote: > >> Hello everybody, >> >> I am trying to set up the configuration for a pool of connections to a >> MySQL >> DB and I get the following exception when deploying on Tomcat. >> I followed the steps at >> >> http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html >> . >> >> The application actually consists of a web service that performs a query >> to >> the DB. >> >> Any hints or suggestions? Thank you! >> >> Context file >> >> >> >>> auth="Container" >> user="root" password="root" >> driverClassName="com.mysql.jdbc.Driver" >> url="jdbc:mysql://localhost:3306/cellmlrep" maxActive="8" >> maxIdle="4"/> >> >> >> Web.xml >> >> >> http://java.sun.com/xml/ns/javaee"; >> xmlns:xsi=" >> http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation=" >> http://java.sun.com/xml/ns/javaee >> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd";> >> >> >> >> com.sun.xml.ws.transport.http.servlet.WSServletContextListener >> >> >>DBAccess >> >> >> com.sun.xml.ws.transport.http.servlet.WSServlet >>1 >> >> >>DBAccessService >> >> >> com.sun.xml.ws.transport.http.servlet.WSServlet >>1 >> >> >>DBAccess >>/DBAccess >> >> >>DBAccessService >>/DBAccessService >> >> >> >>30 >> >> >> >>index.jsp >> >> >> >>The database DataSource for the Acme web application. >> >>jdbc/MySQL_cellmlrep >>javax.sql.DataSource >>Container >> >> >> >> >> Exception >> >> java.lang.ClassCastException: org.apache.tomcat.dbcp.dbcp.BasicDataSource >> cannot be cast to javax.naming.Context >>at >> >> org.apache.catalina.core.NamingContextListener.createSubcontexts(NamingContextListener.java:1203) >>at >> >> org.apache.catalina.core.NamingContextListener.addResource(NamingContextListener.java:1015) >>at >> >> org.apache.catalina.core.NamingContextListener.createNamingContext(NamingContextListener.java:633) >>at >> >> org.apache.catalina.core.NamingContextListener.lifecycleEvent(NamingContextListener.java:237) >>at >> >> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) >>at >> org.apache.catalina.core.StandardContext.start(StandardContext.java:4252) >>at >> >> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) >>at >> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) >>at >> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525) >>at >> >> org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:627) >>at >> >> org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553) >>at >> org.apach
Re: Exception when trying to configure a pool of connections for use of WS
No, actually it happens when I invoke the WS, which access to the DB. Daniele On Sat, Sep 6, 2008 at 4:44 PM, Len Popp <[EMAIL PROTECTED]> wrote: > Does the error occur in that piece of code or is it during Tomcat > startup? The stack trace looks like the exception is thrown during > startup, if I'm reading it correctly. > -- > Len > > On Sat, Sep 6, 2008 at 06:29, Daniele Development-ML > <[EMAIL PROTECTED]> wrote: > > Thanks David! > > The code is: > > > > Class.forName("com.mysql.jdbc.Driver"); > > String url = "jdbc:mysql://localhost:3306/cellmlrep"; > > > > Connection con = DriverManager.getConnection(url, "root", ""); > > > > Statement stmt = con.createStatement(); > > > > String query = "SELECT * FROM user_accounts u;"; > > stmt.executeQuery(query); > > > > > > Daniele > > > > On Fri, Sep 5, 2008 at 6:00 PM, David Smith <[EMAIL PROTECTED]> wrote: > > > >> And the code you use to get a connection? Looks like the database pool > >> should be fine, you are getting a javax.sql.DataSource object but > treating > >> it as a java.naming.Context object. > >> > >> As an aside and definitely not things affecting the issue you describe > >> below: > >> 1. Do not use the root user in the database service for a web > application. > >> It's a potential security flaw big enough to fit a jumbo jet into. > >> 2. Do use strong passwords on the database (especially for the root > >> account) with at least three character classes (upper case, lower case, > >> punctuation, numbers) and no dictionary words present. > >> 2. Add a validatonQuery="select 1" attribute to your > >> element so connections are tested and regenerated as needed. > >> > >> --David > >> > >> > >> Daniele Development-ML wrote: > >> > >>> Hello everybody, > >>> > >>> I am trying to set up the configuration for a pool of connections to a > >>> MySQL > >>> DB and I get the following exception when deploying on Tomcat. > >>> I followed the steps at > >>> > >>> > http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html > >>> . > >>> > >>> The application actually consists of a web service that performs a > query > >>> to > >>> the DB. > >>> > >>> Any hints or suggestions? Thank you! > >>> > >>> Context file > >>> > >>> > >>> > >>> >>> auth="Container" > >>> user="root" password="root" > >>> driverClassName="com.mysql.jdbc.Driver" > >>> url="jdbc:mysql://localhost:3306/cellmlrep" maxActive="8" > >>> maxIdle="4"/> > >>> > >>> > >>> Web.xml > >>> > >>> > >>> http://java.sun.com/xml/ns/javaee"; > >>> xmlns:xsi=" > >>> http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation=" > >>> http://java.sun.com/xml/ns/javaee > >>> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd";> > >>> > >>> > >>> > >>> > com.sun.xml.ws.transport.http.servlet.WSServletContextListener > >>> > >>> > >>>DBAccess > >>> > >>> > >>> > com.sun.xml.ws.transport.http.servlet.WSServlet > >>>1 > >>> > >>> > >>>DBAccessService > >>> > >>> > >>> > com.sun.xml.ws.transport.http.servlet.WSServlet > >>>1 > >>> > >>> > >>>DBAccess > >>>/DBAccess > >>> > >>> > >>>DBAccessService > >>>/DBAccessService > >>> > >>> > >>> > >>>30 > >>> > >>> > >>> > >>>index.jsp > >>> > >>> > >>> > >>>The database DataSource for the Acme web application. > >>> > >>>jdbc/MySQL_cellmlrep > >>>javax.sql.DataSource > >>
Problems with user/password data when trying to connect to DBs - Tomcat sees '' as username instead of the given one
Hello, I have a WS deployed on Tomcat and querying a DB. The JDBC and JNDI configurations should be fine but I still have some problems. When loading the WS (actually starting Tomcat) I got the following exception. It doesn't recognise the user and password I set in the context.xml. I searched for similar problems, but in the net there are only example exceptions that indeed see the username they set. In my case, the program doesn't consider the username "me" and indeed tries to estabilish the connection with username ' ' . The account perfectly works when accessing through the MySQL Query Browser. Any hints on what I'm doing wrong? Thanks! Dan Tomcat Exception: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Access denied for user ''@'localhost' (using password: YES)) at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1225) at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880) at uk.ac.ox.comlab.combio.euhart.db.DBAccess.connect(DBAccess.java:96) at uk.ac.ox.comlab.combio.euhart.db.DBAccess.(DBAccess.java:37) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at java.lang.Class.newInstance0(Class.java:355) at java.lang.Class.newInstance(Class.java:308) at com.sun.xml.ws.api.server.InstanceResolver.createNewInstance(InstanceResolver.java:215) at com.sun.xml.ws.api.server.InstanceResolver.createDefault(InstanceResolver.java:180) at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:123) at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:467) at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parseAdapters(DeploymentDescriptorParser.java:253) at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parse(DeploymentDescriptorParser.java:147) at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.contextInitialized(WSServletContextListener.java:108) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:627) at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at org.apache.catalina.core.StandardHost.start(StandardHost.java:719) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:516) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:578) 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:597) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413) Caused by: java.sql.SQLException: Access denied for user ''@'localhost' (using password: YES) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3491) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3423) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:910) at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3923) at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1273) at com.mysql.jdbc.ConnectionImpl.createNewIO(Conne
Multiple invocation of servlet with the same URL request
Hello everybody, I'm developing a web application using Struts and Tomcat as deployment container. A servlet of the application retrieves a BLOB object (ca 1 - 4 MB) from the local database and registers this activity in another table, of the same db. Looking at the log and all the printouts, I have noticed that the servlet is invoked four times (four log entries in the database) instead of one. This is also shown by the four System.out lines I found in the screen when requesting the same URL. Anybody has any hint about this problem and how to resolve it? My idea is that the servlet might be relatively slow and thus Tomcat reiterates the request. Is this right? How can I disable this or increase the response time? Many thanks, Dan
Re: Multiple invocation of servlet with the same URL request
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286) at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:857) at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:565) at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1509) at java.lang.Thread.run(Thread.java:619) == VISUALISATION! java.lang.Exception at webinterface.actions.JarRetriever.getStreamInfo(JarRetriever.java:100) at org.apache.struts.actions.DownloadAction.execute(DownloadAction.java:106) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286) at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:857) at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:565) at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1509) at java.lang.Thread.run(Thread.java:619) On Sun, Jul 5, 2009 at 11:05 PM, Caldarale, Charles R < chuck.caldar...@unisys.com> wrote: > > From: Daniele Development-ML [mailto:daniele@googlemail.com] > > Subject: Multiple invocation of servlet with the same URL request > > > > Anybody has any hint about this problem and how to resolve it? > > It's you code - do more debugging. Start by including a stack trace where > you have the System.out calls so you can see how the servlet is calling > itself. > > > My idea is that the servlet might be relatively slow and > > thus Tomcat reiterates the request. Is this right? > > No - Tomcat does no such thing. > > - 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 > >
Remote logging
Hello everybody, I have deployed a web application within a remote Tomcat server and now I need to access the Tomcat logging for debugging purposes. Anybody knows whether is available a web application to monitor this remotely - in analogy with the Manager application? Or any other techniques you would suggest to make this possible through a remote approach? Many thanks! Daniele
Accessing stdout while remotely monitoring tomcat with lambda probe
Hello everybody, I'm trying to monitor Tomcat with lambdaprobe and I'm coming across some configuration difficulties - the best place where to post this question would be their forum, but it appears to be not very active and thus I'm giving a go here. The problem is that I cannot visualise the content of the stdout file, which is automatically redirected in CATALINA/logs/stdout_20090816.log . I wonder how I could possibly configure the application to include this file in the log file list. Could you suggest anything about this? I know that a good practice should be using the logging system, rather than printing out on stdout, but I have to temporarily get around this. Thanks! Dan
Re: swallowOutput="true" not working. Why?
Hi Chris, I'm coming across the same identical problem - your final message says you have solved it. Could you post the detailed steps required to solve it? It might beneficial to all of us. Thanks, Dan On Mon, Jun 15, 2009 at 4:17 AM, Christopher Piggott wrote: > Konstantin, > > Thanks for sharing your experience. It was helpful. > > I still have swallowOutput enabled but, with help from folks on this > list, I kind of came to the same conclusion as you. I also realized > that I was making a mistake by trying to have my webapp use the shared > copy of log4j rather than just including its own log4j in the .war. > The reason had to do with the classloader, and which log4j.properties > gets loaded for my webapp versus for catalina itself. By sending > another log4j with the webapp and following advice to go back to > RollingFileAppender, I now have things working pretty sensibly. > > About the only real challenge now is dealing with things not yet smart > enough to use log4j. One of those things is jamod (a Modbus protocol > implementation in Java) -- and it's enough of a problem that I'm > rewriting its logging :) > > --Chris > > > On Fri, Jun 12, 2009 at 1:54 PM, Konstantin > Kolinko wrote: > > 2009/6/9 Christopher Piggott : > >> (...) > >> This was not working, so I searched documentation and learned about: > >> > >> ... > >> > >> However, this swallowOutput doesn't seem to work. I tried putting > >> this in several places: > >> (...) > >> > > > > If you are still puzzled with swallowOutput mistery, here is my > experience. > > > > I tried a similar thing once, not with log4j, but with JULI in TC 5.5, > > and also found > > that swallowOutput does not work with logging frameworks. > > > > The reason, as I see it, is the following: > > 1. to implement this functionality, Tomcat creates a custom > > PrintStream (SystemLogHandler) and replaces the default System.out and > > System.err > > > > 2. logging classes start up and are initialized before the above said > happens, > > and at their initialization time they get reference to the original > System.out > > and System.err PrintStreams, bypassing this replacement trick. > > > > > > After some thought my conclusion was that there is too much of a trick > > involved in that swallowOutput thing and I would better seek for > > a solution inside the logging framework itself. > > > > Though I do not have a clear recipe yet. I was not very interested. > > > > > > 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 > >
Installing SSL connector for Tomcat on Linux/Debian
Hello everybody, I'm trying to set up a SSL transport layer, but I'm coming up against some difficulties. Specifically, I followed all the steps requires and specified as in the Tomcat guide - adding some suggestions I found around on several web site for the installation of APR libraries - but still it doesn't work. I'm using Tomcat 6.0.20 with the last version of APR library, on a Lenny/Debian distribution. The output I get in catalina.out is: 18-Aug-2009 18:05:55 org.apache.catalina.startup.SetAllPropertiesRule begin WARNING: [SetAllPropertiesRule]{Server/Service/Connector} Setting property 'clientAuth' to 'false' did not find a matching property. 18-Aug-2009 18:05:55 org.apache.catalina.startup.SetAllPropertiesRule begin WARNING: [SetAllPropertiesRule]{Server/Service/Connector} Setting property 'SSLEngine' to 'on' did not find a matching property. 18-Aug-2009 18:05:55 org.apache.catalina.core.AprLifecycleListener init INFO: Loaded APR based Apache Tomcat Native library 1.1.16. 18-Aug-2009 18:05:55 org.apache.catalina.core.AprLifecycleListener init INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true]. 18-Aug-2009 18:05:55 org.apache.catalina.core.AprLifecycleListener lifecycleEvent INFO: Failed to initialize the SSLEngine. 18-Aug-2009 18:05:55 org.apache.coyote.http11.Http11AprProtocol init INFO: Initializing Coyote HTTP/1.1 on http-8080 18-Aug-2009 18:05:55 org.apache.coyote.http11.Http11AprProtocol init INFO: Initializing Coyote HTTP/1.1 on http-8443 18-Aug-2009 18:05:55 org.apache.coyote.ajp.AjpAprProtocol init INFO: Initializing Coyote AJP/1.3 on ajp-8009 18-Aug-2009 18:05:55 org.apache.catalina.startup.Catalina load INFO: Initialization processed in 656 ms While my server configuration is: Where the certificates where generated with OpenSLL on a Windows Platform. In addition, I included the following lines at the beginning of setclass file CATALINA_OPTS="$CATALINA_OPTS -Djava.library.path=/home/daniele/tomcat-6.0.20/bin/tomcat-native-1.1.16-src/jni/native/.libs" Where the APR libraries are deposed after the installation. Any hints or suggestions? Daniele
Increasing Heap Size and Max Perm Size
Hi all, I'm trying to increase the sizes of the heap and of the max perm by passing the options with the values (in catalina.sh) JAVA_OPTS="$JAVA_OPTS -Xmx=100m -XX:MaxPermSize=350m -Dfile.encoding=UTF-8" but the VM cannot be created and from the catalina.out file I get this printout: Invalid maximum heap size: -Xmx=100m Could not create the Java virtual machine. The Tomcat home page can be accessed (port number 8080), but the home page of my application gives the following error: “localhost” refused the connection. Likely causes of the problem are * the service http-alt isn't started. Try to start it using the Services Configuration Tool in System > Control Centre, or * the port number 8080 is wrong. Any hints/suggestions about this are much appreciated. My OS is Debian Linux. Thanks! Dan
Re: (newbie question) missing classs file?
Are you reloading the pages from the server with the shift key? The pages might be locally cached from your browser. Dan On Tue, Aug 18, 2009 at 7:48 PM, Tena Sakai wrote: > Hi, > > I am new to tomcat and jsp. I appologize in advance my lack of knowledge, > but I would appreciate some poninters. > > I am running tomcat 6.0.14 on redhat linux. > > After reading a few pages of documentation, I tried: > http://localhost:8080/sample > > It rendered what's in $CATALINA_HOME/webapps/sample/index.html, > which included 2 hyperlinks: "JSP page" and "servlet". Both > links worked fine. > > Then I found a file > $CATALINA_HOME/webapps/sample/WEB-INF/classes/mypackage/Hello.class. > I removed this class file and hit the same url as before ( > http://localhost:8080/sample), > and each of the "JSP page" and "servlet", expecting the error from tomcat. > > To my amazement, they both worked. > > Question number 1: Where is the executable class file? > > Then I went on to modify hello.jsp in $CATALINA_HOME/webapps/sample > directory. > I added extra string "Hello!" to what used to be: > <%= new String("Hello!") %> > > Tomcat gave me what I expected: double Hello's. > I thought it might have generated a class file. But there is no class file > anywhere under $CATALINA_HOME/webapps/sample directory? > > Question number 2: Why does this work? > > Thank you in advance. > > Regards, > > Tena Sakai > tsa...@gallo.ucsf.edu >
Re: (newbie question) missing classs file?
Consider also that once the application is loaded is memory, even if you cancel the classes, the application still works. I doubt that the JVM maintains in memory all the classes, all the times, but if your current usage of the heap is not ridiculous big, probably your class remains loaded. Dan On Tue, Aug 18, 2009 at 8:00 PM, Tena Sakai wrote: > Hi Dan, > > > Are you reloading the pages from the server with the shift key? > > The pages might be locally cached from your browser. > > Shift or no shift, it makes no difference. > I told my browser to dump the cache then hit pages again. > No difference. > > I doubt this is a cache issue. If that's the case, why does > it reflect my hack (double "Hello!") and no class file? > > I am confused. > > Tena > > > -Original Message- > From: Daniele Development-ML [mailto:daniele@googlemail.com] > Sent: Tue 8/18/2009 11:51 AM > To: Tomcat Users List > Subject: Re: (newbie question) missing classs file? > > Are you reloading the pages from the server with the shift key? > > The pages might be locally cached from your browser. > > Dan > > On Tue, Aug 18, 2009 at 7:48 PM, Tena Sakai wrote: > > > Hi, > > > > I am new to tomcat and jsp. I appologize in advance my lack of > knowledge, > > but I would appreciate some poninters. > > > > I am running tomcat 6.0.14 on redhat linux. > > > > After reading a few pages of documentation, I tried: > > http://localhost:8080/sample > > > > It rendered what's in $CATALINA_HOME/webapps/sample/index.html, > > which included 2 hyperlinks: "JSP page" and "servlet". Both > > links worked fine. > > > > Then I found a file > > $CATALINA_HOME/webapps/sample/WEB-INF/classes/mypackage/Hello.class. > > I removed this class file and hit the same url as before ( > > http://localhost:8080/sample), > > and each of the "JSP page" and "servlet", expecting the error from > tomcat. > > > > To my amazement, they both worked. > > > > Question number 1: Where is the executable class file? > > > > Then I went on to modify hello.jsp in $CATALINA_HOME/webapps/sample > > directory. > > I added extra string "Hello!" to what used to be: > > <%= new String("Hello!") %> > > > > Tomcat gave me what I expected: double Hello's. > > I thought it might have generated a class file. But there is no class > file > > anywhere under $CATALINA_HOME/webapps/sample directory? > > > > Question number 2: Why does this work? > > > > Thank you in advance. > > > > Regards, > > > > Tena Sakai > > tsa...@gallo.ucsf.edu > > > >
Re: Increasing Heap Size and Max Perm Size
The JVM actually recognises that the value being set/asked for is 100 as when I shut it down, I get a message saying that a JVM with the specified 100m of memory cannot be created. On Tue, Aug 18, 2009 at 11:48 PM, André Warnier wrote: > Daniele Development-ML wrote: > >> Hi all, >> >> I'm trying to increase the sizes of the heap and of the max perm by >> passing >> the options with the values (in catalina.sh) >> >> JAVA_OPTS="$JAVA_OPTS -Xmx=100m -XX:MaxPermSize=350m >> -Dfile.encoding=UTF-8" >> >> Try without the "=" signs ? -Xmx100m > > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > >
Re: Increasing Heap Size and Max Perm Size
Forgot to mention that when I try with the following command: java -Xms512m -Xmx750m it does succeed in creating the JVM - differently (but obviously), if I try: java -Xms512m -Xmx6750m it fails (as expected). I don't understand why I get different behaviour passing this option the JVM when starting Tomcat, and when I give directly to the JVM - I have tried this also with a simple Java main class that instantiates big arrays. Any hit/suggestions are very welcomed. Dan On Wed, Aug 19, 2009 at 11:05 AM, Daniele Development-ML < daniele@googlemail.com> wrote: > The JVM actually recognises that the value being set/asked for is 100 as > when I shut it down, I get a message saying that a JVM with the specified > 100m of memory cannot be created. > > On Tue, Aug 18, 2009 at 11:48 PM, André Warnier wrote: > >> Daniele Development-ML wrote: >> >>> Hi all, >>> >>> I'm trying to increase the sizes of the heap and of the max perm by >>> passing >>> the options with the values (in catalina.sh) >>> >>> JAVA_OPTS="$JAVA_OPTS -Xmx=100m -XX:MaxPermSize=350m >>> -Dfile.encoding=UTF-8" >>> >>> Try without the "=" signs ? -Xmx100m >> >> >> - >> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org >> For additional commands, e-mail: users-h...@tomcat.apache.org >> >> >
Re: Increasing Heap Size and Max Perm Size
Found a solution here: http://www.coderanch.com/t/85725/Tomcat/heap-space-setting-Tomcat-Linux <http://www.coderanch.com/t/85725/Tomcat/heap-space-setting-Tomcat-Linux>Practically, everything works when setting the above options through CATALINA_OPTS variable. 2009/8/19 Markus Schönhaber > Daniele Development-ML: > > > Forgot to mention that when I try with the following command: > > java -Xms512m -Xmx750m > > > > it does succeed in creating the JVM > [...] > > I don't understand why I get different behaviour passing this option the > JVM > > when starting Tomcat, and when I give directly to the JVM > > From your OP: > > JAVA_OPTS="$JAVA_OPTS -Xmx=100m -XX:MaxPermSize=350m > -Dfile.encoding=UTF-8" > > You get different behaviour because you're passing *different* options > to the VM. > Moreover, as you've been told by the VM and André, -Xmx=100m isn't a > valid way to set the VM's maximum heap size. > > And BTW: instead of changing a Tomcat-provided script like catalina.sh > to set your options you should create (or edit) setenv.sh and set the > desired env vars there. > > -- > Regards > mks > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > >
Re: Increasing Heap Size and Max Perm Size
Hey Chuck, I'm sure you are right - and that it was what I was following at the beginning. And the resulting situation was what I describe above: getting a error message in the catalina.out and my application unable to load (404 at the application URL). In addition to this, I got also an explicit (on the console) message reporting this problem when shutting down Tomcat. To understand it better, I ran jconsole locally and I could notice that the heap was not set as indicated in the option. Differently, when using it with the CATALINA_OPTS, things work and also jconsole indicates that the heap size is the one specifies - except that is converted in bytes - but it does match. I don't know why - and I'm not even sure how "good" (style-wise) this approach is - but I'm reporting my experience. If anybody could suggest some motivation or direction for investigation on this, I'm glad to try them. Dan On Wed, Aug 19, 2009 at 2:08 PM, Caldarale, Charles R < chuck.caldar...@unisys.com> wrote: > > From: Daniele Development-ML [mailto:daniele@googlemail.com] > > Subject: Re: Increasing Heap Size and Max Perm Size > > > > Practically, everything works when setting the above options > > through CATALINA_OPTS variable. > > Someone's confused. JAVA_OPTS works fine, but it affects both the startup > and shutdown scripts. CATALINA_OPTS affects only the startup script. The > last posting in the referenced article is incorrect. > > And despite your protestations, having an equals sign in the -Xmx parameter > has never been allowed on a JVM supplied by Sun, and will cause an immediate > JVM initialization failure. > > - 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 > >