vaadin+apache tomcat6 JNDI datasource connection problem/error :(

Hello

Here is my develoment project setup:

  • JDK 1.6
  • tomcat 6
  • postgresql 9
  • vaadin 6.6.3 + some addons from the directory

I would like to use my vaadin app with a tomcat 6 JNDII datasource and randomly ( most annoyingly when my boss wants to test the app ) have misterious "red wheel of death " (see the attached screenshot) and the whole UI is stopped/unresponsive and I can not even restart my app to try again (

There arent any exception in tomcat’s error log, no exception is thrown at least red wheel of death seems to remain there for ever :frowning:

my configuration settings:

  1. context.xml:

<Context docBase="/usr/share/tomcat6-dproject-test" debug="0" reloadable="true">
<Manager pathname="" />
<Resource
    name="jdbc/dproject"
    auth="Container"
    type="javax.sql.DataSource" 
    username="xxxx"
    password="xxxx"
    driverClassName="org.postgresql.Driver"
    url="jdbc:postgresql://host:5432/databese?logUnclosedConnections=true"
    validationQuery="SELECT 1"
     maxActive="-1" 
    removeAbandoned="true"
    logAbandoned="true"    />
</Context>

(Everywhere in my code I get the connection from this datasource)

  1. web.xml

<resource-ref>
    <description>Application datasource</description>
    <res-ref-name>jdbc/dproject</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
 </resource-ref>

3 ) my main application class… ( I am using toolkit productivity tools from the directory…)

@SuppressWarnings("serial")
public class Dproject extends TPTApplication implements FragmentChangedListener, UserChangeListener,
		HttpServletRequestListener {

	
    private final Logger logger = Logger.getLogger(Dproject.class.getName());
	private static final String COOKIENAME_DPROJECT_PASSWORD = "dproject-password";
	private static final String COOKIENAME_DPROJECT_USERNAME = "dproject-username";
	/* GLOBÁLIS VÁLTOZÓK */
	
	
	private Panel  visibleComponentsContainer=new Panel();
	public String viewAs;
	public Translations translations = new Translations();
	private HashMap<String, String> statuses = null;
	private HashMap<String, Resource> resourcesMap = null;
	private ArrayList<Resource> resourcesList = null;
	static DataSource ds = null;
	static {

		Context ctx = null;
		try {
			ctx = (Context) new InitialContext().lookup("java:comp/env");
		}
		catch (NamingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		try {
			Dproject.ds = (DataSource) ctx.lookup("jdbc/dproject");
			System.out.println("APPLICATION DATASOURCE INITIALIZED ");
			
		} 
		catch (NamingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
  1. other relevant parts of my application class

	private void tryToLogIn(String email, String password,boolean rememberMe) {
		
		
		logger.info("LOGIN ATTEMPT\r\nusername: "+email+"\r\npassword: "+password);
		
		
		
		
		
		PreparedStatement pstmt = null;  
		  ResultSet rs = null;
		  Connection connection;
		try {
			connection=Dproject.getDs().getConnection();
			  
			  String pstmtSQL = "SELECT dpc_id,dpc_handle,dpc_name,dpc_loginname, dpc_language, dpc_accesslevel "
						        + "FROM  dpt_resource "
						        + "WHERE dpc_loginname=? "
						        + "AND dpc_password=md5(?)"
						        + "AND dpc_allow_web_access=true";
				
				pstmt = connection.prepareStatement(pstmtSQL);
				pstmt.setString(1, email);
				pstmt.setString(2, password);
				rs = pstmt.executeQuery();
				if (rs.next()) {
					userLoggedIn=true;
					
					logger.info("valid username/password");
					
					
					User user = new User(rs.getString("dpc_handle"), rs.getString("dpc_loginname"), rs.getString("dpc_name"));
					user.setAccesslevel(rs.getInt("dpc_accesslevel"));
					user.setLanguage(rs.getString("dpc_language"));
					logger.info("user created/changed");
					setUser(user);
										
					if (rememberMe) {
									 
						setLoginCookies(email, password);
					}


 
					
					


				}// if vége

				else {
					logger.info("INVALID username/password");
					getMainWindow().showNotification("Sikertelen bejelentkezés",LOGIN_ERROR_MSG, Notification.TYPE_WARNING_MESSAGE);
					
				}
		    rs.close();
		    rs = null;
		    pstmt.close();
		    pstmt = null;
		    
		    if (userLoggedIn && connection!=null) {
				connection.close(); // Return to connection pool
				connection = null; // Make sure we don't close it twice
				System.out.println("connection CLOSED in TRY block");
			}
		    
		    
		  }
		  catch (SQLException e) {
		   e.printStackTrace();
		  }
		 
		  
		  logger.info("END method");
		
	}// trylogin fv vége

  • what is wrong with my configuration and code ?
  • how should I change the datasource configuration or the code to make it work?
  • how can I configure the datasource to throw an exception after some time of red wheel of death to have at least some clue of the problems in the error log?

Thank in advance!
11666.gif

The only clue I have found was in tomcat’s catalina.log


Aug 3, 2011 9:13:24 AM org.apache.catalina.core.StandardContext reload
INFO: Reloading this Context has started
Aug 3, 2011 9:13:26 AM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
SEVERE: The web application 
[/test] registered the JBDC driver [org.postgresql.Driver]
 but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
Aug 3, 2011 9:13:26 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application 
[/test] is still processing a request that has yet to finish. This is very likely to create a memory leak. You can control the time allowed for requests to finish by using the unloadDelay attribute of the standard Context implementation.
Aug 3, 2011 9:13:26 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application 
[/test] is still processing a request that has yet to finish. This is very likely to create a memory leak. You can control the time allowed for requests to finish by using the unloadDelay attribute of the standard Context implementation.
Aug 3, 2011 9:13:26 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application 
[/test] is still processing a request that has yet to finish. This is very likely to create a memory leak. You can control the time allowed for requests to finish by using the unloadDelay attribute of the standard Context implementation.
Aug 3, 2011 9:13:26 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application 
[/test] is still processing a request that has yet to finish. This is very likely to create a memory leak. You can control the time allowed for requests to finish by using the unloadDelay attribute of the standard Context implementation.
Aug 3, 2011 9:13:26 AM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application 
[/test] is still processing a request that has yet to finish. This is very likely to create a memory leak. You can control the time allowed for requests to finish by using the unloadDelay attribute of the standard Context implementation.
Aug 3, 2011 9:13:26 AM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application 
[/test] created a ThreadLocal with key of type [java.lang.ThreadLocal]
 (value [java.lang.ThreadLocal@1cfdfb6a]
) and a value of type [com.digicpictures.dproject.Dproject]
 (value [com.digicpictures.dproject.Dproject@232b9b32]
) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
Aug 3, 2011 9:13:26 AM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application 
[/test] created a ThreadLocal with key of type [java.lang.ThreadLocal]
 (value [java.lang.ThreadLocal@1cfdfb6a]
) and a value of type [com.digicpictures.dproject.Dproject]
 (value [com.digicpictures.dproject.Dproject@732b292b]
) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
Aug 3, 2011 9:13:26 AM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application 
[/test] created a ThreadLocal with key of type [java.lang.ThreadLocal]
 (value [java.lang.ThreadLocal@1cfdfb6a]
) and a value of type [com.digicpictures.dproject.Dproject]
 (value [com.digicpictures.dproject.Dproject@232b9b32]
) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
Aug 3, 2011 9:13:26 AM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application 
[/test] created a ThreadLocal with key of type [java.lang.ThreadLocal]
 (value [java.lang.ThreadLocal@1cfdfb6a]
) and a value of type [com.digicpictures.dproject.Dproject]
 (value [com.digicpictures.dproject.Dproject@28bb1fa1]
) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
Aug 3, 2011 9:13:26 AM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application 
[/test] created a ThreadLocal with key of type [java.lang.ThreadLocal]
 (value [java.lang.ThreadLocal@1cfdfb6a]
) and a value of type [com.digicpictures.dproject.Dproject]
 (value [com.digicpictures.dproject.Dproject@28bb1fa1]
) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
Aug 3, 2011 9:17:13 AM org.apache.catalina.loader.WebappClassLoader loadClass
INFO: Illegal access: this web application instance has been stopped already.  Could not load org.postgresql.util.GT.  The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1531)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:283)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:500)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:374)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:254)
	at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208)
	at org.apache.commons.dbcp.PoolableConnectionFactory.validateConnection(PoolableConnectionFactory.java:658)
	at org.apache.commons.dbcp.PoolableConnectionFactory.validateObject(PoolableConnectionFactory.java:635)
	at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1165)
	at org.apache.commons.dbcp.AbandonedObjectPool.borrowObject(AbandonedObjectPool.java:79)
	at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:106)
	at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
	at com.digicpictures.dproject.Dproject.tryToLogIn(Dproject.java:289)
	at com.digicpictures.dproject.Dproject.access$0(Dproject.java:276)
	at com.digicpictures.dproject.Dproject$1.buttonClick(Dproject.java:232)
	at sun.reflect.GeneratedMethodAccessor735.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:616)
	at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:490)
	at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:164)
	at com.vaadin.ui.AbstractComponent.fireEvent(AbstractComponent.java:1193)
	at com.vaadin.ui.Button.fireClick(Button.java:526)
	at com.vaadin.ui.Button$ClickShortcut.handleAction(Button.java:661)
	at com.vaadin.event.ActionManager.handleAction(ActionManager.java:233)
	at com.vaadin.event.ActionManager.handleAction(ActionManager.java:228)
	at com.vaadin.event.ActionManager.handleActions(ActionManager.java:198)
	at com.vaadin.ui.Panel.changeVariables(Panel.java:356)
	at com.vaadin.ui.Window.changeVariables(Window.java:1084)
	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariableBurst(AbstractCommunicationManager.java:1299)
	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariables(AbstractCommunicationManager.java:1219)
	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.doHandleUidlRequest(AbstractCommunicationManager.java:735)
	at com.vaadin.terminal.gwt.server.CommunicationManager.handleUidlRequest(CommunicationManager.java:296)
	at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:501)
	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.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:563)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	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:298)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
	at java.lang.Thread.run(Thread.java:679)
Aug 3, 2011 9:34:35 AM org.apache.catalina.loader.WebappClassLoader loadClass
INFO: Illegal access: this web application instance has been stopped already.  Could not load com.vaadin.terminal.gwt.server.ChangeVariablesErrorEvent.  The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1531)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleChangeVariablesError(AbstractCommunicationManager.java:1431)
	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariableBurst(AbstractCommunicationManager.java:1312)
	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariables(AbstractCommunicationManager.java:1219)
	at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.doHandleUidlRequest(AbstractCommunicationManager.java:735)
	at com.vaadin.terminal.gwt.server.CommunicationManager.handleUidlRequest(CommunicationManager.java:296)
	at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:501)
	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.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:563)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	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:298)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
	at java.lang.Thread.run(Thread.java:679)
Aug 3, 2011 9:34:35 AM org.apache.catalina.loader.WebappClassLoader loadClass
INFO: Illegal access: this web application instance has been stopped already.  Could not load com.vaadin.terminal.gwt.server.AbstractApplicationServlet$RequestError.  The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
java.lang.IllegalStateException
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1531)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
	at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.handleServiceException(AbstractApplicationServlet.java:992)
	at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:548)
	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.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:563)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	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:298)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
	at java.lang.Thread.run(Thread.java:679)

what can cause this error?

  • error in my vaadin application code
  • a tomcat bug
  • tomcat’s datasource implementation bug?
  • bug/error in postgresql jdbc driver

And what can be the solution?