[Persistence, JBoss/CMP, Hibernate, Database] - Problem with persistance using JBossAS 5.0.4 & MySQL5
by dobbo
I installed JbossAS using the JEMS installer (on my Linux box - no poblem) Selected for EJB3 and default.
Downloaded the jboss-seam-1.2.0-PATCH1 tarball and compiled and ran the seam-booking example. No problem.
Change the JBossAS configuration to remove HSQLDS and replace it with a MySQL5 database interface so it would be production ready. Made minimal modifications to seam-booking for the new MySQL set up and that works just fine. No errors seams useable (pardon the pun :-).
Started work on my project using the seam-booking configuration as my starting point. the JSP/Seam works just fine. Used the Register, RegisterAction and User classes from seam-booking as the starting point for my own login/security model. My problem is that the user table is not created in my MySQL database unlike the seam-booking example.
I get the following error:
ERROR [URLDeploymentScanner] Incomplete Deployment listing:
|
| --- MBeans waiting for other MBeans ---
| ObjectName: jboss.j2ee:ear=league.ear,jar=league.jar,name=RegisterAction,service=EJB3
| State: NOTYETINSTALLED
| I Depend On:
| persistence.units:unitName=leagueDS
|
| --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
| ObjectName: persistence.units:unitName=leagueDS
| State: NOTYETINSTALLED
| Depends On Me:
| jboss.j2ee:ear=league.ear,jar=league.jar,name=RegisterAction,service=EJB3
|
Obviously I've made a small conf error in my project, but I can't see it for looking. This is a difference between the seam-booking EAR config and myown:
diff -u -r resources/META-INF/application.xml /home/steve/jLeague/config/ear/application.xml
| --- resources/META-INF/application.xml 2007-03-05 07:31:39.647850553 +0000
| +++ /home/steve/jLeague/config/ear/application.xml 2007-03-05 09:52:02.766262553 +0000
| @@ -4,25 +4,23 @@
| xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd"
| version="5">
|
| - <display-name>Seam Booking</display-name>
| + <display-name>Leagues</display-name>
|
| <module>
| <web>
| - <web-uri>jboss-seam-booking.war</web-uri>
| - <context-root>/league</context-root>
| + <web-uri>league.war</web-uri>
| + <context-root>/</context-root>
| </web>
| </module>
|
| <module>
| - <ejb>jboss-seam-booking.jar</ejb>
| + <ejb>league.jar</ejb>
| </module>
|
| <module>
| <java>jboss-seam.jar</java>
| </module>
|
| - <!-- Remove these lines for JSF 1.2 -->
| -
| <module>
| <java>el-api.jar</java>
| </module>
| Only in /home/steve/jLeague/config/ear/: CVS
| diff -u -r resources/META-INF/jboss-app.xml /home/steve/jLeague/config/ear/jboss-app.xml
| --- resources/META-INF/jboss-app.xml 2007-03-05 07:31:20.766670553 +0000
| +++ /home/steve/jLeague/config/ear/jboss-app.xml 2007-03-05 06:33:56.575422053 +0000
| @@ -1,5 +1,5 @@
| <jboss-app>
| - <loader-repository>
| - seam.jboss.org:loader=league
| - </loader-repository>
| + <loader-repository>
| + seam.jboss.org:loader=league
| + </loader-repository>
| </jboss-app>
| diff -u -r resources/META-INF/jboss-beans.xml /home/steve/jLeague/config/ear/jboss-beans.xml
| --- resources/META-INF/jboss-beans.xml 2007-03-03 09:04:41.418257510 +0000
| +++ /home/steve/jLeague/config/ear/jboss-beans.xml 2007-03-06 00:40:30.173767303 +0000
| @@ -4,11 +4,12 @@
| xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
| xmlns="urn:jboss:bean-deployer">
|
| - <bean name="bookingDatasourceBootstrap" class="org.jboss.resource.adapter.jdbc.local.LocalTxDataSource">
| + <bean name="leagueDSBootstrap" class="org.jboss.resource.adapter.jdbc.local.LocalTxDataSource">
| <property name="driverClass">org.mysql.jdbc.Driver</property>
| - <property name="connectionURL">jdbc:hsqldb:.</property>
| - <property name="userName">sa</property>
| - <property name="jndiName">java:/bookingDatasource</property>
| + <property name="connectionURL">jdbc:mysql://localhost:3306/league</property>
| + <property name="userName">league</property>
| + <property name="password">NOTSAYING</property>
| + <property name="jndiName">java:/leagueDS</property>
| <property name="minSize">0</property>
| <property name="maxSize">10</property>
| <property name="blockingTimeout">1000</property>
| @@ -18,9 +19,9 @@
| <property name="initialContextProperties"><inject bean="InitialContextProperties"/></property>
| </bean>
|
| - <bean name="bookingDatasource" class="java.lang.Object">
| + <bean name="leagueDS" class="java.lang.Object">
| <constructor factoryMethod="getDatasource">
| - <factory bean="bookingDatasourceBootstrap"/>
| + <factory bean="leagueDSBootstrap"/>
| </constructor>
| </bean>
|
| diff -u -r resources/META-INF/persistence.xml /home/steve/jLeague/config/ear/persistence.xml
| --- resources/META-INF/persistence.xml 2007-03-05 07:28:52.697416803 +0000
| +++ /home/steve/jLeague/config/ear/persistence.xml 2007-03-06 00:56:16.688920803 +0000
| @@ -3,15 +3,13 @@
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
| version="1.0">
| - <persistence-unit name="bookingDatabase">
| - <provider>org.hibernate.ejb.HibernatePersistence</provider>
| - <jta-data-source>java:/leagueDS</jta-data-source>
| - <properties>
| - <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
| - <!-- property name="hibernate.show_sql" value="true"/ -->
| - <!-- These are the default for JBoss EJB3, but not for HEM: -->
| - <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
| - <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
| - </properties>
| - </persistence-unit>
| +
| + <persistence-unit name="test">
| + <jta-data-source>java:/leagueDS</jta-data-source>
| + <properties>
| + <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
| + <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
| + <!-- property name="hibernate.hbm2ddl.auto" value="update"/ -->
| + </properties>
| + </persistence-unit>
| </persistence>
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4025308#4025308
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4025308
19Â years, 1Â month
[JBossCache] - JBossCache 1.3 - CacheStoreInterceptor does not commit trans
by archanaa_panda
I am using JBossCache 1.3 SP4 with weblogic 8.1 SP4. JBossCache has been configured to use org.jboss.cache.GenericTransactionManagerLookup - so that the transaction Manager of weblogic would be used. I am also using a JDBC Cache Loader configuration
In my code, I have enclosed treeCache.put in a transaction i.e.
tx.begin();
| treeCache.put(.....);
| tx.commit();
What I observe is that even after commit(), records do not get inserted into database. This is causing a problem next time I try to insert any node on the same branch.
I did some debugging by checking the source code of the JBossCache. I find the following code in CacheStoreInterceptor.invoke() -
if (log.isTraceEnabled()) {
| log.trace("CacheStoreInterceptor called with meth " + m);
| }
|
| if (tx_mgr != null && tx_mgr.getTransaction() != null) {
| // we have a tx running.
| log.trace("transactional so don't put stuff in the cloader yet.");
| GlobalTransaction gtx = getInvocationContext().getGlobalTransaction();
| if (TreeCache.commitMethod.equals(meth)) {
| if (getInvocationContext().isTxHasMods()) {
| // this is a commit call.
| if (log.isTraceEnabled()) log.trace("Calling loader.commit() for gtx " + gtx);
| // sync call (a write) on the loader
| List fqnsModified = getFqnsFromModificationList(tx_table.get(gtx).getModifications());
| obtainLoaderLocks(fqnsModified);
| try
| {
| loader.commit(gtx);
| }
| finally
| {
| releaseLoaderLocks(fqnsModified);
| preparingTxs.remove(gtx);
| }
| if (cache.getUseInterceptorMbeans()&& statsEnabled) {
| Integer puts = (Integer)m_txStores.get(gtx);
| if (puts != null)
| m_cacheStores = m_cacheStores + puts.intValue();
| m_txStores.remove(gtx);
| }
| }
| else {
| log.trace("Commit called with no modifications; ignoring.");
| }
| }
I turned debug logging on and I observed that the following is printed
org.jboss.cache.interceptors.CacheStoreInterceptor CacheStoreInterceptor called with meth commit(GlobalTransaction:<127.0.0.1:2081>:1)
However, the next debug output was
org.jboss.cache.interceptors.PessimisticLockInterceptor PessimisticLockInterceptor invoked for method commit(GlobalTransaction:<127.0.0.1:2081>:1)
Calling loader.commit() was never printed!!!This means that the commit is not being called for the loader and the records are not getting stored into the database. This observation tallies with the results I am getting
Is this a known bug??? If so and if you are planning to fix the problem, I hope it is released in a future release of JBossCache 1.3 itself since I am not planning to upgrade to 1.4
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4025305#4025305
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4025305
19Â years, 1Â month