exception while integrating mahout recommender engine in java web application - java

I am trying to implement recoemmender code in java dynamic web application using direct approach. i can compile the code but when i run the application on server i am getting following error:
type
Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Servlet execution threw an exception
root cause
java.lang.NoClassDefFoundError: org/apache/mahout/cf/taste/model/DataModel
com.demoMahout.HelperRecommender.getUserBasedRecommendation(HelperRecommender.java:96)
com.demoMahout.HelperRecommender.doPost(HelperRecommender.java:53)
javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
root cause
java.lang.ClassNotFoundException: org.apache.mahout.cf.taste.model.DataModel
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1676)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1521)
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:332)
com.demoMahout.HelperRecommender.getUserBasedRecommendation(HelperRecommender.java:96)
com.demoMahout.HelperRecommender.doPost(HelperRecommender.java:53)
javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
How can i resolve this issue?

It means just what it says: you don't have the Mahout classes included in your web app! put the JAR files in WEB-INF/lib as you need to do with any other library a web app needs.

Related

Deploying my web application in IBM WebSphere Application Server Liberty 17.0.0.2 raising error

I deployed my web application in IBM WebSphere Application Server Liberty 17.0.0.2 and when I am trying to access it getting following error:
Error Message: javax.servlet.ServletException:
java.lang.NoClassDefFoundError: Could not initialize class
com.x.y.z
Error Code: 500
Target Servlet: com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor
Error Stack: java.lang.NoClassDefFoundError: Could not initialize class com.x.y.z at
com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:207)
at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:1021)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1143)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:4983)
at com.ibm.ws.webcontainer31.osgi.webapp.WebApp31.handleRequest(WebApp31.java:528)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.handleRequest(DynamicVirtualHost.java:315)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1025)
at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.run(DynamicVirtualHost.java:280)
at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$TaskWrapper.run(HttpDispatcherLink.java:967)
at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink.wrapHandlerAndExecute(HttpDispatcherLink.java:359)
at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink.ready(HttpDispatcherLink.java:318)
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:471)
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleNewRequest(HttpInboundLink.java:405)
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.processRequest(HttpInboundLink.java:285)
at com.ibm.ws.http.channel.internal.inbound.HttpICLReadCallback.complete(HttpICLReadCallback.java:66)
at com.ibm.ws.tcpchannel.internal.WorkQueueManager.requestComplete(WorkQueueManager.java:504)
at com.ibm.ws.tcpchannel.internal.WorkQueueManager.attemptIO(WorkQueueManager.java:574)
at com.ibm.ws.tcpchannel.internal.WorkQueueManager.workerRun(WorkQueueManager.java:929)
at com.ibm.ws.tcpchannel.internal.WorkQueueManager$Worker.run(WorkQueueManager.java:1018)
If the com.x.y.z is a 3rd party package, you'll need to set visibility of the third-party API packages in the Liberty server.xml to allow the application to access them.
Hopefully this documentation should help: https://www.ibm.com/support/knowledgecenter/en/SSEQTP_8.5.5/com.ibm.websphere.wlp.doc/ae/twlp_classloader_3p_apis.html

Trying to get JSON response with JavaEE JAX-B, Jasper and Glassfish 4.1.1, but I get error 500

I am learning WebServices with JAX-B and Jasper. I can easily generate XML response, but I want to get JSON response, but I get error 500.
Here is exception:
javax.servlet.ServletException: org.glassfish.jersey.server.ContainerException: java.lang.NoClassDefFoundError: javax/xml/parsers/ParserConfigurationException
root cause
org.glassfish.jersey.server.ContainerException: java.lang.NoClassDefFoundError: javax/xml/parsers/ParserConfigurationException
root cause
java.lang.NoClassDefFoundError: javax/xml/parsers/ParserConfigurationException
root cause
java.lang.ClassNotFoundException: javax.xml.parsers.ParserConfigurationException not found by org.eclipse.persistence.moxy [228]
Full server log: http://pastebin.com/Eq2KbyKJ
Okey, I tried with Tomcat, and it works, it seems that is Glassfish related problem, but I want to use Glassfish as server, since I use EJB in my projects.
It's a bug inside Eclipselink: https://bugs.eclipse.org/bugs/show_bug.cgi?id=463169 , try upgrading to the latest version?

XOPEncodingStreamWriter incompatible with DataHandlerWriter -- WAS8.5.5.2 + AXIOM

Can any one tell me why the below error comes...
Unable to perform rendering due to exception (java.lang.ClassCastException: org.apache.axiom.util.stax.xop.XOPEncodingStreamWriter incompatible with org.apache.axiom.ext.stax.datahandler.DataHandlerWriter)
I am using axiom in my application which got deployed in WAS 8.5.5.2. The same application is working fine in Jboss6 with axiom-impl,axiom-api,axiom-ext 1.2.12 jars but getting the below error in Websphere. No clues at all.
StackTrace:
stacktrace=org.apache.axiom.util.stax.XMLStreamWriterUtils.internalGetDataHandlerWriter(XMLStreamWriterUtils.java:71)
org.apache.axiom.util.stax.XMLStreamWriterUtils.writeDataHandler(XMLStreamWriterUtils.java:134)
org.apache.axiom.util.stax.XMLStreamWriterUtils.writeDataHandler(XMLStreamWriterUtils.java:134)
com.myapplication.mdivrs.axis2.mdivrsStub$RenderDocument.serialize(mdivrsStub.java:1503)
com.myapplication.mdivrs.axis2.mdivrsStub$RenderDocumentE.serialize(mdivrsStub.java:2607)
com.myapplication.mdivrs.axis2.mdivrsStub$RenderDocumentE.serialize(mdivrsStub.j ava:2593)
org.apache.axis2.databinding.ADBDataSource.serialize(ADBDataSource.java:90)
org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerialize(OMSourcedElementImpl.java:781)
org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:967)
org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.serializeInternally(SOAPEnvelopeImpl.java:283)
org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:245)
org.apache.axiom.om.impl.llom.OMSerializableImpl.serializeAndConsume(OMSerializableImpl.java:207)
org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:74)
org.apache.axis2.transport.http.AxisRequestEntity.writeRequest(AxisRequestEntity.java:84)
org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:499)
org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2114)

Tomcat home page showing error

I can't open my tomcat server home page it is showing the following error:
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 1 in the generated java file
The type java.util.Map$Entry cannot be resolved. It is indirectly referenced from required .class files
Stacktrace:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:102)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:331)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:457)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:378)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
note The full stack trace of the root cause is available in the Apache Tomcat/7.0.23 logs.
Apache Tomcat/7.0.23
This is caused by a compatibility problem because you are using different Java versions. Likely you are using Java8 only as:
JRE for your Tomcat OR
compiling your code
Make a decision on which Java version would you like to use and ensure that your environment is consistently uses that specific version.

java rest web service RuntimeException WEB9033

i'm developing a rest web service in java.
i'm using htmlparser library on it.
but when i try to run service i'm getting this exception. i can build it successfully. and org.htmlparser.beans.StringBean class exists in project.
exception
javax.servlet.ServletException: java.lang.RuntimeException: WEB9033: Unable to load class with name [org.htmlparser.beans.StringBean], reason: java.lang.NoClassDefFoundError: org/htmlparser/visitors/NodeVisitor
root cause
java.lang.RuntimeException: WEB9033: Unable to load class with name [org.htmlparser.beans.StringBean], reason: java.lang.NoClassDefFoundError: org/htmlparser/visitors/NodeVisitor
root cause
java.lang.NoClassDefFoundError: org/htmlparser/visitors/NodeVisitor
root cause
java.lang.ClassNotFoundException: org.htmlparser.visitors.NodeVisitor
Check that WEB-INF/lib/htmlparser.jar exists in the server.

Categories

Resources