So I have follow up, I'm having the same issue except it doesn't seem it 
has anything to do with the using 2 different versions of the H2 jar.

I tried connecting to a database that ran fine but recently stopped 
working. Its again a NoClassDefFoundError and I have no idea how to fix it, 
tried many things but I keep getting the same issue:

org.h2.jdbc.JdbcSQLException: General error: 
"java.lang.NoClassDefFoundError: org/h2/engine/Constants"; SQL statement:
SELECT UPPER(VALUE) FROM INFORMATION_SCHEMA.SETTINGS WHERE NAME='MODE' 
[50000-171] 

I checked my environment variables and found no CLASSPATH but am still able 
to run other Java applications, so I don't know how I can rectify the issue 
if its due to the classpath.

The super weird thing is i've tried moving the database to a different 
location and connect to it there to see if that would make any difference 
and found that I was able to connect with no issues. I cut and past the 
database to a different location and try and access it there its fine but 
if I cut and paste it back to its original "corrupted" location it gives me 
the exception only after I connect (I tried using the Test Connection 
button and always get "Test successful") 

This leaves me puzzled, how can there be an issue with connecting with a 
database at one specific location, but any other location is fine. I have 
no idea where to start looking to fix this issue.

Thanks again!

On Friday, May 24, 2013 12:10:07 PM UTC-4, Sammy Guergachi wrote:
>
> Thanks, it seems I was using 171 jar to view a db created with 169.
>
> I got v169 to open the db and it seems to be fine.
>
> Thanks!
>
> On Friday, May 24, 2013 11:25:18 AM UTC-4, Thomas Mueller wrote:
>>
>> Hi,
>>
>> The error message "Caused by: java.lang.NoClassDefFoundError: 
>> org/h2/engine/Constants " doesn't say much about the state of the database 
>> file. All it says is that you have a classloading problem. For example you 
>> have multiple version of the H2 jar file in your classpath (at least H2 
>> version 1.3.169 from 2012-09-09, but possibly another one as well).
>>
>> Regards,
>> Thomas
>>
>>
>> On Fri, May 24, 2013 at 5:21 PM, Sammy Guergachi <[email protected]>wrote:
>>
>>> So we have a database hosted on a networked drive.
>>>
>>> One day I tried to connect to H2 and got this error via the browser tool:
>>>
>>> General error: "java.lang.NoClassDefFoundError: 
>>> org/h2/engine/Constants"; SQL statement:
>>> SELECT UPPER(VALUE) FROM INFORMATION_SCHEMA.SETTINGS WHERE NAME='MODE' 
>>> [50000-171]<http://192.168.30.113:8082/tables.do?jsessionid=dc43494160387c9488a2572beb0e0753#>
>>>  HY000/50000
>>> org.h2.jdbc.JdbcSQLException: General error: 
>>> "java.lang.NoClassDefFoundError: org/h2/engine/Constants"; SQL statement:
>>> SELECT UPPER(VALUE) FROM INFORMATION_SCHEMA.SETTINGS WHERE NAME='MODE' 
>>> [50000-169] 
>>>     at 
>>> org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
>>>     at org.h2.message.DbException.get(DbException.java:158)
>>>     at org.h2.message.DbException.convert(DbException.java:277)
>>>     at org.h2.command.Command.executeQuery(Command.java:195)
>>>     at org.h2.server.TcpServerThread.process(TcpServerThread.java:308)
>>>     at org.h2.server.TcpServerThread.run(TcpServerThread.java:149)
>>>     at java.lang.Thread.run(Unknown Source) 
>>> Caused by: java.lang.NoClassDefFoundError: org/h2/engine/Constants 
>>>     at org.h2.table.MetaTable.generateRows(MetaTable.java:859)
>>>     at org.h2.index.MetaIndex.find(MetaIndex.java:45)
>>>     at org.h2.index.BaseIndex.find(BaseIndex.java:102)
>>>     at org.h2.index.IndexCursor.find(IndexCursor.java:145)
>>>     at org.h2.table.TableFilter.next(TableFilter.java:322)
>>>     at org.h2.command.dml.Select.queryFlat(Select.java:513)
>>>     at org.h2.command.dml.Select.queryWithoutCache(Select.java:618)
>>>     at org.h2.command.dml.Query.query(Query.java:307)
>>>     at org.h2.command.dml.Query.query(Query.java:277)
>>>     at org.h2.command.dml.Query.query(Query.java:36)
>>>     at org.h2.command.CommandContainer.query(CommandContainer.java:86)
>>>     at org.h2.command.Command.executeQuery(Command.java:191)
>>>     ... 3 more 
>>>
>>>     at org.h2.engine.SessionRemote.done(SessionRemote.java:568)
>>>     at org.h2.command.CommandRemote.executeQuery(CommandRemote.java:149)
>>>     at org.h2.jdbc.JdbcStatement.executeQuery(JdbcStatement.java:76)
>>>     at org.h2.server.web.DbContents.readContents(DbContents.java:111)
>>>     at org.h2.server.web.WebApp.tables(WebApp.java:662)
>>>     at org.h2.server.web.WebApp.process(WebApp.java:219)
>>>     at org.h2.server.web.WebApp.processRequest(WebApp.java:164)
>>>     at org.h2.server.web.WebThread.process(WebThread.java:137)
>>>     at org.h2.server.web.WebThread.run(WebThread.java:93)
>>>     at java.lang.Thread.run(Unknown Source) 
>>>
>>> I'm pretty new to using H2, and havent been able to find this sort of 
>>> error anywhere online, so any help as to what the issue might be would be 
>>> great.
>>> We can't access any of the tables in the database, so it seems 
>>> corrupted, We have a backup but we would like to make sure this sort of 
>>> corruption doesn't occur again.
>>>
>>> Thanks!
>>>  
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "H2 Database" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at http://groups.google.com/group/h2-database?hl=en.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>  
>>>  
>>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to