Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Two issues when I try to convert my application to a Maven based project for uploading to HCP

I am following this tutorial to convert my Java dynamic web project to a Maven based project to be uploaded to HCP later.

The conversion can be triggered by the context menu below:
A pom.xml will be automatically generated. After I copy the source code from the template pom.xml mentioned in the tutorial:
When I perform Maven build, I meet with the following Error message:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.2:war (default-war) on project jerrytest: Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode) 
And I found solution in stackoverflow that I have to explicitly declare the position of my web.xml in pom.xml:
Once done the build error is gone, I can successfully build the project.
However when trying to launch the project in local tomcat, another error occurs:
HTTP Status 500 - Error instantiating servlet class helloworld.HelloWorldServlet
--------------------------------------------------------------------------------
type Exception report
message Error instantiating servlet class helloworld.HelloWorldServlet
description The server encountered an internal error that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Error instantiating servlet class helloworld.HelloWorldServlet
	org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
	com.sap.core.jpaas.security.auth.service.lib.AbstractAuthenticator.invoke(AbstractAuthenticator.java:170)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
	com.sap.core.tenant.valve.TenantValidationValve.invokeNextValve(TenantValidationValve.java:167)
	com.sap.core.tenant.valve.TenantValidationValve.invoke(TenantValidationValve.java:91)
	com.sap.js.statistics.tomcat.valve.RequestTracingValve.invoke(RequestTracingValve.java:34)
	com.sap.core.js.monitoring.tomcat.valve.RequestTracingValve.invoke(RequestTracingValve.java:27)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
	org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1115)
	org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
	org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
	java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	java.lang.Thread.run(Unknown Source)

root cause
java.lang.ClassNotFoundException: helloworld.HelloWorldServlet
	org.eclipse.gemini.web.tomcat.internal.loading.BundleWebappClassLoader.loadClass(BundleWebappClassLoader.java:312)
	java.lang.ClassLoader.loadClass(Unknown Source)
	org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:506)
	com.sap.core.jpaas.security.auth.service.lib.AbstractAuthenticator.invoke(AbstractAuthenticator.java:170)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
	com.sap.core.tenant.valve.TenantValidationValve.invokeNextValve(TenantValidationValve.java:167)
	com.sap.core.tenant.valve.TenantValidationValve.invoke(TenantValidationValve.java:91)
	com.sap.js.statistics.tomcat.valve.RequestTracingValve.invoke(RequestTracingValve.java:34)
	com.sap.core.js.monitoring.tomcat.valve.RequestTracingValve.invoke(RequestTracingValve.java:27)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:445)
	org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1115)
	org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:637)
	org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
	java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	java.lang.Thread.run(Unknown Source)

note The full stack trace of the root cause is available in the Apache Tomcat/7.0.77 logs.
--------------------------------------------------------------------------------
Apache Tomcat/7.0.77
The solution is to manually create a folder named “classes” under folder “WEB-INF” and specify it as Class Folder.
As a result once war file is generated successfully, we can find the corresponding class file for servlet used in this project.
After that change, deploy the application to HCP and it could successfully run there.
You can refer to my project in github for more detail.


This post first appeared on Web Service Testing A Blackjack GUI And API, please read the originial post: here

Share the post

Two issues when I try to convert my application to a Maven based project for uploading to HCP

×

Subscribe to Web Service Testing A Blackjack Gui And Api

Get updates delivered right to your inbox!

Thank you for your subscription

×