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
my configuration settings:
- 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)
- 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();
}
}
- 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!