Following is the timeline of how i got error in my application
Used Spring 2.5.3 and tomcat 7.0.27 - No Error
Upgraded to Spring 3.1.1 with same tomcat (7.0.27) - No Error
Upgraded tomcat to 7.0.42, used with Spring 3.1.1 - VerifyError
When i stop my application, i get 1000 verifyerrors (seperate error for every destroyBean) when i upgraded to tomcat 7.0.42.
Following is the Stack Trace:
java.lang.VerifyError: (class: org/springframework/orm/jpa/EntityManagerFactoryUtils, method: convertJpaAccessExceptionIfPossible signature: (Ljava/lang/RuntimeException;)Lorg/springframework/dao/DataAccessException;) Wrong return type in function
at org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor.postProcessBeforeDestruction(PersistenceAnnotationBeanPostProcessor.java:357)
at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:193)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:498)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:474)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:509)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:474)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:442)
at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1066)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1040)
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:988)
at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:556)
at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:142)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4980)
at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5626)
at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:232)
at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1575)
at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1564)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Possible Cause:
fixed EntityManagerFactoryUtils's "convertJpaAccessException" to always return rather than throw DataAccessExceptions
This line is in ChangeLog of Spring 2.5.6
But my application works fine with Spring 3.1.1 and tomcat 7.0.27 but throws this error when upgraded to tomcat 7.0.42
AFAIK, Tomcat doesn't depend on Spring, and Spring doesn't depend on Tomcat. Not in any version of either.
I suspect that in the intermediate version of your application after "upgrade to Spring 3.1.1 with same tomcat (7.0.27)", you either didn't trigger that code to be run. Note that it is happening in code that is run when a webapp is shut. If you never attempted a clean shutdown in the intermediate version of your application, that postProcessBeanBeforeDestruction method wouldn't be called on that bean, and the problem wouldn't arise.
My guess is that the real problem is caused by mixing versions of Spring JAR files.
Related
when I deploy my war file on tomcat it is ok but when I deploy it on glassfish it gives the exception, I searched but found no result how to solve this.
java.lang.ArrayIndexOutOfBoundsException: 9578
at org.objectweb.asm.ClassReader.readClass(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at org.glassfish.hk2.classmodel.reflect.Parser$5.on(Parser.java:363)
at com.sun.enterprise.v3.server.ReadableArchiveScannerAdapter.handleEntry(ReadableArchiveScannerAdapter.java:171)
at com.sun.enterprise.v3.server.ReadableArchiveScannerAdapter.onSelectedEntries(ReadableArchiveScannerAdapter.java:133)
at org.glassfish.hk2.classmodel.reflect.Parser.doJob(Parser.java:348)
at org.glassfish.hk2.classmodel.reflect.Parser.access$300(Parser.java:70)
at org.glassfish.hk2.classmodel.reflect.Parser$3.call(Parser.java:307)
at org.glassfish.hk2.classmodel.reflect.Parser$3.call(Parser.java:296)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
...............
[#|2018-10-07T15:19:22.345+0330|SEVERE|glassfish3.1.2|javax.enterprise.system.core.com.sun.enterprise.v3.server|_ThreadID=84;_ThreadName=Thread-2;|Exception while loading the app|#]
[#|2018-10-07T15:19:25.182+0330|SEVERE|glassfish3.1.2|javax.enterprise.system.tools.admin.org.glassfish.deployment.admin|_ThreadID=84;_ThreadName=Thread-2;|Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'TestController' defined in file [E:\glassfish3-Reservation\glassfish3\glassfish\domains\domain1\applications\myproject\WEB-INF\classes\com\company\controller\TestController.class]: Instantiation of bean failed; nested exception is java.lang.ExceptionInInitializerError
Your best option is to update your Glassfish server if you can. Your version 3.1.2 is way too old, the current one is 5.0.
Another option would be to look for Lambda expressions in the TestController class and to remove or replace them with standard code.
This exception seems to occur when you are using Lambda expressions or newer Java bytecode with a version of asm.jar which is too old. This is related to your old version of Glassfish which comes bundled with Jersey 1.x which has bundled asm.jar 3.1. This version seems to be not fully compatible with Java8 or newer bytecode.
More related information:
Strange java.lang.ArrayIndexOutOfBoundsException thrown on jetty startup
Java 8 Lambda Expression Within REST Service not working
ArrayIndexOutOfBoundsException when using Java 8 language features
I am getting this exception during tomcat start. I am using jdk1.8.0_152, apache-tomcat-8.5.24
I have been updating my elasticsearch from version 1.7 to 6.0. For that I had to include few new jars and had to update few existing to latest versions.(commons-io-2.6,lucene-core-7.0.1,log4j-api-2.9.1) After that I am getting this error on tomcat starting.
SEVERE [localhost-startStop-1]
org.apache.catalina.core.ApplicationContext.log
StandardWrapper.Throwable java.lang.ArrayIndexOutOfBoundsException:
41981 at org.objectweb.asm.ClassReader.(Unknown Source) at
org.objectweb.asm.ClassReader.(Unknown Source) at
org.objectweb.asm.ClassReader.(Unknown Source)
What version of asm do you use? According to this post https://github.com/joaoarthurbm/designwizard/issues/36:
asm-3.1 doesn't support lambdas expression available in JDK 8.
So you might be want to upgrade to asm 5.0.1 or higher.
Is Jersey 1.8 compatible with Java 8?
Also, is Jersey 1.8 compatible with WildFly 8 on Java 8?
I developed and I am now maintaining a REST
web service project which produces a WAR.
We started having some problems with this like 6 months ago
(but btw we only now noticed them). See error and screenshot below.
After doing quite some research on the web,
it seems to me the problems are related to the fact that our project
was migrated to Java 8 and WildFly 8 (previously it was running on Tomcat
6 with Java 6).
So... I thought the solution is to migrate to at least Jersey 1.9
(we don't want to use the Jersey 2.x line).
I tried it but I am getting the same error.
So... is Jersey 1.x at all compatible with WildFly 8 and Java 8?
The error which we started getting looks like this.
07:27:33,894 INFO [com.sun.jersey.api.core.WebAppResourceConfig] (default task-7) Scanning for root resource and provider classes in the Web app resource paths:
/WEB-INF/lib
/WEB-INF/classes
07:27:36,984 ERROR [io.undertow.request] (default task-7) UT005023: Exception handling request to /rpt/rpt-rest-service/report: java.lang.ArrayIndexOutOfBoundsException: 1901
at org.objectweb.asm.ClassReader.readClass(Unknown Source) [asm-3.1.jar:3.1]
at org.objectweb.asm.ClassReader.accept(Unknown Source) [asm-3.1.jar:3.1]
at org.objectweb.asm.ClassReader.accept(Unknown Source) [asm-3.1.jar:3.1]
at com.sun.jersey.spi.scanning.AnnotationScannerListener.onProcess(AnnotationScannerListener.java:133) [jersey-server-1.8-SNAPSHOT.jar:1.8-SNAPSHOT]
at com.sun.jersey.core.spi.scanning.JarFileScanner.scan(JarFileScanner.java:97) [jersey-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT]
at com.sun.jersey.spi.scanning.WebAppResourcesScanner$1.f(WebAppResourcesScanner.java:94) [jersey-server-1.8-SNAPSHOT.jar:1.8-SNAPSHOT]
at com.sun.jersey.core.util.Closing.f(Closing.java:71) [jersey-core-1.8-SNAPSHOT.jar:1.8-SNAPSHOT]
at com.sun.jersey.spi.scanning.WebAppResourcesScanner.scan(WebAppResourcesScanner.java:92) [jersey-server-1.8-SNAPSHOT.jar:1.8-SNAPSHOT]
at com.sun.jersey.spi.scanning.WebAppResourcesScanner.scan(WebAppResourcesScanner.java:79) [jersey-server-1.8-SNAPSHOT.jar:1.8-SNAPSHOT]
at com.sun.jersey.api.core.ScanningResourceConfig.init(ScanningResourceConfig.java:80) [jersey-server-1.8-SNAPSHOT.jar:1.8-SNAPSHOT]
at com.sun.jersey.api.core.WebAppResourceConfig.init(WebAppResourceConfig.java:100) [jersey-server-1.8-SNAPSHOT.jar:1.8-SNAPSHOT]
at com.sun.jersey.api.core.WebAppResourceConfig.<init>(WebAppResourceConfig.java:87) [jersey-server-1.8-SNAPSHOT.jar:1.8-SNAPSHOT]
at com.sun.jersey.api.core.WebAppResourceConfig.<init>(WebAppResourceConfig.java:72) [jersey-server-1.8-SNAPSHOT.jar:1.8-SNAPSHOT]
at com.sun.jersey.spi.container.servlet.WebComponent.getWebAppResourceConfig(WebComponent.java:672) [jersey-server-1.8-SNAPSHOT.jar:1.8-SNAPSHOT]
at com.sun.jersey.spi.container.servlet.ServletContainer.getDefaultResourceConfig(ServletContainer.java:414) [jersey-server-1.8-SNAPSHOT.jar:1.8-SNAPSHOT]
at com.sun.jersey.spi.container.servlet.ServletContainer.getDefaultResourceConfig(ServletContainer.java:581) [jersey-server-1.8-SNAPSHOT.jar:1.8-SNAPSHOT]
at com.sun.jersey.spi.container.servlet.WebServletConfig.getDefaultResourceConfig(WebServletConfig.java:87) [jersey-server-1.8-SNAPSHOT.jar:1.8-SNAPSHOT]
at com.sun.jersey.spi.container.servlet.WebComponent.createResourceConfig(WebComponent.java:703) [jersey-server-1.8-SNAPSHOT.jar:1.8-SNAPSHOT]
.......
The same exception I get in the browser when calling my REST web service.
Note that there have been no code or library or config changes in this project
(which produces that WAR). I believe only the deployment environment was changed.
As it usually happens an hour or two after asking here, I found the solution.
The solution is to upgrade Jersey from 1.8 to some later version from the 1.x Jersey line.
First I tried a minimalistic approach and upgraded to version 1.9 but that one had the same issue.
So then I just upgraded to the latest version from the 1.x Jersey line (which is version 1.19.3 as of this moment). This solved the problem.
I have an openjpa application running in a weblogic 12.1.2 container.
When i first install the application everything works fine. If i update the ear file (or redeploy) i get the following error:
- Could not log the error: EJB Exception: found this error: EJB Exception: : <openjpa-1.1.1-SNAPSHOT-r422266:1445923 nonfatal general error> org.apache.openj
pa.persistence.PersistenceException: org.apache.xerces.parsers.XIncludeAwareParserConfiguration cannot be cast to org.apache.xerces.xni.parser.XMLParserConfiguration
at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:196)
at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:142)
at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:199)
at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:152)
at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:56)
at weblogic.persistence.TransactionalEntityManagerProxyImpl.newPersistenceContext(TransactionalEntityManagerProxyImpl.java:71)
at weblogic.persistence.BasePersistenceContextProxyImpl.getPersistenceContext(BasePersistenceContextProxyImpl.java:175)
at weblogic.persistence.BasePersistenceContextProxyImpl.invoke(BasePersistenceContextProxyImpl.java:106)
at weblogic.persistence.TransactionalEntityManagerProxyImpl.invoke(TransactionalEntityManagerProxyImpl.java:82)
at weblogic.persistence.BasePersistenceContextProxyImpl.invoke(BasePersistenceContextProxyImpl.java:92)
at com.sun.proxy.$Proxy235.createNativeQuery(Unknown Source)
(...)
Caused by: java.lang.ClassCastException: org.apache.xerces.parsers.XIncludeAwareParserConfiguration cannot be cast to org.apache.xerces.xni.parser.XMLParserConfiguration
at org.apache.xerces.parsers.DOMParser.<init>(Unknown Source)
at org.apache.xerces.parsers.DOMParser.<init>(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.<init>(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderFactoryImpl.newDocumentBuilder(Unknown Source)
at org.apache.openjpa.lib.xml.XMLFactory.getDOMParser(XMLFactory.java:107)
at org.apache.openjpa.jdbc.sql.SQLErrorCodeReader.parse(SQLErrorCodeReader.java:108)
at org.apache.openjpa.jdbc.sql.DBDictionary.endConfiguration(DBDictionary.java:4096)
at org.apache.openjpa.jdbc.sql.OracleDictionary.endConfiguration(OracleDictionary.java:170)
at org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:505)
This is only fixed by restarting the cluster nodes. This doesn't happen in Weblogic 10.3.
I've been looking around and i stumbled across several possible solutions to no avail. One of the possible issues can be seen here: Stackoverflow Question
From here I started fiddling with the ear and i now have the xercesImpl lib ( the same that exists on the server) inside my APP-INF/lib this. Without this the application won't even install.
I've tried adding the following line to my weblogic-application.xml:
<wls:package-name>org.apache.xerces.*</wls:package-name>
And this had no effect.
Also looked into the possibility that my EntityManager was being left open upon undeploy, but i have no reason to believe this is the case. All my EntityManager are container managed and injected using the #EJB annotation.
Anyone have any ideas on this?
Just to let you know, I'm not a programmer at all so I'm kind of lost in my problem. I'm trying to migrate an app from a Windows Server 2003 server on Apache Tomcat 4.1 and Java 1.4.2 (App is working fine on that server). I'm tried migrating it on a Windows Server 2008 R2 with any version of Apache Tomcat and Java compatible with W2KR2 but I'm always getting the same error when I try to start the app from the web interface:
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/GestClientsAS2]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.StandardContext.reload(StandardContext.java:3780)
at org.apache.catalina.startup.HostConfig.reload(HostConfig.java:1307)
at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1290)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1474)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:280)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1141)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1365)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1369)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1345)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: javax/mail/internet/MimeBodyPart
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getDeclaredMethods(Unknown Source)
at org.apache.catalina.util.Introspection.getDeclaredMethods(Introspection.java:127)
at org.apache.catalina.startup.WebAnnotationSet.loadMethodsAnnotation(WebAnnotationSet.java:275)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:138)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:65)
at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:331)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:770)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:302)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5083)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
I believe there is a class missing? How would I fix this?
Thanks.
Since you told me you application was running in a java 1.4 version, and this class is only default in Java 5+ version (See documentation: http://docs.oracle.com/javaee/5/api/javax/mail/internet/MimeBodyPart.html), you will have to import it to your project.
Download it: http://www.java2s.com/Code/Jar/j/Downloadjavamailmailapi14jar.htm
Since it is a web application, put this jar file inside, WEB-INF/libs, so, the classloader will load it, restart the server.
if its not a web project you can right click on the library and go to "Build Path" -> "Add to Build Path".