Tomcat fails deploying and old webapp - java

I get blocked trying to move an old webapp developed for Resin server (without creating a war container or having ejb-jar.xml) to a Tomcat 7 server. What I´ve done is: create a Dynamic Web project in Eclipse, include the code and created ejb-jar with the declaration. Also created the web.xml file with the servlet. Once it compiled correctly, I exported it to a WAR file which I deploy in Tomcat.
This is the error:
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/PortalSavia-Tomcat]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.manager.ManagerServlet.start(ManagerServlet.java:1256)
at org.apache.catalina.manager.HTMLManagerServlet.start(HTMLManagerServlet.java:714)
at org.apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.java:219)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.filters.CsrfPreventionFilter.doFilter(CsrfPreventionFilter.java:212)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:611)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1852)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: java.lang.NoClassDefFoundError: javax/ejb/EJBObject
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:792)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2895)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1173)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1681)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2521)
at java.lang.Class.getDeclaredMethods(Class.java:1845)
at org.apache.catalina.util.Introspection.getDeclaredMethods(Introspection.java:127)
at org.apache.catalina.startup.WebAnnotationSet.loadMethodsAnnotation(WebAnnotationSet.java:281)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:143)
at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:67)
at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:405)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:881)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:376)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5322)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
I´ve checked ejb-jar.xml which is in META-INF as It must be. Also web.xml seems to be fine and have the servlet. Any idea where to look for an error? Maybe libs?
Thanks a lot!

Tomcat is not a full application server, it is just a servlet container. That being said, Tomcat does not have JAVA EE container.
The javax/ejb/EJBObject can be found in the Java EE jars. So either user a full application server like JBoss, or include the necessary JAR's in Tomcat.

If you insist on using tomcat you can try to deploy your application to TomEE
TomEE - is basically tomcat with J2EE steroids. I'm sure that your app won't run out of the box (usually applications tie themselves to the application servers so tightly, that it's impossible to change the application server).
I suggest you take a look at a full-blown J2EE application server (JBoss, Glassfish etc).

Tomcat does not support EJBs. It is just a servlet container. You need to use a full Java EE application container, such a JBoss, Glassfish or WebSphere.
I would NOT recommend trying to add the EJB support jars to a vanilla Tomcat installation. It is / they are not designed to be used that way, and you are likely to run into lots of problems.

Related

Tomcat: Application errors when multiple WARs deployed

I am seeing something very strange after my Tomcat starts up. I have 15 applications deployed, and everything seems OK until I try to access a specific page on a specific application. There are some cross-dependencies such as services.
If I deploy the troubled application by itself, I can view the page without issue. If I deploy all the other applications one by one, I can view the page without issue. If all applications are deployed together at startup, this is when I see the following error:
SEVERE: Can't instantiate page using constructor public com.company.web.view.purchase.buy.BuyAGiftPage(org.apache.wicket.PageParameters) and argument
org.apache.wicket.WicketRuntimeException: Can't instantiate page using constructor public com.company.web.view.purchase.buy.BuyAGiftPage(org.apache.wicket.PageParameters) and argument
at org.apache.wicket.session.DefaultPageFactory.createPage(DefaultPageFactory.java:212)
at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:65)
at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.newPage(BookmarkablePageRequestTarget.java:298)
at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.getPage(BookmarkablePageRequestTarget.java:320)
at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.processEvents(BookmarkablePageRequestTarget.java:234)
at org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1252)
at org.apache.wicket.RequestCycle.step(RequestCycle.java:1331)
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1438)
at org.apache.wicket.RequestCycle.request(RequestCycle.java:546)
at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:486)
at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:319)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.ideasx.stats.HttpFilterStatCounter.doFilter(HttpFilterStatCounter.java:87)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:409)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1044)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:695)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.apache.wicket.session.DefaultPageFactory.createPage(DefaultPageFactory.java:188)
... 30 more
Caused by: java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer
at org.apache.wicket.proxy.LazyInitProxyFactory.createProxy(LazyInitProxyFactory.java:159)
at org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getFieldValue(AnnotProxyFieldValueFactory.java:130)
at org.apache.wicket.injection.Injector.inject(Injector.java:103)
at org.apache.wicket.injection.ConfigurableInjector.inject(ConfigurableInjector.java:39)
at org.apache.wicket.injection.ComponentInjector.onInstantiation(ComponentInjector.java:52)
at org.apache.wicket.Application.notifyComponentInstantiationListeners(Application.java:1093)
at org.apache.wicket.Component.(Component.java:926)
at org.apache.wicket.MarkupContainer.(MarkupContainer.java:113)
at org.apache.wicket.markup.html.WebMarkupContainer.(WebMarkupContainer.java:49)
at org.apache.wicket.markup.html.WebMarkupContainerWithAssociatedMarkup.(WebMarkupContainerWithAssociatedMarkup.java:51)
at org.apache.wicket.markup.html.WebMarkupContainerWithAssociatedMarkup.(WebMarkupContainerWithAssociatedMarkup.java:43)
at org.apache.wicket.markup.html.panel.Panel.(Panel.java:76)
at com.company.web.view.purchase.buy.BuyAGiftPanel.(BuyAGiftPanel.java:54)
at com.company.web.view.purchase.buy.BuyAGiftPage.(BuyAGiftPage.java:22)
... 35 more
I have checked for dependency collisions and didn't find anything out of the ordinary. So my question is this. Given that I can deploy the applications in a specific order and not see the error, is it possible that Tomcat is responsible for this? How would I go about finding the problem?
Edited to add:
It seems that on startup, a clean session and the first request to the application throws the following cast exception:
SEVERE: Can't instantiate page using constructor public com.company.web.view.purchase.buy.BuyAGiftPage(org.apache.wicket.PageParameters) and argument
org.apache.wicket.WicketRuntimeException: Can't instantiate page using constructor public com.company.web.view.purchase.buy.BuyAGiftPage(org.apache.wicket.PageParameters) and argument
at org.apache.wicket.session.DefaultPageFactory.createPage(DefaultPageFactory.java:212)
at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:65)
at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.newPage(BookmarkablePageRequestTarget.java:298)
at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.getPage(BookmarkablePageRequestTarget.java:320)
at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.processEvents(BookmarkablePageRequestTarget.java:234)
at org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1252)
at org.apache.wicket.RequestCycle.step(RequestCycle.java:1331)
at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1438)
at org.apache.wicket.RequestCycle.request(RequestCycle.java:546)
at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:486)
at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:319)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at com.ideasx.stats.HttpFilterStatCounter.doFilter(HttpFilterStatCounter.java:87)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:409)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1044)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:695)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.apache.wicket.session.DefaultPageFactory.createPage(DefaultPageFactory.java:188)
... 30 more
Caused by: java.lang.ExceptionInInitializerError
at org.apache.wicket.proxy.LazyInitProxyFactory.createProxy(LazyInitProxyFactory.java:159)
at org.apache.wicket.spring.injection.annot.AnnotProxyFieldValueFactory.getFieldValue(AnnotProxyFieldValueFactory.java:130)
at org.apache.wicket.injection.Injector.inject(Injector.java:103)
at org.apache.wicket.injection.ConfigurableInjector.inject(ConfigurableInjector.java:39)
at org.apache.wicket.injection.ComponentInjector.onInstantiation(ComponentInjector.java:52)
at org.apache.wicket.Application.notifyComponentInstantiationListeners(Application.java:1093)
at org.apache.wicket.Component.(Component.java:926)
at org.apache.wicket.MarkupContainer.(MarkupContainer.java:113)
at org.apache.wicket.markup.html.WebMarkupContainer.(WebMarkupContainer.java:49)
at org.apache.wicket.markup.html.WebMarkupContainerWithAssociatedMarkup.(WebMarkupContainerWithAssociatedMarkup.java:51)
at org.apache.wicket.markup.html.WebMarkupContainerWithAssociatedMarkup.(WebMarkupContainerWithAssociatedMarkup.java:43)
at org.apache.wicket.markup.html.panel.Panel.(Panel.java:76)
at com.company.web.view.purchase.buy.BuyAGiftPanel.(BuyAGiftPanel.java:54)
at com.company.web.view.purchase.buy.BuyAGiftPage.(BuyAGiftPage.java:22)
... 35 more
Caused by: java.lang.ClassCastException: net.sf.cglib.proxy.Enhancer$EnhancerKey$$KeyFactoryByCGLIB$$7fb24d72 cannot be cast to net.sf.cglib.core.KeyFactory
at net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java:145)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:117)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:108)
at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:104)
at net.sf.cglib.proxy.Enhancer.(Enhancer.java:69)
... 49 more
This isn't specific to Tomcat it seems. After searching some more I found that cglib_nodep dependency has some class loading issues. I excluded this library from the tree, explicitly defined cglib version 2.2 and it cleared things up.
http://forum.spring.io/forum/spring-projects/web/flex/65337-an-strange-error-with-net-sf-cglib-core-keyfactory
Remove all the server logs, all the temporary files in Tomcat and retry. This many times fix this kind of issues.

Tomcat java.lang.ClassNotFoundException

I have Tomcat 7.0.42 and Java JDK 1.7.0_40. Through the browser I deployed in Tomcat a WAR contaning just two JSP pages.
Tomcat runs as "tomcat" user and all the files in the Tomcat folder have "tomcat" as owner. Java JDK instead belongs to
the user "uucp" and group "143". In the startup script of Tomcat I added export JAVA_HOME=/var/jdk1.7.0_40 (but if I
give the command echo $JAVA_HOME with user "tomcat" I get nothing).
Sometimes when I try to access the JSP pages of the deployed app I get the error:
SEVERE: Servlet.service() for servlet [jsp] in context with path [/examples] threw exception [java.lang.ClassNotFoundException: org.apache.jsp.test1_jsp] with root cause
java.lang.ClassNotFoundException: org.apache.jsp.test1_jsp
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:132)
at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:63)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:143)
at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:172)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
And if I restart Tomcat, I will be able to access those JSP pages correctly and after a certain period of time the error
shows up again.
However I need to find a way to access those JSP pages correctly without the need to restart Tomcat.
Adding JAVA_HOME will not set environment variables for the user tomcat, if you want to set it for the user, you have to define it in .bashrc on *nix system or in environment variable on on Windows.
This error means tomcat can not find generated class file for your jsp page,
on standalone tomcat installation generated files are located on
/work/Catalina/localhost
on eclipse it will be in .metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps

SEVERE: Servlet.service() for servlet jsp threw exception java.lang.LinkageError: loader constraint violation [duplicate]

This question already has answers here:
java.lang.LinkageError: javax.servlet.jsp.JspApplicationContext.getExpressionFactory
(6 answers)
Closed 7 years ago.
I'm working with Spring and trying to launch an application using tomcat 7, but I keep getting this error and I couldn't find much on Linkeage Errors in relation to Spring.
Here is the full error:
Sep 24, 2013 7:54:15 PM org.apache.catalina.core.ApplicationDispatcher invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.LinkageError: loader constraint violation: when resolving interface method "javax.servlet.jsp.JspApplicationContext.getExpressionFactory()Ljavax/el/ExpressionFactory;" the class loader (instance of org/apache/jasper/servlet/JasperLoader) of the current class, org/apache/jsp/WEB_002dINF/views/home_jsp, and the class loader (instance of org/apache/catalina/loader/StandardClassLoader) for resolved class, javax/servlet/jsp/JspApplicationContext, have different Class objects for the type avax/el/ExpressionFactory; used in the signature
at org.apache.jsp.WEB_002dINF.views.home_jsp._jspInit(home_jsp.java:23)
at org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:49)
at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:171)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:356)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:471)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:402)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:329)
at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:262)
at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1180)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:950)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
I have encountered this same error when deploying an app on tomcat 6.0
I found in the release notes that the el-api JAR file is already included by default. Tomcat is trying to load two different JARs which it does not like.
Delete the el-api JAR in your WEB-INF/lib folder and try again.
Was getting the same error when trying the Spring roo application.
Thanks to user1724646, the issue was resolved by commenting out the el-api.jar in the pom.xml
<!--<dependency>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
<version>2.2</version>
<scope>provided</scope>
</dependency> -->
This problem is caused by two versions of the el-api being loaded. By default the Tomcat 7 Common classloader loads el-api 2.2 More info about this can be found on http://tomcat.apache.org/tomcat-7.0-doc/class-loader-howto.html. The jars loaded by this classloader are located in $CATALINA_HOME/lib. The solution would be to remove the el-api jar from your web application (i.e. WEB-INF/lib).

java.lang.IllegalStateException on Tomcat 7.0.2 but working fine on WAS7

I have this application on Websphere Application Server 7.0 that I am in process to port to tomcat 7.0.2.
I have following line of code in my application :
parameters.remove("MainUserId");
parameters.remove("MainPassword");
This code gives me the following exception on Tomcat
java.lang.IllegalStateException: No modifications are allowed to a locked ParameterMap
at org.apache.catalina.util.ParameterMap.remove(ParameterMap.java:211)
at com.csc.fs.accel.ui.action.admin.user.UserAccess.updateUser(UserAccess.java:1386)
at com.csc.fs.accel.ui.action.admin.user.UserAccess.doPost(UserAccess.java:1775)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:999)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:565)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
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)
Basically here parameters is a session parameter map. So as per java specification parameters map is immutable. But this works good for Websphere Application server.
While researching, I read a comment here that says
if this worked in WebSphere then WebSphere is not following the
specification. Either because of a bug or because it has been
explicitly configured to ignore that part of the spec.
Any alternatives? except do not remove elements from map
Also, is it possible if there is any configuration in tomcat that can make the parameter map mutable ?

lejos noclassdeffounderror lejos/pc/comm/NXTComm

First I created a Java App to test my code to contact the NXT Brick using Bluetooth. Once this worked I created a Webservice instead which should connect to the NXT Brick through Bluetooth.
This is where the problems start. My Webservice works fine, I can see the services and I can invoke them.
One service uses NXTComm, which is in the Lejos PC Libraries (lejos.pc.comm.NXTComm). I've added these libraries to the project and I've added "import lejos.pc.comm.*;" at the top of the class but I still get the following error.
[ERROR] lejos/pc/comm/NXTComm
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:212)
at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:117)
at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:181)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172)
at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:146)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:929)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:405)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:964)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302)
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)
Caused by: java.lang.NoClassDefFoundError: lejos/pc/comm/NXTComm
at mindstorms.Connector.getBots(Connector.java:111)
at mindstorms.MindstormService.getBots(MindstormService.java:30)
... 29 more
Caused by: java.lang.ClassNotFoundException: lejos.pc.comm.NXTComm
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1523)
... 31 more
Why can't the services get to these libraries and what should I do to fix this?
So what have you done in order to add the leJOS libraries to your web application? Why would you expect, that they are in the classpath?
It might work, if you but the JAR files from the folder lib/pc in your leJOS distribuion into the WEB-INF/lib folder of your web application. Alternatively, there is a directory for libraries that all web application can access. It must be located somewhere where Tomcat is located.
BTW: The system property java.class.path does not really return the paths that are searched for classes. If one is using classloaders (which tomcat does), the paths they search are not present in java.class.path.

Categories