Problem to log in to the web console

11 views
Skip to first unread message

Adrian Stachowiak

unread,
Feb 27, 2008, 1:29:22 AM2/27/08
to H2 Database
Hello,

my situation looks like this. I have a h2 standalone server running
and a JBoss application server with an application that uses this
database. The connection is defined as a datasource which uses tcp
protocol to connect to the database. Everything works fine. But I'm
not able to log in to the web console when the JBoss application is
running. I get an exception:

General error: java.lang.ClassCastException:
org.h2.server.web.WebThread cannot be cast to java.lang.String
[50000-67] (Pomoc)
org.h2.jdbc.JdbcSQLException: General error:
java.lang.ClassCastException: org.h2.server.web.WebThread cannot be
cast to java.lang.String [50000-67]
at org.h2.message.Message.getSQLException(Message.java:89)
at org.h2.message.Message.convert(Message.java:174)
at org.h2.message.TraceObject.logAndConvert(TraceObject.java:200)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:979)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:946)
at org.h2.Driver.connect(Driver.java:52)
at org.h2.server.web.WebServer.getConnection(WebServer.java:494)
at org.h2.server.web.WebThread.login(WebThread.java:937)
at org.h2.server.web.WebThread.process(WebThread.java:375)
at org.h2.server.web.WebThread.processRequest(WebThread.java:143)
at org.h2.server.web.WebThread.run(WebThread.java:170)
Caused by: java.lang.ClassCastException: org.h2.server.web.WebThread
cannot be cast to java.lang.String
at java.util.Properties.getProperty(libgcj.so.8rh)
at org.h2.engine.ConnectionInfo.getProperty(ConnectionInfo.java:
264)
at org.h2.engine.SessionRemote.initTransfer(SessionRemote.java:80)
at org.h2.engine.SessionRemote.connect(SessionRemote.java:210)
at org.h2.engine.SessionRemote.<init>(SessionRemote.java:158)
at org.h2.engine.SessionRemote.createSession(SessionRemote.java:
153)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:956)
...7 more

It I try not to use tcp in the web console but just a local file path
I got a different exception:

General error: java.lang.ClassCastException:
org.h2.server.web.WebThread$1LoginTask cannot be cast to
java.lang.String [50000-67] (Pomoc)
org.h2.jdbc.JdbcSQLException: General error:
java.lang.ClassCastException: org.h2.server.web.WebThread$1LoginTask
cannot be cast to java.lang.String [50000-67]
at org.h2.message.Message.getSQLException(Message.java:89)
at org.h2.message.Message.convert(Message.java:174)
at org.h2.message.TraceObject.logAndConvert(TraceObject.java:200)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:979)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:946)
at org.h2.Driver.connect(Driver.java:52)
at org.h2.server.web.WebServer.getConnection(WebServer.java:494)
at org.h2.server.web.WebThread$1LoginTask.run(WebThread.java:1030)
at java.lang.Thread.run(libgcj.so.8rh)
Caused by: java.lang.ClassCastException: org.h2.server.web.WebThread
$1LoginTask cannot be cast to java.lang.String
at java.util.Properties.getProperty(libgcj.so.8rh)
at org.h2.engine.ConnectionInfo.getProperty(ConnectionInfo.java:
264)
at org.h2.engine.Engine.getSession(Engine.java:116)
at org.h2.engine.Session.createSession(Session.java:182)
at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:965)
...5 more

On the other hand it works fine when I change the start order. When I
first run h2 database but not start the JBoss AS the I can log in to
the web console without any problem. Then I can start JBoss AS and it
works also fine. And I can use the web console until http session is
valid. When it needs to login again the errors are thrown again. This
all happens with the latest version of h2 database. Do you know what
can be wrong? My settings are pretty much default, I use my database
on a fedora linux machine with Sun JDK 1.6.02.

Best regards,
Adrian Stachowiak

Thomas Mueller

unread,
Feb 27, 2008, 1:17:30 PM2/27/08
to h2-da...@googlegroups.com
Hi,

The problem is here:

Caused by: java.lang.ClassCastException: org.h2.server.web.WebThread
$1LoginTask cannot be cast to java.lang.String
at java.util.Properties.getProperty(libgcj.so.8rh)

It looks like you are using GCJ. Are you aware of that? You wrote you
are using fedora linux machine with Sun JDK 1.6.02... So the problem
is that the GCJ version of getProperty doesn't work like the Sun
implementation. The Sun implementation converts a non-String value to
null, while GCJ tries to cast it to a String. I will solve this
problem in the next release:

ConnectionInfo.java,
public String getProperty(String key) {
Object value = prop.get(key);
if (value == null || !(value instanceof String)) {
return null;
}
return value.toString();
}

Regards,
Thomas

Joshua Paine

unread,
Feb 27, 2008, 2:36:50 PM2/27/08
to h2-da...@googlegroups.com
Thomas Mueller wrote:
> It looks like you are using GCJ. ... I will solve this

> problem in the next release:

GCJ is so unspeakably slow, I wonder if it's worth any effort to support
it? Esp. when Java 1.7 is going open source.

--
Joshua Paine
Chief Tower Builder
LetterBlock Software
http://letterblock.com/

Adrian Stachowiak

unread,
Mar 5, 2008, 4:30:49 PM3/5/08
to H2 Database
Hi,

yes, you're right. My default JVM is a GCJ. My script for JBoss sets
JAVA_HOME to point to the Sun JVM, but my script for H2 currently
doesn't. Thank you for finding the cause of my issue.

Best regards,
Adrian Stachowiak

On 27 Lut, 19:17, "Thomas Mueller" <thomas.tom.muel...@gmail.com>
wrote:
Reply all
Reply to author
Forward
0 new messages