Hello,
so after some work, i got all my annotations with OGM and mongodb running perfectly on my local tomcat. Now after i reached a certain release state i wanted to deploy my app on our tomcat which is running on a debian vm. Even MongoDB is installed correct and runs smoothly. So i deployed my .WAR file, and i got the following exception:
Code:
javax.servlet.ServletException: java.lang.ExceptionInInitializerError
com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:420)
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:540)
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:715)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
root cause
java.lang.ExceptionInInitializerError
com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.begin(BaseTransaction.java:85)
org.hibernate.ogm.transaction.impl.JTATransactionManagerTransaction.doBegin(JTATransactionManagerTransaction.java:59)
org.hibernate.engine.transaction.spi.AbstractTransactionImpl.begin(AbstractTransactionImpl.java:162)
org.hibernate.internal.SessionImpl.beginTransaction(SessionImpl.java:1435)
hibernate.HibernateStore.StoreApiRequest(HibernateStore.java:198)
request.manager.GetMessagesRequestManager.search(GetMessagesRequestManager.java:66)
request.endpoints.RestMessageService.searchInPlattforms(RestMessageService.java:86)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:606)
com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:185)
com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)
com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1542)
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1473)
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1419)
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1409)
com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:409)
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:540)
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:715)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
root cause
java.lang.NullPointerException
com.arjuna.ats.arjuna.objectstore.StoreManager.initStore(StoreManager.java:149)
com.arjuna.ats.arjuna.objectstore.StoreManager.getActionStore(StoreManager.java:103)
com.arjuna.ats.arjuna.objectstore.StoreManager.getRecoveryStore(StoreManager.java:65)
com.arjuna.ats.arjuna.recovery.ActionStatusService.<init>(ActionStatusService.java:64)
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
java.lang.reflect.Constructor.newInstance(Constructor.java:526)
java.lang.Class.newInstance(Class.java:374)
com.arjuna.ats.internal.arjuna.common.ClassloadingUtility.loadAndInstantiateClass(ClassloadingUtility.java:137)
com.arjuna.ats.arjuna.recovery.TransactionStatusManager.start(TransactionStatusManager.java:126)
com.arjuna.ats.arjuna.recovery.TransactionStatusManager.<init>(TransactionStatusManager.java:58)
com.arjuna.ats.arjuna.coordinator.TxControl.createTransactionStatusManager(TxControl.java:188)
com.arjuna.ats.arjuna.coordinator.TxControl.<clinit>(TxControl.java:318)
com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.begin(BaseTransaction.java:85)
org.hibernate.ogm.transaction.impl.JTATransactionManagerTransaction.doBegin(JTATransactionManagerTransaction.java:59)
org.hibernate.engine.transaction.spi.AbstractTransactionImpl.begin(AbstractTransactionImpl.java:162)
org.hibernate.internal.SessionImpl.beginTransaction(SessionImpl.java:1435)
hibernate.HibernateStore.StoreApiRequest(HibernateStore.java:198)
request.manager.GetMessagesRequestManager.search(GetMessagesRequestManager.java:66)
request.endpoints.RestMessageService.searchInPlattforms(RestMessageService.java:86)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:606)
com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:185)
com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)
com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1542)
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1473)
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1419)
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1409)
com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:409)
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:540)
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:715)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
I don't understand what is the problem, like said, local it all works perfectly.
The exception lead me to see the problem is maybe located at the hibernate.cfg file.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
<property name="hibernate.transaction.jta.platform">org.hibernate.service.jta.platform.internal.JBossStandAloneJtaPlatform</property>
<property name="hibernate.ogm.datastore.provider">mongodb</property>
<property name="hibernate.ogm.datastore.database">sma</property>
<property name="current_session_context_class">thread</property>
<mapping ...Mappings </mapping>
</session-factory>
</hibernate-configuration>
Cause the exception was related to the JTATransaction i decided to try to set my jta platform into my HibernateUtil class, but that didn't changed or resolved the problem.
Code:
package hibernate;
import org.hibernate.SessionFactory;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Environment;
import org.hibernate.ogm.cfg.OgmConfiguration;
import org.hibernate.service.ServiceRegistry;
public class HibernateUtil {
private static final SessionFactory sessionFactory;
private static final ServiceRegistry serviceRegistry;
static {
OgmConfiguration conf = new OgmConfiguration();
conf.configure();
//assuming you are using JTA in a non contained environment
/* conf.setProperty(Environment.TRANSACTION_STRATEGY,
"org.hibernate.transaction.JTATransactionFactory");
//assuming JBoss TransactionManager in standalone mode
conf.setProperty(Environment.JTA_PLATFORM,
"org.hibernate.service.jta.platform.internal.JBossStandAloneJtaPlatform");
//assuming the default mongodb settings
conf.setProperty("hibernate.ogm.datastore.provider",
"mongodb");
*/
serviceRegistry = new StandardServiceRegistryBuilder().applySettings(conf.getProperties()).build();
try {
sessionFactory = conf.buildSessionFactory(serviceRegistry);
} catch (Exception e) {
throw new ExceptionInInitializerError(e);
}
}
public static SessionFactory getSessionFactory() {
return sessionFactory;
}
}
Maybe someone know what to do, and what this exception means.
Thank you and best regards!
EDIT:
For better understanding, i use native hibernate implementation and the described code is a JavaEE project. Addtitionally the relevant parts of my pom file:
Code:
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>2.12.4</version>
</dependency>
<dependency>
<groupId>org.hibernate.ogm</groupId>
<artifactId>hibernate-ogm-core</artifactId>
<version>4.1.0.Beta8</version>
</dependency>
<dependency>
<groupId>org.hibernate.ogm</groupId>
<artifactId>hibernate-ogm-mongodb</artifactId>
<version>4.1.0.Beta8</version>
</dependency>
<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.12.1.GA</version>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<version>1.0.0.Final</version>
</dependency>
<dependency>
<groupId>org.jboss.jbossts</groupId>
<artifactId>jbossjta</artifactId>
<version>4.16.4.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.3.8.Final</version>
</dependency>
I hope someone can help....