Re: Heap size for two container sharing single JVM
Thanks Chuck. These two tomcat containers are running under two different user accounts. I was exploring few things and found jps and jinfo commands, which showed two different processes for each container. Now that output makes more sense to me. -- jM. On Mon, May 24, 2010 at 2:03 PM, Caldarale, Charles R chuck.caldar...@unisys.com wrote: From: Johan Martinez [mailto:jmart...@gmail.com] Subject: Heap size for two container sharing single JVM it will share the same JDK instance. All that means is that the same JDK is used as the process templates for the each JVM instance. Do I need to setup java heap space separately for both containers? Yes, they are completely independent. Make sure you have enough RAM to support the process space requirements for everything you're running on the system. For a single container I am adding heap space (Xmx) option to JAVA_OPTS in catalina.sh script. You should do that in setenv.sh, not catalina.sh; catalina.sh will call setenv.sh if it exists. Do I need to add this option to second container again or set it somewhere else? You need to create or modify the script in the second Tomcat instance. Since it is a JDK option and not tomcat option It's actually a running JVM option, not a JDK option. I am thinking it is a system-wide setting and not specific to each container. You are incorrect. - 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
Re: problems at thejarbar.org
I think you are running into a MySQL database connection timeout. You can use a MySQL admin interface (command line, PHPAdmin, MySQL Workbench, etc.) to verify the idle connection timeout limit. There have been comments on the web concerning this. One such discussion and a solution are here: http://lists.mysql.com/java/6578 The explanation of the parameters given in the above link can be found here: http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-configuration-properties.html Based on those two references, you'll need to modify your Realm database URL: connectionURL=jdbc:mysql://localhost:3306/yucca123_thejarbarautoReconnect=truereconnectAtTxEnd=true Note, I have not tried this, so test before production. The other solution mentioned is to use a DataSource Realm. This requires you to configure a JNDI datasource describing your database connection as well as the DataSource Realm. You can add all of this information in your web application's META-INF/context.xml file if it's application-specific. If this is a host or service-based definition, then you'll have to define the JNDI resources in a GlobalNamingResources element. See the following: http://tomcat.apache.org/tomcat-6.0-doc/config/globalresources.html Note the warning that this resource will not be available to an individual web application unless you use a ResourceLink in your META-INF/context.xml file. See the globalresources link above for an example. Since you're using this connection for container managed authentication and authorization, I'm not sure why your web application would need access to this resource. However, it's 3 am, so I may have missed a few points that Chuck, Charles, or Pid will be happy to correct. To summarize - it seems the easiest fix is to add the following properties to your JDBC url: autoReconnect=true reconnectAtTxEnd=true Add them to the end of the URL, connected with ampersands. I hope this gets you up and running. . . . . . just my two cents /mde/ --- On Sun, 5/30/10, Yucca Nel yucca...@live.co.za wrote: From: Yucca Nel yucca...@live.co.za Subject: Re: problems at thejarbar.org To: Tomcat Users List users@tomcat.apache.org Date: Sunday, May 30, 2010, 9:34 AM Yes, but I am using JDBC and followed the setup step by step from tomcat docs ?xml version=1.0 encoding=UTF-8? Server port=9170 Listener className=org.apache.catalina.mbeans.GlobalResourcesLifecycleListener/ Listener className=org.apache.catalina.core.JasperListener / Listener className=org.apache.catalina.mbeans.ServerLifecycleListener/ GlobalNamingResources Resource auth=Container description=User database name=UserDatabase type=org.apache.catalina.UserDatabase pathname=conf/tomcat-users.xml factory=org.apache.catalina.users.MemoryUserDatabaseFactory/ /GlobalNamingResources Service name=Catalina Connector port=9670 minSpareThreads=1 address=127.0.0.1 maxThreads=50 maxSpareThreads=3 connectionTimeout=3 protocol=AJP/1.3 /Connector Engine defaultHost=thejarbar.org name=Catalina Realm className=org.apache.catalina.realm.UserDatabaseRealm/Realm className=org.apache.catalina.realm.JDBCRealm driverName=com.mysql.jdbc.Driver connectionURL=jdbc:mysql://localhost:3306/yucca123_thejarbar connectionName=yucca123_tom connectionPassword=myPass userTable=users userNameCol=user_name userCredCol=user_pass userRoleTable=user_roles roleNameCol=role_name/Host appBase=/home/yucca123/public_html name=thejarbar.org Aliaswww.thejarbar.org/Alias Context path=/the_jar_bar Listener className=org.apache.catalina.startup.TldConfig/ /Context Context docBase=/usr/local/tomcat/users/yucca123/tomcat/webapps/manager path=/manager privileged=true reloadable=true Listener className=org.apache.catalina.startup.TldConfig/ ResourceEnvRef name=users type=org.apache.catalina.UserDatabase/ /Context Context docBase=the_jar_bar path= reloadable=true Listener className=org.apache.catalina.startup.TldConfig/ /Context /Host /Engine /Service /Server May be missing something... http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html#JDBC%20Data%20Sources This error does not occur every time -- From: Jeff jwi...@cox.net Sent: Sunday, May 30, 2010 5:54 PM To: Tomcat Users List users@tomcat.apache.org Subject: Re: problems at thejarbar.org would this help? http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html#Common%20Problems On 5/30/2010 10:08 AM, Yucca Nel
Re: problems at thejarbar.org
2010/5/31 Mark Eggers its_toas...@yahoo.com: http://lists.mysql.com/java/6578 http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-configuration-properties.html Based on those two references, you'll need to modify your Realm database URL: connectionURL=jdbc:mysql://localhost:3306/yucca123_thejarbarautoReconnect=truereconnectAtTxEnd=true Note, I have not tried this, so test before production. The first parameter has to be preceded with '?', not with an ampersand, and in an XML file the ampersands must be written as 'amp;', so we get (remove the line wrap): connectionURL=jdbc:mysql://localhost:3306/yucca123_thejarbar?autoReconnect=trueamp;reconnectAtTxEnd=true I have not tried the above either, so test it yourself. Best regards, Konstantin Kolinko - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: java.lang.NoClassDefFoundError: Could not initialize class
2010/5/31 Licht Jiang licht.ji...@gmail.com: java.lang.NoClassDefFoundError: Could not initialize class com.myservice.web.TestClass Could not initialize = the class is found, but its initialization failed. There can be many reasons for that, e.g. 1) missing dependent classes, 2) exception is thrown when executing a static{} initialization block in the class. It is hard to tell what exactly went wrong without seeing the actual exception. Show us the full stack trace(s); there are usually at least two in cases like this. Now I have no access to the service. Best regards, Konstantin Kolinko - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Gracefull restart of tomcat
Dear users, I would like to ask you on the some thing which regards to the application deployment and neccessary restart of tomcat5. When I am some servlet which are run under tomcat and I have build up the new jar files for my application is it enought to copy this file to my location without neccessary restart of tomcat? Is there any gracefull restart of tomcat like in apache2? Is there any mechanishm how to update servlets when tomcat is already running so that tomcat 5 will not be restarted and new servlets will be loaded? Thank you in advance -- Best Regards / S pozdravem Petr Hracek
Re: Gracefull restart of tomcat
I am not sure if you had looked into deploy redeploy feature of tomcat. Probably, that is what you are looking for Perry On Mon, May 31, 2010 at 4:10 PM, Petr Hracek phrac...@gmail.com wrote: Dear users, I would like to ask you on the some thing which regards to the application deployment and neccessary restart of tomcat5. When I am some servlet which are run under tomcat and I have build up the new jar files for my application is it enought to copy this file to my location without neccessary restart of tomcat? Is there any gracefull restart of tomcat like in apache2? Is there any mechanishm how to update servlets when tomcat is already running so that tomcat 5 will not be restarted and new servlets will be loaded? Thank you in advance -- Best Regards / S pozdravem Petr Hracek -- Pankaj Tiwari
Logger / Context
Hello, we've been using context + logger for redirecting stdout-logs from different servlets to different folders in tomcat 5.0.*: Context docBase=axis path=/axis reloadable=true swallowOutput=true Logger className=org.apache.catalina.logger.FileLogger directory=logs/axis/ prefix=StdOut_axis_ suffix=.log timestamp=true/ /Context After upgrading to tomcat 6.*, this log redirects does not work anymore. Has anyone a hint or a link to some information how this could be done in Tomcat 6? thanks, stefan - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Logger / Context
On 31/05/2010 11:51, Stefan Rainer wrote: Hello, we've been using context + logger for redirecting stdout-logs from different servlets to different folders in tomcat 5.0.*: Context docBase=axis path=/axis reloadable=true swallowOutput=true Logger className=org.apache.catalina.logger.FileLogger directory=logs/axis/ prefix=StdOut_axis_ suffix=.log timestamp=true/ /Context After upgrading to tomcat 6.*, this log redirects does not work anymore. Has anyone a hint or a link to some information how this could be done in Tomcat 6? Please don't reply to an existing thread and edit the subject/body - this is called thread hi-jacking. Please start a completely new message. p - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org signature.asc Description: OpenPGP digital signature
Re: Gracefull restart of tomcat
On 31/05/2010 11:40, Petr Hracek wrote: Dear users, I would like to ask you on the some thing which regards to the application deployment and neccessary restart of tomcat5. Tomcat 5? That's pretty old, and not supported any more. When I am some servlet which are run under tomcat and I have build up the new jar files for my application is it enought to copy this file to my location without neccessary restart of tomcat? Depends on your configuration. Which you haven't posted. Is there any gracefull restart of tomcat like in apache2? Is there any mechanishm how to update servlets when tomcat is already running so that tomcat 5 will not be restarted and new servlets will be loaded? You can update/replace the war file. This may trigger an application restart, depending on your configuration. The manager application can also be used to update and restart web applications. p signature.asc Description: OpenPGP digital signature
Logger / Context
Hello, we've been using context + logger for redirecting stdout-logs from different servlets to different folders in tomcat 5.0.*: Context docBase=axis path=/axis reloadable=true swallowOutput=true Logger className=org.apache.catalina.logger.FileLogger directory=logs/axis/ prefix=StdOut_axis_ suffix=.log timestamp=true/ /Context After upgrading to tomcat 6.*, this log redirects does not work anymore. Has anyone a hint or a link to some information how this could be done in Tomcat 6? thanks, stefan - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
SQLNestedException: Cannot create PoolableConnectionFactory
I am getting this exception. Everything seems to be fine. hibernate config xml: # ?xml version=1.0 encoding=UTF-8? # !DOCTYPE hibernate-configuration PUBLIC # -//Hibernate/Hibernate Configuration DTD 3.0//EN # http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd; # hibernate-configuration # session-factory # !-- Database data source -- # property name=hibernate.connection.datasourcejava:/comp/env/jdbc/iclose-messenger-broker-ds/property # # !-- MySQL -- # !-- property name=hibernate.dialectorg.hibernate.dialect.MySQLDialect/property-- # !-- MS SQL Server -- # property name=hibernate.dialectorg.hibernate.dialect.SQLServerDialect/property # # !-- Enable Hibernate's automatic session context management -- # property name=hibernate.current_session_context_classthread/property # # !-- Disable the second-level cache -- # property name=hibernate.cache.use_second_level_cachefalse/property # property name=hibernate.cache.provider_classorg.hibernate.cache.NoCacheProvider/property # # !-- Debugging -- # property name=hibernate.show_sqlfalse/property # property name=hibernate.format_sqlfalse/property # # /session-factory # /hibernate-configuration context setting xml: Context path=/iclose-messenger-broker debug=0 !-- MySQL -- !-- Resource name=jdbc/iclose-messenger-broker-ds auth=Container type=javax.sql.DataSource maxActive=100 maxIdle=30 maxWait=1 username=MyUserName password=MyPassword driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/iclose-messenger-broker?autoReconnect=true/ / -- !-- Microsoft SQL Server -- Resource name=jdbc/iclose-messenger-broker-ds auth=Container type=javax.sql.DataSource maxActive=100 maxIdle=30 maxWait=1 username=sa password=sa driverClassName=net.sourceforge.jtds.jdbcx.JtdsDataSource url=jdbc:jtds:sqlserver://192.168.90.245:1433/iclose-messenger-broker;appName=iclose-messenger/ / /Context SQL Server DB Name: iclose-messenger-broker Please suggest me here. Exception details:org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Network error IOException: Connection timed out: connect) at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:855) at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540) at org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:69) at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:84) at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292) at org.parlinkie.msgsvr.core.dao.DaoSession.buildHibernateSession(DaoSession.java:205) at org.parlinkie.msgsvr.core.dao.DaoSession.clinit(DaoSession.java:143) at org.parlinkie.msgsvr.connector.acord.AcordSoapServlet.initProcessing(AcordSoapServlet.java:182) at org.parlinkie.msgsvr.connector.acord.AcordSoapServlet.init(AcordSoapServlet.java:165) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1139) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:966) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3956) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4230) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544) at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:626) 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: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
Re: Logger / Context
On 31 May 2010, at 12:29, Stefan Rainer s.rai...@teamaxess.com wrote: Hello, we've been using context + logger for redirecting stdout-logs from different servlets to different folders in tomcat 5.0.*: Context docBase=axis path=/axis reloadable=true swallowOutput=true Logger className=org.apache.catalina.logger.FileLogger directory=logs/axis/ prefix=StdOut_axis_ suffix=.log timestamp=true/ /Context After upgrading to tomcat 6.*, this log redirects does not work anymore. Has anyone a hint or a link to some information how this could be done in Tomcat 6? Configuration details have changed since 5.0, please read the docs for Context, Host (and DataSource if applicable). The Logger element is no longer used. The AccessLogValve is now used for request logging. You must configure your own logging for in-app logs, e.g. Log4j. p thanks, stefan - 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: SQLNestedException: Cannot create PoolableConnectionFactory
Is this the right forum for your question? It looks like the db isn't running or isn't accessible. If there's a Tomcat problem, please include exact OS, JVM and Tomcat version numbers. p On 31 May 2010, at 12:30, ennidhi psatishb...@hotmail.com wrote: I am getting this exception. Everything seems to be fine. hibernate config xml: # ?xml version=1.0 encoding=UTF-8? # !DOCTYPE hibernate-configuration PUBLIC # -//Hibernate/Hibernate Configuration DTD 3.0//EN # http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd; # hibernate-configuration # session-factory # !-- Database data source -- # property name=hibernate.connection.datasourcejava:/comp/env/jdbc/iclose- messenger-broker-ds/property # # !-- MySQL -- # !-- property name=hibernate.dialectorg.hibernate.dialect.MySQLDialect/ property-- # !-- MS SQL Server -- # property name=hibernate.dialectorg.hibernate.dialect.SQLServerDialect/ property # # !-- Enable Hibernate's automatic session context management -- # property name=hibernate.current_session_context_classthread/property # # !-- Disable the second-level cache -- # property name=hibernate.cache.use_second_level_cachefalse/property # property name= hibernate.cache.provider_class org.hibernate.cache.NoCacheProvider/property # # !-- Debugging -- # property name=hibernate.show_sqlfalse/property # property name=hibernate.format_sqlfalse/property # # /session-factory # /hibernate-configuration context setting xml: Context path=/iclose-messenger-broker debug=0 !-- MySQL -- !-- Resource name=jdbc/iclose-messenger-broker-ds auth=Container type=javax.sql.DataSource maxActive=100 maxIdle=30 maxWait=1 username=MyUserName password=MyPassword driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/iclose-messenger-broker? autoReconnect=true/ / -- !-- Microsoft SQL Server -- Resource name=jdbc/iclose-messenger-broker-ds auth=Container type=javax.sql.DataSource maxActive=100 maxIdle=30 maxWait=1 username=sa password=sa driverClassName=net.sourceforge.jtds.jdbcx.JtdsDataSource url=jdbc:jtds:sqlserver://192.168.90.245:1433/iclose-messenger- broker;appName=iclose-messenger/ / /Context SQL Server DB Name: iclose-messenger-broker Please suggest me here. Exception details:org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Network error IOException: Connection timed out: connect) at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource (BasicDataSource.java:855) at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection (BasicDataSource.java:540) at org.hibernate.connection.DatasourceConnectionProvider.getConnection (DatasourceConnectionProvider.java:69) at org.hibernate.cfg.SettingsFactory.buildSettings (SettingsFactory.java:84) at org.hibernate.cfg.Configuration.buildSettings (Configuration.java:2009) at org.hibernate.cfg.Configuration.buildSessionFactory (Configuration.java:1292) at org.parlinkie.msgsvr.core.dao.DaoSession.buildHibernateSession (DaoSession.java:205) at org.parlinkie.msgsvr.core.dao.DaoSession.clinit (DaoSession.java:143) at org.parlinkie.msgsvr.connector.acord.AcordSoapServlet.initProcessing (AcordSoapServlet.java:182) at org.parlinkie.msgsvr.connector.acord.AcordSoapServlet.init (AcordSoapServlet.java:165) at org.apache.catalina.core.StandardWrapper.loadServlet (StandardWrapper.java:1139) at org.apache.catalina.core.StandardWrapper.load (StandardWrapper.java:966) at org.apache.catalina.core.StandardContext.loadOnStartup (StandardContext.java:3956) at org.apache.catalina.core.StandardContext.start(StandardContext.java: 4230) at org.apache.catalina.core.ContainerBase.addChildInternal (ContainerBase.java:760) at org.apache.catalina.core.ContainerBase.addChild (ContainerBase.java:740) at org.apache.catalina.core.StandardHost.addChild (StandardHost.java:544) at org.apache.catalina.startup.HostConfig.deployDescriptor (HostConfig.java:626) 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: 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
Re: problems at thejarbar.org
Don't use that ... it still throws an error, reconnecting only after the exception is thrown. If using the db pooling in tomcat, it's better to include a validationQuery attribute in the Resource ... / element in your app's context.xml file. If on the other hand you are directly connecting the database on your own then just trap the exception, open a new connection and try again. --David On 5/30/2010 1:53 PM, Yucca Nel wrote: Ok I need to keep connection open to avoid exceeption but have found this is deprecated autoReconnect=true can someone provide up to date strategy for dealing with this? -- From: Jeff jwi...@cox.net Sent: Sunday, May 30, 2010 5:54 PM To: Tomcat Users List users@tomcat.apache.org Subject: Re: problems at thejarbar.org would this help? http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html#Common%20Problems On 5/30/2010 10:08 AM, Yucca Nel wrote: The following is becoming a common and serious problem and I am unable to find a google solution for it... I have never seen sych an error and it does not appear to be common enough to get many google hits but when it happens, no one is able to register at my site... Stck trace: Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet successfully received from the server was 4,290,127 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago. 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 com.mysql.jdbc.Util.handleNewInstance(Util.java:406) at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3052) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2938) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3481) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2109) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2648) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2077) at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2228) at org.apache.catalina.realm.JDBCRealm.getPassword(JDBCRealm.java:550) ... 15 more Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost. at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2497) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2949) ... 23 more ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - Communications link failure The last packet successfully received from the server was 4,299,820 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.apache.catalina.core.ContainerBase.[Catalina].[thejarbar.org].[/].[Faces Servlet]The registration code that leads to error is as follows: Form:!--Created by IntelliJ IDEA.User: ownerDate: 02.mai.2010Time: 14:07:31To change this template use File | Settings | File Templates.--%...@page contentType=text/html language=java %%...@page pageEncoding=UTF-8%%...@taglib uri=http://java.sun.com/jsf/core; prefix=f %%@ taglib prefix=h
Tomcat 4.1.30 failed to startup with 4GB memory
Hi, I am running Tomcat 4.1.30 on Ubuntu Linux 8.04.4 LTS. After moving the application from a 32-bit machine to a 64-bit machine with 4GB memory, suddenly tomcat failed to startup with the following error :- Stopping service Tomcat-Standalone May 29, 2010 4:27:36 PM org.apache.coyote.http11.Http11Protocol destroy INFO: Stoping http11 protocol on 8080 Catalina:type=ThreadPool,name=http8080 Error occurred during initialization of VM java.lang.OutOfMemoryError: unable to create new native thread On the 64-bit machine, I used the following software :- Ubuntu 8.04.4 LTS for amd64 Sun JDK 1.5.22 (amd64) export JAVA_HOME=/opt/jdk1.5.0_22 export PATH=$JAVA_HOME/jre/bin:$JAVA_HOME/bin:$PATH export CLASSPATH=. export CATALINA_OPTS=-Djava.awt.headless=true -d64 -Xss3072m -Xmx3072m -XX:PermSize=256m -XX:MaxPermSize=256m When I reduced the max memory to 1GB, tomcat started without any problem :- export CATALINA_OPTS=-Djava.awt.headless=true -d64 -Xss1024m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=256m When I adjusted the max. memory to 1.5GB, the application failed after running 2 - 3 days with the following error :- === begin of log === Exception in thread HostConfig[damascus] java.lang.OutOfMemoryError: Java heap space at java.nio.CharBuffer.wrap(CharBuffer.java:350) at java.lang.StringCoding$CharsetSE.encode(StringCoding.java:340) at java.lang.StringCoding.encode(StringCoding.java:378) at java.lang.String.getBytes(String.java:812) at java.io.UnixFileSystem.canonicalize0(Native Method) at java.io.UnixFileSystem.canonicalize(UnixFileSystem.java:157) at java.io.File.getCanonicalPath(File.java:531) at org.apache.naming.resources.FileDirContext.file(FileDirContext.java:886) at org.apache.naming.resources.FileDirContext.getAttributes(FileDirContext.java:487) at org.apache.naming.resources.BaseDirContext.getAttributes(BaseDirContext.java:797) at org.apache.naming.resources.ProxyDirContext.revalidate(ProxyDirContext.java:1461) at org.apache.naming.resources.ProxyDirContext.cacheLookup(ProxyDirContext.java:1415) at org.apache.naming.resources.ProxyDirContext.getAttributes(ProxyDirContext.java:839) at org.apache.catalina.startup.HostConfig.checkWebXmlLastModified(HostConfig.java:599) at org.apache.catalina.startup.HostConfig.run(HostConfig.java:854) at java.lang.Thread.run(Thread.java:595) Exception in thread StandardManager[/examples] java.lang.OutOfMemoryError: Java heap space at java.util.HashMap.newValueIterator(HashMap.java:892) at java.util.HashMap$Values.iterator(HashMap.java:955) at java.util.AbstractCollection.toArray(AbstractCollection.java:173) at org.apache.catalina.session.ManagerBase.findSessions(ManagerBase.java:664) at org.apache.catalina.session.StandardManager.processExpires(StandardManager.java:779) at org.apache.catalina.session.StandardManager.run(StandardManager.java:870) at java.lang.Thread.run(Thread.java:595) Exception in thread Thread-38 java.lang.OutOfMemoryError: Java heap space Exception in thread StandardManager[/webdav] java.lang.OutOfMemoryError: Java heap space === end of log === Is there any known problem of Tomcat 4.1.30 working with 64-bit OS with 4GB memory? Do I need to migrate the application to Tomcat 5.x. I hope someone could advise what went wrong and how to make Tomcat 4.1.30 could utilize the 4GB memory on a 64-bit machine. Thanks a lot. John Mok - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: problems at thejarbar.org
Many thanks for hepful responses my delay I reply is due to internet in afica -- From: Mark Eggers its_toas...@yahoo.com Sent: Monday, May 31, 2010 11:57 AM To: Tomcat Users List users@tomcat.apache.org Subject: Re: problems at thejarbar.org I think you are running into a MySQL database connection timeout. You can use a MySQL admin interface (command line, PHPAdmin, MySQL Workbench, etc.) to verify the idle connection timeout limit. There have been comments on the web concerning this. One such discussion and a solution are here: http://lists.mysql.com/java/6578 The explanation of the parameters given in the above link can be found here: http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-configuration-properties.html Based on those two references, you'll need to modify your Realm database URL: connectionURL=jdbc:mysql://localhost:3306/yucca123_thejarbarautoReconnect=truereconnectAtTxEnd=true Note, I have not tried this, so test before production. The other solution mentioned is to use a DataSource Realm. This requires you to configure a JNDI datasource describing your database connection as well as the DataSource Realm. You can add all of this information in your web application's META-INF/context.xml file if it's application-specific. If this is a host or service-based definition, then you'll have to define the JNDI resources in a GlobalNamingResources element. See the following: http://tomcat.apache.org/tomcat-6.0-doc/config/globalresources.html Note the warning that this resource will not be available to an individual web application unless you use a ResourceLink in your META-INF/context.xml file. See the globalresources link above for an example. Since you're using this connection for container managed authentication and authorization, I'm not sure why your web application would need access to this resource. However, it's 3 am, so I may have missed a few points that Chuck, Charles, or Pid will be happy to correct. To summarize - it seems the easiest fix is to add the following properties to your JDBC url: autoReconnect=true reconnectAtTxEnd=true Add them to the end of the URL, connected with ampersands. I hope this gets you up and running. . . . . . just my two cents /mde/ --- On Sun, 5/30/10, Yucca Nel yucca...@live.co.za wrote: From: Yucca Nel yucca...@live.co.za Subject: Re: problems at thejarbar.org To: Tomcat Users List users@tomcat.apache.org Date: Sunday, May 30, 2010, 9:34 AM Yes, but I am using JDBC and followed the setup step by step from tomcat docs ?xml version=1.0 encoding=UTF-8? Server port=9170 Listener className=org.apache.catalina.mbeans.GlobalResourcesLifecycleListener/ Listener className=org.apache.catalina.core.JasperListener / Listener className=org.apache.catalina.mbeans.ServerLifecycleListener/ GlobalNamingResources Resource auth=Container description=User database name=UserDatabase type=org.apache.catalina.UserDatabase pathname=conf/tomcat-users.xml factory=org.apache.catalina.users.MemoryUserDatabaseFactory/ /GlobalNamingResources Service name=Catalina Connector port=9670 minSpareThreads=1 address=127.0.0.1 maxThreads=50 maxSpareThreads=3 connectionTimeout=3 protocol=AJP/1.3 /Connector Engine defaultHost=thejarbar.org name=Catalina Realm className=org.apache.catalina.realm.UserDatabaseRealm/Realm className=org.apache.catalina.realm.JDBCRealm driverName=com.mysql.jdbc.Driver connectionURL=jdbc:mysql://localhost:3306/yucca123_thejarbar connectionName=yucca123_tom connectionPassword=myPass userTable=users userNameCol=user_name userCredCol=user_pass userRoleTable=user_roles roleNameCol=role_name/Host appBase=/home/yucca123/public_html name=thejarbar.org Aliaswww.thejarbar.org/Alias Context path=/the_jar_bar Listener className=org.apache.catalina.startup.TldConfig/ /Context Context docBase=/usr/local/tomcat/users/yucca123/tomcat/webapps/manager path=/manager privileged=true reloadable=true Listener className=org.apache.catalina.startup.TldConfig/ ResourceEnvRef name=users type=org.apache.catalina.UserDatabase/ /Context Context docBase=the_jar_bar path= reloadable=true Listener className=org.apache.catalina.startup.TldConfig/ /Context /Host /Engine /Service /Server May be missing something... http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html#JDBC%20Data%20Sources This error does not occur every time -- From: Jeff jwi...@cox.net Sent: Sunday, May 30, 2010 5:54 PM To: Tomcat Users List users@tomcat.apache.org Subject: Re: problems at thejarbar.org would this help?
Re: Tomcat 4.1.30 failed to startup with 4GB memory
Op maandag, 31 mei 2010 17:40 schreef John Mok j...@attglobal.net: Hi, I am running Tomcat 4.1.30 on Ubuntu Linux 8.04.4 LTS. After moving the application from a 32-bit machine to a 64-bit machine with 4GB memory, suddenly tomcat failed to startup with the following error :- Stopping service Tomcat-Standalone May 29, 2010 4:27:36 PM org.apache.coyote.http11.Http11Protocol destroy INFO: Stoping http11 protocol on 8080 Catalina:type=ThreadPool,name=http8080 Error occurred during initialization of VM java.lang.OutOfMemoryError: unable to create new native thread On the 64-bit machine, I used the following software :- Ubuntu 8.04.4 LTS for amd64 Sun JDK 1.5.22 (amd64) export JAVA_HOME=/opt/jdk1.5.0_22 export PATH=$JAVA_HOME/jre/bin:$JAVA_HOME/bin:$PATH export CLASSPATH=. export CATALINA_OPTS=-Djava.awt.headless=true -d64 -Xss3072m -Xmx3072m -XX:PermSize=256m -XX:MaxPermSize=256m When I reduced the max memory to 1GB, tomcat started without any problem :- export CATALINA_OPTS=-Djava.awt.headless=true -d64 -Xss1024m -Xmx1024m -XX:PermSize=256m -XX:MaxPermSize=256m Don't you really want -Xms in stead of -Xss? Setting the stack size to 3 GB is quite unusual. Every thread gets a stack of this size, so 10 threads already need 30 GB of memory. # java -X -Xmssizeset initial Java heap size -Xmxsizeset maximum Java heap size -Xsssizeset java thread stack size Ronald.
Re: tomcat clustering
On 31/05/2010 06:37, John Smith wrote: deployed my war file deployDir=/usr/local/tomcat/webapps after restarting the tomcat my war file is not exploded and in log i am getting SEVERE: FarmWarDeployer can only work as host cluster subelement! This means that your top-level Cluster .../ element is is nested inside an Engine .../ element. The FarmWarDeployer only works if the top-level Cluster .../ element is is nested inside an Host.../ element. I checked Deployer className=org.apache.catalina.ha.deploy.FarmWarDeployer on tomcat site http://tomcat.apache.org/tomcat-6.0-doc/config/cluster-deployer.html This goober is currently pretty broken, but we are working hard to fix it It is no longer broken (I fixed it in 6.0.20) but the docs still haven't been written. Going from memory: 1. Move your Cluster .../ element from Engine.../ to Host.../ 2. The watchDir is where you put WAR files you want copied to the cluster (should be outside the host's appBase) 3. The tempDir gets used to write WARs as they are received from the cluster. 4. The deplorDir is where apps get deployed from. If I recall correctly, this should not be the webapps directory although it may work if autoDeploy is disabled. Mark search on google but couldn't find required info. My question, is where I can deploy my war file so that all three nodes can see and work in cluster. Any help will be appreciated Regards John - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: EL 2.2 in Tomcat 7 RC1/RC2 does not fully support method invocation, such as #{helloWorldController.doSomething(helloWorldModel)}
On 26/05/2010 01:22, Mark Thomas wrote: On 25/05/2010 20:35, John Wu wrote: Same failure observed on Tomcat 7 RC1 and RC2. I can now reproduce this. The fix is next on my todo list. Note I echo Konstantin's comments about trying to get EL 2.2 working in Tomcat 6. If it works, great - but it will be by luck rather than design. If it doesn't, it isn't going to get fixed. Tomact 6 supports EL 2.1. EL 2.2 support requires Tomcat 7. I have fixed in this in trunk. The old implementation used getType() to determine the types for each of the parameters. This ultimately called: org.apache.myfaces.el.unified.resolver.ScopedAttributeResolver.getType() which is hard-coded to return java.lang.Object for all input. This triggered the problem since the EL could not find a doSomething(java.lang.Object) method. While this behaviour does seem a little odd at first glance, I think it is correct since the JavaDoc says for getType(ELContext, Object, Object): quote For a given base and property, attempts to identify the most general type that is acceptable for an object to be passed as the value parameter in a future call to the setValue(ELContext, Object, Object, Object)66 method. /quote In this case, scoped attributes can be of any class so returning Object is correct. I have modified Tomcat to derive the type directly from the value which will always return the actual type. This fixes the provided test case which now works as expected with Tomact 7 trunk. Thanks for the test case. It made getting to the bottom of this a lot easier. Mark - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
slow servlet filter for ByteArrayOutputStream response Wrapper
Hi , I have written a filter that strips the response of some html tags. The filter is working and executing around 30milliseconds. The problem is that the request takes around 30 seconds to load this in a browser. The filter gets executed fast but the status bar in the browser does not complete and the page gets struck to about 25 seconds before the response comes and gets rendered. Apache 6.0.26, windows 7 OS, jdk 1.5 here is the filter code public class InterimFilter implements Filter { public final static String NAV_START = !--START Nav--; public final static String NAV_END = !--END Nav--; public final static String NAV_START_HIDE = !--hide; public final static String NAV_END_HIDE = hide--; public final static double millsToSecConvertFactor = 0.001; private FilterConfig filterConfig; public void init( FilterConfig config ) throws ServletException { System.out.println( ((- Initialised Interim Filter -)) ); } public void destroy() { filterConfig = null; } public void doFilter( ServletRequest request, ServletResponse response, FilterChain chain ) throws IOException, ServletException { HttpServletResponse httpRes = (HttpServletResponse)response; //PrintWriter out = httpRes.getWriter(); GenericResponseWrapper wrapp = new GenericResponseWrapper( httpRes); long startTime = System.currentTimeMillis(); chain.doFilter(request, wrapp); long endTime = System.currentTimeMillis(); byte[] c = wrapp.getResponseBytes(); String content = new String(c); //actual filter work //from start to end of contents. int i = content.indexOf( NAV_START ); int j = content.indexOf( NAV_END ); if( ( i =0 ) ( j i ) ) { String nav = content.substring( i, j + NAV_END.length() ); StringBuffer buffer = new StringBuffer(); for( int k = nav.indexOf( NAV_START_HIDE ), l = nav.indexOf( NAV_END_HIDE ) + NAV_END_HIDE.length(), m = 0; ( k =0 ) ( l k ); ) { buffer.append( nav.substring( m, k ) ); m = l; k = nav.indexOf( NAV_START_HIDE, l ); //new if (k == -1) { buffer.append( nav.substring(l, nav.indexOf(NAV_END))); break; } //end new l = nav.indexOf( NAV_END_HIDE, k ) + NAV_END_HIDE.length(); } nav= buffer.toString(); buffer = new StringBuffer(); buffer.append( content.substring( 0, i ) ); buffer.append( nav ); buffer.append( content.substring( j ) ); content = buffer.toString(); buffer = null; nav = null; } //PrintWriter out = httpRes.getWriter(); PrintWriter out = wrapp.getWriter(); httpRes.setContentLength(content.toString().length()); httpRes.setContentType( text/html; charset=UTF-8 ) ; out.write(content); out.flush(); out.close(); } public FilterConfig getFilterConfig() { return this.filterConfig; } public void setFilterConfig (FilterConfig filterConfig) { this.filterConfig = filterConfig; } public class GenericResponseWrapper extends HttpServletResponseWrapper { private PrintWriter writer; private ServletOutputStream outputStream; private ByteArrayOutputStream buffer; public GenericResponseWrapper(HttpServletResponse response) { super(response); buffer = new ByteArrayOutputStream(); } public byte[] getResponseBytes() { flushBuffer(); return buffer.toByteArray(); } public void flushBuffer() { if (outputStream != null) { try { outputStream.flush(); } catch (IOException e) { e.printStackTrace(); } } if (writer != null) { writer.flush(); } } public ServletOutputStream getOutputStream() { if (outputStream == null) { outputStream = new FilterServletOutputStream(buffer); } return
Re: slow servlet filter for ByteArrayOutputStream response Wrapper
2010/6/1 Manny Mondeo manny...@yahoo.com: Hi , I have written a filter that strips the response of some html tags. The filter is working and executing around 30milliseconds. How do you measure the time? The problem is that the request takes around 30 seconds to load this in a browser. The filter gets executed fast but the status bar in the browser does not complete and the page gets struck to about 25 seconds before the response comes and gets rendered. Maybe it loads images, loads and executes javascript, or maybe your HTML is invalid. Maybe you have a firewall that scans your traffic for malware. Have you tried it with a different browser? String content = new String(c); The above line is wrong. Use some explicit encoding. StringBuffer buffer = new StringBuffer(); java.lang.StringBuilder may be a bit faster (though it is unlikely that you will notice). //PrintWriter out = httpRes.getWriter(); PrintWriter out = wrapp.getWriter(); Why wrapp.getWriter(); ?? httpRes.setContentLength(content.toString().length()); httpRes.setContentType( text/html; charset=UTF-8 ) ; You cannot set charset when you already called getWriter(). Move the above line higher in the code. public PrintWriter getWriter() { if (writer == null) { try { writer = new PrintWriter(new OutputStreamWriter(outputStream, this.getCharacterEncoding())); The above will throw an exception if outputStream is null. Best regards, Konstantin Kolinko - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org