I am trying to deploy war file on websphere 8.5.5.13. which is connected to oracle(11g) db and even i had created data sources connection on websphere.
The application is getting installed but when i try to start the application gives me the following error:
[29/10/18 15:00:49:733 IST] 000001e1 SystemErr R Caused by: com.ibm.ws.webcontainer.exception.WebAppNotLoadedException: Failed to load webapp: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: javax/persistence/Table.indexes()[Ljavax/persistence/Index; (loaded from file:/C:/Program Files (x86)/IBM/WebSphere/AppServer/plugins/javax.j2ee.persistence.jar by org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader#180c62e2) called from class org.hibernate.cfg.annotations.EntityBinder (loaded from file:/C:/Program%20Files%20(x86)/IBM/WebSphere/AppServer/profiles/DefaultAppServer/installedApps/AntivirusServerNode01Cell/cream_war.ear/cream.war/WEB-INF/lib/hibernate-core-5.0.12.Final.jar by
[29/10/18 15:00:49:733 IST] 000001e1 SystemErr R Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: javax/persistence/Table.indexes()[Ljavax/persistence/Index; (loaded from file:/C:/Program Files (x86)/IBM/WebSphere/AppServer/plugins/javax.j2ee.persistence.jar by org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader#180c62e2) called from class org.hibernate.cfg.annotations.EntityBinder (loaded from file:/C:/Program%20Files%20(x86)/IBM/WebSphere/AppServer/profiles/DefaultAppServer/installedApps/AntivirusServerNode01Cell/cream_war.ear/cream.war/WEB-INF/lib/hibernate-core-5.0.12.Final.jar by
I also tried changing the version of hibernate and jpa but that too didnt work.
But when i deploy application without using oracle db (using h2 or derby) it runs properly.
Please help me out with this error.
Not able to find the path
The NoSuchMethodError indicates that Hibernate is trying to call a method on javax.persistence.Table that doesn't exist. The Table class has been loaded from file:/C:/Program Files (x86)/IBM/WebSphere/AppServer/plugins/javax.j2ee.persistence.jar so it's WAS itself that's providing the incompatible class.
By default, WAS 8.5.5 uses JPA 2.0 but it is possible to use JPA 2.1 by following the steps described here. You've already done most of the steps described in "Embedding a third-party persistence provider within an application". The one remaining step is to configure your application's class loader order so that it will prefer classes bundled with your application to those provided by the application server.
Related
I am trying to run an application on tomcat server. The application was earlier running on Jboss EAP. All the configuration changes have been made in the tomcat context.xml and other application related configuration files like web.xml, etc. The only ERROR and SEVERE logs that I see when the application is being deployed are mentioned below:
[main] ERROR org.springframework.web.context.ContextLoader - Context
initialization failed
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'redisCacheManager' defined in class path
resource [config/serviceContext.xml]: Instantiation of bean failed;
nested exception is
org.springframework.beans.BeanInstantiationException: Failed to
instantiate [com.tcs.cdm.cache.CacheManager]: Constructor threw
exception; nested exception is java.lang.Error: Unresolved compilation
problems: The type redis.clients.jedis.JedisPoolConfig cannot be
resolved. It is indirectly referenced from required .class files
. . .
SEVERE: Exception sending context initialized event to listener
instance of class
[org.springframework.web.context.ContextLoaderListener]
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'redisCacheManager' defined in class path
resource [config/serviceContext.xml]: Instantiation of bean failed;
nested exception is
org.springframework.beans.BeanInstantiationException: Failed to
instantiate [com.tcs.cdm.cache.CacheManager]: Constructor threw
exception; nested exception is java.lang.Error: Unresolved compilation
problems: The type redis.clients.jedis.JedisPoolConfig cannot be
resolved. It is indirectly referenced from required .class files
. . .
SEVERE: One or more listeners failed to start. Full details will be
found in the appropriate container log file
org.apache.catalina.core.StandardContext startInternal SEVERE: Context
[/AppName] startup failed due to previous errors
I have gone through several threads but did not find any solution working for me. I have tried making version changes to jsf related jars in my pom.xml but that also doesn't help. I am currently using tomcat version 9.0.36 but have also tried TomEE 8.0.8 for the same but facing the same issue in both the cases. It would be great if someone could guide as to why this error is coming or a possible solution for the same.
We have upgraded the solace version from 7.1 to 10.1 for an existing spring based application. After upgrading it, we started the application and observed the below error. Is new solace jar causing this error?
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'solaceConnectionFactory' defined in class path resource [SolRes.xml]: Invocation of init method failed; nested exception is javax.naming.NoInitialContextException: Failed to create InitialContext using factory specified in hashtable [Root exception is java.lang.NullPointerException]
I'm trying to deploy a Grails 3 app to a Tomcat 8 instance on Elastic Beanstalk and I've tried a few things that I've found on Google and Stack Exchange including changing the "org.springframework.boot:spring-boot-starter-tomcat" dependency from "compile" to "provided," which didn't work. Elastic Beanstalk will accept the war file, but then just shows a blank page.
I opened up the war file that Grails produced and saw that there's no index.jsp file in the base directory or web.xml file under WEB-INF. Both of those exists in a simple war file I made using a Maven web-app archetype, which works, so I have two questions:
1) Has anyone else deployed an app from the latest version of Grails to Tomcat 8? Especially on Elastic Beanstalk and especially recently? Most of the answers I've found from Googling are old, so I'm thinking maybe something has changed with a new version.
2) What's the best reference to see the process Tomcat 8 goes through when opening a WAR file and loading it? I think if I could dig deeper into this process, I could figure out where the missing pieces are.
#John Stanford , I found same problem my grails version is 3.2.3
I have tested deploy to my tomcat8 on local , and found my data-source configuration cause this problem , my grails app is just dummy app , no need database connection ,
the log /var/lib/tomcat8/logs/catalina.2017-xx-xx.log show as below
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grailsCacheFilter': Cannot create inner bean '(inner bean)#7cbf54fc' of type [grails.plugin.cache.web.filter.simple.MemoryPageFragmentCachingFilter] while setting bean property 'filter'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name '(inner bean)#7cbf54fc': Unsatisfied dependency expressed through method 'setUrlMappingsHandlerMapping' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'urlMappingsHandlerMapping': Unsatisfied dependency expressed through method 'setWebRequestInterceptors' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'openSessionInViewInterceptor': Cannot resolve reference to bean 'hibernateDatastore' while setting bean property 'hibernateDatastore'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateDatastore': Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.grails.orm.hibernate.HibernateDatastore]: Constructor threw exception; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:313)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:129)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1486)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1231)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
so I comment out the production.dataSource.url of application.yml
environments:
development:
dataSource:
dbCreate: create-drop
url: jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
test:
dataSource:
dbCreate: update
url: jdbc:h2:mem:testDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
production:
grails:
serverURL: http://xxx-evn-yyy-zzzz-aws-zone-2.elasticbeanstalk.com
dataSource:
dbCreate: none
#url: jdbc:h2:./prodDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
properties:
jmxEnabled: true
initialSize: 5
maxActive: 50
minIdle: 5
maxIdle: 25
maxWait: 10000
and finally deploy to AWS Beanstalk and it works !
I have been deploying our web application to Weblogic server. However, although I was able to deploy the application successfully in this new version, the app does not start up and users cannot login. The log is:
May 29, 2015 4:38:47 PM org.springframework.web.context.ContextLoader initWebApplicationContext
SEVERE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: javax.persistence.JoinColumn.foreignKey()Ljavax/persistence/ForeignKey;
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1566)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:539)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
I believe this happens because Weblogic enables JPA 2.0 by default (but I am not sure of it). Is there a way to enable JPA 2.1?
PS: We are using hibernate 4.3.8 and I am not an expert on application servers.
Regards.
If you can upgrade to 12.1.3 then JPA 2.1 support is included but disabled by default, you can follow their instructions for enabling it. It amounts to putting the right jars on the classpath which you can do by adding this to the top of common/bin/commEnv.sh
PRE_CLASSPATH=$MW_HOME/oracle_common/modules/javax.persistence_2.1.jar:$MW_HOME/wlserver/modules/com.oracle.weblogic.jpa21support_1.0.0.0_2-1.jar
export PRE_CLASSPATH
I am trying to deploy an MDB in WAS 8.5. The session Factory is being initialized in ejbCreate method. When I try to deploy the application ejb loads successfully and then it shuts down the Queue Activation and gives the following exceptions-
I am not using any framework or MAven for built so all the jars and config files have been added to the classpath as in a Standalone Java Application.
Here are the Hibernate and JAVAEE Jars I am using-
antlr-2.7.7
c3p0-0.9.1
commons-collections-3.2.1
commons-logging-api-1.1.3
dom4j-1.6.1
hibernate-c3p0-4.1.5.Final
hibernate-commons-annotations-4.0.1.Final
hibernate-core-4.1.5.Final
hibernate-entitymanager-4.1.5.Final
hibernate-envers-4.1.5.Final
hibernate-jpa-2.0-api-1.0.1.Final
javassist-3.15.0GA.jar
jboss-logging-3.1.0.GA.jar
jboss-transaction-api_1.1_spec-1.0.0.Final
jms-1.1
log4j-1.2.15
MySQL-connector-java-5.1.22
slf4j-api-1.6.1
javaee.jar
javaee-api-6.0
Here is the exception stacktrace from system logs
EJB threw an unexpected (non-declared) exception during invocation of method "onMessage".Exception data:
javax.ejb.EJBException: MDB PostConstruct failure; nested exception is:
java.lang.Exception: See nested Throwable
at com.ibm.ejs.container.util.ExceptionUtil.EJBException(ExceptionUtil.java:472)
at com.ibm.ejs.container.MessageDrivenBeanO.initialize(MessageDrivenBeanO.java:427)
at com.ibm.ejs.container.BeanOFactory.create(BeanOFactory.java:147)
at com.ibm.ejs.container.EJSHome.createBeanO(EJSHome.java:1238)
at com.ibm.ejs.container.EJSHome.createBeanO(EJSHome.java:1356)
at com.ibm.ejs.container.activator.UncachedActivationStrategy.atActivate
(UncachedActivationStrategy.java:88)
at com.ibm.ejs.container.activator.Activator.preInvokeActivateBean(Activator.java:615)
at com.ibm.ejs.container.EJSContainer.preInvokeActivate(EJSContainer.java:4205)
at com.ibm.ejs.container.EJSContainer.preInvokeMdbActivate(EJSContainer.java:3709)
at com.ibm.ejs.container.MessageEndpointHandler.beforeDelivery
(MessageEndpointHandler.java:1449)
at com.ibm.ejs.container.MessageEndpointHandler.invokeMessageEndpointMethod
(MessageEndpointHandler.java:866)
at com.ibm.ejs.container.MessageEndpointHandler.invoke(MessageEndpointHandler.java:832)
at $Proxy50.beforeDelivery(Unknown Source)
at com.ibm.mq.connector.inbound.AbstractWorkImpl.run(AbstractWorkImpl.java:188)
at com.ibm.ejs.j2c.work.WorkProxy.run(WorkProxy.java:608)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1783)
Caused by: java.lang.Exception: See nested Throwable
at com.ibm.ejs.container.util.ExceptionUtil.EJBException(ExceptionUtil.java:470)
... 15 more
Caused by: java.lang.NoClassDefFoundError: org.hibernate.HibernateException
at java.lang.J9VMInternals.verifyImpl(Native Method)
at java.lang.J9VMInternals.verify(J9VMInternals.java:85)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:162)
at com.hps.superenrollment.ejbmodule.SuperEnrollmentRequestMDB.ejbCreate
(SuperEnrollmentRequestMDB.java:42)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at com.ibm.ejs.container.interceptors.InterceptorProxy.invokeInterceptor
(InterceptorProxy.java:232)
at com.ibm.ejs.container.interceptors.InvocationContextImpl.proceed
(InvocationContextImpl.java:559)
at com.ibm.ejs.container.interceptors.InvocationContextImpl.doLifeCycle
(InvocationContextImpl.java:273)
at com.ibm.ejs.container.MessageDrivenBeanO.initialize(MessageDrivenBeanO.java:411)
Please help me as I am completely lost on what is going wrong here .
The NoClassDefFoundError indicates that some Hibernate class is not in your class-path. Are you sure you have all dependency jars in your classpath (including the jars which are needed at runtime)?
The exception indicating that you should use a PostConstructor method instead of the bean class constructor indicates that you should use the ejbCreate() method. This is the recommended location to initialise and load dependencies of your MDB as it is called by one single thread of the ejb container and ensures that the MDB has been fully constructed before you execute the configuration in the ejbCreate(). It is somewhat similar to the init method in a servlet which is also guaranteed to be called single threaded by the servlet container.