[
https://issues.apache.org/jira/browse/TOMEE-171?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13404223#comment-13404223
]
Henk de Boer commented on TOMEE-171:
------------------------------------
You're welcome!
My test was rather simple in scope: creating users, listing them, trying to
create users with an id that already exists (to trigger DB exception). All
seemed to work perfectly.
There is one small thing though, but it's maybe a separate issue. When I
shutdown TomEE, I get the following exception:
06-29 23:05:55 database: close
org.h2.message.DbException: General error: "java.lang.NoClassDefFoundError:
org/h2/index/PageBtreeCursor"; SQL statement:
SELECT ID FROM INFORMATION_SCHEMA.LOBS WHERE TABLE = ? [50000-161]
at org.h2.message.DbException.convert(DbException.java:269)
at org.h2.store.LobStorage.removeAllForTable(LobStorage.java:158)
at org.h2.engine.Database.close(Database.java:1080)
at org.h2.engine.DatabaseCloser.run(DatabaseCloser.java:80)
Caused by: org.h2.jdbc.JdbcSQLException: General error:
"java.lang.NoClassDefFoundError: org/h2/index/PageBtreeCursor"; SQL statement:
SELECT ID FROM INFORMATION_SCHEMA.LOBS WHERE TABLE = ? [50000-161]
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:189)
at
org.h2.jdbc.JdbcPreparedStatement.executeQuery(JdbcPreparedStatement.java:96)
at org.h2.store.LobStorage.removeAllForTable(LobStorage.java:152)
... 2 more
Caused by: java.lang.NoClassDefFoundError: org/h2/index/PageBtreeCursor
at org.h2.index.PageBtreeIndex.find(PageBtreeIndex.java:186)
at org.h2.index.PageBtreeIndex.find(PageBtreeIndex.java:178)
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:321)
at org.h2.command.dml.Select.queryFlat(Select.java:512)
at org.h2.command.dml.Select.queryWithoutCache(Select.java:617)
at org.h2.command.dml.Query.query(Query.java:298)
at org.h2.command.dml.Query.query(Query.java:268)
at org.h2.command.dml.Query.query(Query.java:37)
at org.h2.command.CommandContainer.query(CommandContainer.java:82)
at org.h2.command.Command.executeQuery(Command.java:185)
... 4 more
Caused by: java.lang.ClassNotFoundException: org.h2.index.PageBtreeCursor
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1711)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
... 16 more
06-29 23:05:55 database: close
java.lang.NoClassDefFoundError: org/h2/store/PageStreamTrunk$Iterator
at org.h2.store.PageLog.free(PageLog.java:208)
at org.h2.store.PageStore.compact(PageStore.java:468)
at org.h2.engine.Database.closeOpenFilesAndUnlock(Database.java:1169)
at org.h2.engine.Database.close(Database.java:1119)
at org.h2.engine.DatabaseCloser.run(DatabaseCloser.java:80)
Caused by: java.lang.ClassNotFoundException:
org.h2.store.PageStreamTrunk$Iterator
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1711)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1556)
... 5 more
My guess is that the war is unloaded before this hook of the H2 DB comes into
effect, so there's probably nothing TomEE can do about this. But just wanted to
let you know, just in case.
> TomEE automatically directs embedded (@DataSourceDefinition) h2 datasource to
> hsqldb
> ------------------------------------------------------------------------------------
>
> Key: TOMEE-171
> URL: https://issues.apache.org/jira/browse/TOMEE-171
> Project: TomEE
> Issue Type: Bug
> Affects Versions: 1.0.0-beta-2
> Environment: Mac OS X 10.6.8, JDK6u31, h2 1.3.161
> Reporter: Henk de Boer
> Fix For: 1.1.0
>
> Attachments: crudh2_eclipseproject.zip
>
>
> When trying to run an example CRUD application for Java EE 6 (see
> http://henk53.wordpress.com/2012/04/15/jsf2-primefaces3-ejb3-jpa2-integration-project)
> on TomEE beta 2, I noticed that the logs and data for the embedded h2
> datasource end up as hsqldb equivalents in [TOMEE HOME]/data/hsqldb/.
> The datasource definition in web.xml is as follows:
> {code:xml}
> <data-source>
> <name>java:app/MyApp/myDS</name>
> <class-name>org.h2.jdbcx.JdbcDataSource</class-name>
> <url>jdbc:h2:~/mydb;DB_CLOSE_DELAY=-1</url>
> <user>sa</user>
> <password>sa</password>
> <transactional>true</transactional>
> <isolation-level>TRANSACTION_READ_COMMITTED</isolation-level>
> <initial-pool-size>2</initial-pool-size>
> <max-pool-size>10</max-pool-size>
> <min-pool-size>5</min-pool-size>
> <max-statements>0</max-statements>
> </data-source>
> {code}
> So clearly it should be using h2, and the DB should be created in my home as
> {{mydb}}. When I remove the h2 implementation jar from WEB-INF/lib, TomEE
> does complain, so it does try to do something with h2 for sure. Inspecting
> the log reveals it really are hsqldb log lines and not h2.
> What's happening here? Why is TomEE silently swapping one DB for the other?
>
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira