I have this jsp page where it calls the servlet class.In this servlet class it calls another java class.This java class is then attempting to locate a folder named "profiles".However when I tried running the jsp page on a browser it keeps returning ClassNotFoundException(Is it caused by specifying the wrong directory or missing JAR files?).The question I am asking is:How do I get the correct pathing of that folder?
EDIT:
Here is the code:
In UserClientSearch.jsp:
<form id="form" method="post" action="UserClientServlet">
In UserClientServlet.java:
String value = request.getParameter("screenName");
request.setAttribute("screenName", value);
UserClientFilterSpam fs = new UserClientFilterSpam();
ArrayList<String> content= fs.filterSpam(value);
In UserClientFilterSpam.java:
try {
lds.init("profiles");
} catch (LangDetectException ex) {
System.out.println("Error encountered: "+ ex);
}
Here is the stacktrace:
SEVERE: Servlet.service() for servlet [servlet.UserClientServlet] in context with path [/MarcusFYPJ] threw exception [Servlet execution threw an exception] with root cause
java.lang.ClassNotFoundException: com.cybozu.labs.langdetect.LangDetectException
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
at servlet.UserClientServlet.doPost(UserClientServlet.java:47)
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:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
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:99)
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:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
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)
The error is being caused by the fact that com.cybozu.labs.langdetect.LangDetectException is missing from the classpath.
You need to make sure that it is included in the deployed web application. If it is a 3rd party JAR file it can reside in the web app's WEB-INF/lib folder.
Related
I am getting the following error on tomcat apache server running a GWT web application. 500 internal server error the call failed on the server; see server log for details
The server log contains:
Jul 22, 2015 8:05:51 AM org.apache.catalina.core.ApplicationContext log
SEVERE: Exception while dispatching incoming RPC call
org.hibernate.AssertionFailure: null id in com.simulconsult.test.shared.model.Script entry (don't flush the Session after an exception occurs)
at org.hibernate.event.def.DefaultFlushEntityEventListener.checkId(DefaultFlushEntityEventListener.java:82)
at org.hibernate.event.def.DefaultFlushEntityEventListener.getValues(DefaultFlushEntityEventListener.java:190)
at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:147)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:219)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:99)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:50)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1216)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:345)
at com.sun.proxy.$Proxy61.flush(Unknown Source)
at net.sf.gilead.core.hibernate.HibernateUtil.flushIfNeeded(HibernateUtil.java:979)
at net.sf.gilead.core.PersistentBeanManager.clone(PersistentBeanManager.java:227)
at net.sf.gilead.gwt.GileadRPCHelper.parseReturnValue(GileadRPCHelper.java:157)
at net.sf.gilead.gwt.PersistentRemoteService.processCall(PersistentRemoteService.java:203)
at com.simulconsult.test.server.HibernateBasedService.processCall(HibernateBasedService.java:68)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:305)
at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
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.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
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.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
The same code and deployment works without error on my local tomcat apache server, but not on that of my web host provider.
Thoughts?
Apparently the error logged is related to my Script object but is not the real problem. The issue was we neglected to update the database table schema at our web host provider site.
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.
Following is the code which works fine when it is in main() method. Compiles and gives .jasper file as an output
package com;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperCompileManager;
public class JasperCompile {
public static void main(String args[]) throws JRException {
JasperCompileManager.compileReportToFile("C:\\temp.jrxml", "C:\\temp.jasper");
}
}
But when I embed following line from main() method to servlet's doGet method then it doesn't work
JasperCompileManager.compileReportToFile("C:\\temp.jrxml", "C:\\temp.jasper");
Following is the stack trace.
Jan 7, 2014 4:19:21 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [JasperReportsBrowserDemoServlet] in context with path [/PDFReports] threw exception [Servlet execution threw an exception] with root cause
java.lang.NoSuchMethodError: org.apache.commons.digester.Digester.addSetProperties(Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/StringV
at net.sf.jasperreports.components.ComponentsXmlHandler.addListRules(ComponentsXmlHandler.java:117)
at net.sf.jasperreports.components.ComponentsXmlHandler.configureDigester(ComponentsXmlHandler.java:104)
at net.sf.jasperreports.engine.xml.JRXmlDigesterFactory.addComponentRules(JRXmlDigesterFactory.java:514)
at net.sf.jasperreports.engine.xml.JRXmlDigesterFactory.configureDigester(JRXmlDigesterFactory.java:493)
at net.sf.jasperreports.engine.xml.JRXmlDigesterFactory.createDigester(JRXmlDigesterFactory.java:1324)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:207)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:172)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:156)
at net.sf.jasperreports.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:108)
at com.JasperReportsBrowserDemoServlet.createJRXML(JasperReportsBrowserDemoServlet.java:136)
at com.JasperReportsBrowserDemoServlet.doGet(JasperReportsBrowserDemoServlet.java:47)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
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: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:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
4:23 PM
what difference it makes when we write code in main() method and server side ?
Your version of Apache Commons Digester is incorrect. Review all dependencies of JasperReport.
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
I have 2 eclipse projects A and B. A is a web project.I'm trying to call a class in project B from controller of project A.I have added jar of proj B in build path of project A.
Projects are compilation error free.But I'm getting runtime exception as below:
SEVERE: Servlet.service() for servlet [com.tcs.ibm.Controller] in context with path [/TextAnalytics] threw exception [Servlet execution threw an exception] with root cause
java.lang.ClassNotFoundException: com.tcs.ibm.Hello
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1688)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1533)
at com.tcs.ibm.Controller.doPost(Controller.java:45)
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: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:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:928)
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:987)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:539)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:300)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
input is fff
It seems that class com.tcs.ibm.Hello is not present in the classpath As addressed by #Patton put your jar file which contains above class in WEB-INF/lib and restart the server again.