Tomcat Deploy .war file doesn't run - java

I'm trying to deploy my .war file from Tomcat 8 with Ja, for running it in Postman. However, when I try to deploy and it is not shown in Postman. Below are the given exceptions that causes this issue. What can i do to solve this problem?
org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [C:\Users\berkt\eclipse-workspace\Test\apache-tomcat-8.5.32\webapps\Restful.war]
04-Jul-2018 14:08:31.081 INFO [localhost-startStop-1] org.apache.catalina.startup.ContextConfig.processServletContainerInitializers Unable to process ServletContainerInitializer for [org.glassfish.jersey.servlet.init.JerseyServletContainerInitializer]. This is most likely due to a class defined in the #HandlesTypes annotation being missing. Enable DEBUG level logging for the full stack trace.
04-Jul-2018 14:08:31.541 SEVERE [localhost-startStop-1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component
[StandardEngine[Catalina].StandardHost[localhost].StandardContext[/Restful]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:167)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:754)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:730)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:985)
at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1857)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
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)
Also, i'm using this xml file:
<?xml version = "1.0" encoding = "UTF-8"?>
<web-app xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
xmlns = "http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id = "WebApp_ID" version = "3.0">
<display-name>User Management</display-name>
<servlet>
<servlet-name>Jersey RESTful Application</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>TestRestful</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>Jersey RESTful Application</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
</web-app>

Related

Need assistance in migrating a SOAP service to Wildlfy 26 from Wildfly 10

We have a Java SOAP service running on Wildlfy & Java 8 currently. We are migrating from Wildfly 10 to 26, java-11-openjdk-11.0.12.0.7-0.el8_4.x86_64
Running into all kinds of issues.
Below is my web.xml
<display-name>SearchWS</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<!-- <listener><listener-class>com.sun.xml.ws.transport.http.servlet.WSServletContextListener</listener-class></listener> -->
<servlet>
<servlet-name>SolrSearchWS</servlet-name>
<servlet-class>com.solr.service.SolrSearchWS</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>SolrSearchWS</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
when i try to deploy my web service, i get the following in my log file
2022-12-07 11:30:06,133 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC000001: Failed to start service jboss.deployment.unit."SearchWS-0.0.1-SNAPSHOT.war".undertow-deployment.UndertowDeploymentInfoService: org.jboss.msc.service.StartException in service jboss.deployment.unit."SearchWS-0.0.1-SNAPSHOT.war".undertow-deployment.UndertowDeploymentInfoService: Failed to start serviceorg.jboss.msc#1.4.13.Final//org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1731)org.jboss.msc#1.4.13.Final//org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1559)
org.jboss.threads#2.4.0.Final//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)org.jboss.threads#2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)org.jboss.threads#2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
org.jboss.threads#2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1363)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.IllegalArgumentException: UT010009: Servlet SolrSearchWS of type class com.solr.service.SolrSearchWS does not implement javax.servlet.Servletio.undertow.servlet#2.2.19.Final//io.undertow.servlet.api.ServletInfo.(ServletInfo.java:98)
org.wildfly.extension.undertow#26.1.2.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService.createServletConfig(UndertowDeploymentInfoService.java:749)
org.wildfly.extension.undertow#26.1.2.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService.start(UndertowDeploymentInfoService.java:312)
org.jboss.msc#1.4.13.Final//org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1739)
org.jboss.msc#1.4.13.Final//org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1701)
... 6 more
2022-12-07 11:30:06,141 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 1) WFLYCTL0013: Operation ("full-replace-deployment") failed - address: ([]) - failure description: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit."SearchWS-0.0.1-SNAPSHOT.war".undertow-deployment.UndertowDeploymentInfoService" => "Failed to start service
Caused by: java.lang.IllegalArgumentException: UT010009: Servlet SolrSearchWS of type class com.solr.service.SolrSearchWS does not implement javax.servlet.Servlet"}}
Any help will be greatly appreciated.
regards
preet
We have tried many different combinations of files in POM. Nothing seems to help

SEVERE: Exception starting filter ShiroFilter error

I'm developing a web application in which I have to use Shiro Apache for users and roles management.
I'm cofiguring web.xml file and I got the next error when I try to run the server.
SEVERE: Exception starting filter ShiroFilter error
javax.servlet.ServletException: org.apache.shiro.env.RequiredTypeException: Object named 'filterChainResolver' is not of required type [org.apache.shiro.web.filter.mgt.FilterChainResolver].
at org.apache.shiro.web.servlet.AbstractFilter.init(AbstractFilter.java:105)
at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:277)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:104)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4427)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5067)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1427)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1417)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:943)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:839)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1427)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1417)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:258)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:422)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:770)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:682)
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:498)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:353)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:493)
Caused by: org.apache.shiro.env.RequiredTypeException: Object named 'filterChainResolver' is not of required type [org.apache.shiro.web.filter.mgt.FilterChainResolver].
at org.apache.shiro.env.DefaultEnvironment.getObject(DefaultEnvironment.java:150)
at org.apache.shiro.web.env.DefaultWebEnvironment.getFilterChainResolver(DefaultWebEnvironment.java:45)
at org.apache.shiro.web.servlet.ShiroFilter.init(ShiroFilter.java:77)
at org.apache.shiro.web.servlet.AbstractShiroFilter.onFilterConfigSet(AbstractShiroFilter.java:152)
at org.apache.shiro.web.servlet.AbstractFilter.init(AbstractFilter.java:97)
... 33 more
I read that this issue is probably caused by a blank shiro.ini file, isn't it? But the problem is that my file is not a blank file. Here is my web.xml file
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1">
<display-name>TFG</display-name>
<welcome-file-list>
<welcome-file>loginPage.jsp</welcome-file>
</welcome-file-list>
<listener>
<listener-class>org.apache.shiro.web.env.EnvironmentLoaderListener</listener-class>
</listener>
<!--
<context-param>
<param-name>shiroConfigLocations</param-name>
<param-value>WebContent/WEB-INF/shiro.ini</param-value>
</context-param>
-->
<filter>
<filter-name>ShiroFilter</filter-name>
<filter-class>org.apache.shiro.web.servlet.ShiroFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>ShiroFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
<dispatcher>ERROR</dispatcher>
</filter-mapping>
</web-app>
I'm not using:
<context-param>
<param-name>shiroConfigLocations</param-name>
<param-value>WebContent/WEB-INF/shiro.ini</param-value>
</context-param>
Because it doesn't work, when I try to use it, I got a File Not Found error and I don't know if it is due to a bad classpath definition.
I have the next classpath:
My shiro.ini file was:
# =============================================================================
# Tutorial INI configuration
#
# Usernames/passwords are based on the classic Mel Brooks' film "Spaceballs" :)
# =============================================================================
[main]
sessionManager = org.apache.shiro.web.session.mgt.DefaultWebSessionManager
securityManager.sessionManager = $sessionManager
# -----------------------------------------------------------------------------
# Users and their (optional) assigned roles
# username = password, role1, role2, ..., roleN
# -----------------------------------------------------------------------------
[users]
user = 1234,gestor
user2 = 1234,editor
# -----------------------------------------------------------------------------
# Roles with assigned permissions
# roleName = perm1, perm2, ..., permN
# -----------------------------------------------------------------------------
[roles]
profesor = *
gestor = *
I fixed the issue by adding:
filterChainResolver = org.apache.shiro.web.filter.mgt.PathMatchingFilterChainResolver
In the main part of my shiro.ini file.

RESTful API - Getting HTTP 500 error all the time

I am making a simple RESTful API to my application. I've made another package in my project (other from one where is my main java class, servlet, and model). And then I've made my resource file, very simple which looks like this:
package com.java.api;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;
#Path("webservice")
public class ZipcodeService {
#GET
#Path("/lookup")
public Response lookup() {
return Response.ok().entity("Los Angeles").build();
}
}
and this is my web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" id="WebApp_ID"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<display-name>parking-space-booking-system</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>Jersey Web Application</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>com.java.api</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jersey Web Application</servlet-name>
<url-pattern>/webservice/*</url-pattern>
</servlet-mapping>
</web-app>
I am not using Maven. I am using Netbeans IDE and Tomcat server. I uploaded Jersey 2.25 all jar files to WEB-INF/lib folder. I am experimenting with web.xml to fix it but I have no more ideas. Here is the structure of my project:
Here is also my error message I got:
HTTP Status 500 - Servlet.init() for servlet Jersey Web Application threw exception
type Exception report
message Servlet.init() for servlet Jersey Web Application threw an exception
description The server encountered an internal error that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Servlet.init() for servlet Jersey Web Application threw exception
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
java.lang.Thread.run(Thread.java:748)
root cause
java.lang.NoSuchMethodError: org.glassfish.jersey.CommonProperties.getValue(Ljava/util/Map;Ljavax/ws/rs/RuntimeType;Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Class;)Ljava/lang/Object;
org.glassfish.jersey.jackson.JacksonFeature.configure(JacksonFeature.java:69)
org.glassfish.jersey.model.internal.CommonConfig.configureFeatures(CommonConfig.java:674)
org.glassfish.jersey.model.internal.CommonConfig.configureMetaProviders(CommonConfig.java:610)
org.glassfish.jersey.server.ResourceConfig.configureMetaProviders(ResourceConfig.java:800)
org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:367)
org.glassfish.jersey.server.ApplicationHandler.access$500(ApplicationHandler.java:162)
org.glassfish.jersey.server.ApplicationHandler$3.run(ApplicationHandler.java:304)
org.glassfish.jersey.internal.Errors$2.call(Errors.java:289)
org.glassfish.jersey.internal.Errors$2.call(Errors.java:286)
org.glassfish.jersey.internal.Errors.process(Errors.java:315)
org.glassfish.jersey.internal.Errors.process(Errors.java:297)
org.glassfish.jersey.internal.Errors.processWithException(Errors.java:286)
org.glassfish.jersey.server.ApplicationHandler.(ApplicationHandler.java:301)
org.glassfish.jersey.servlet.WebComponent.(WebComponent.java:311)
org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:169)
org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:359)
javax.servlet.GenericServlet.init(GenericServlet.java:158)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
java.lang.Thread.run(Thread.java:748)
note The full stack trace of the root cause is available in the Apache Tomcat/8.0.27 logs.
Apache Tomcat/8.0.27
Perhaps you have problems with your libraries.
root cause
java.lang.NoSuchMethodError: org.glassfish.jersey.CommonProperties.getValue(..
by the server initialisation shows that you forgot to add some library (perhaps it's not in your Jersey 2.25, check for it). Your can also try to use another version of Jersey.
You need to look in (and post) your Tomcat logs. Look at catalina.out. It looks to me like your web.xml doesn't have a closing web-app tag, but that might just be because you didn't post the full web.xml.
Also, you need to package your application as a WAR file. Tomcat expects your web application WAR file to be located under the webapps directory.
edit:
the method wasn't found, therefore the appropriate JAR isn't actually on the classpath (lib folder).
org.glassfish.jersey.CommonProperties.getValue

ClassNotFoundException: org.owasp.esapi.waf.ESAPIWebApplicationFirewallFilter while applying ESAPIWebApplicationFirewallFilter

Web.xml
<filter>
<filter-name>ESAPI-WAF</filter-name>
<filter-class>org.owasp.esapi.waf.ESAPIWebApplicationFirewallFilter</filter-class>
<init-param>
<param-name>log_settings</param-name>
<param-value>/WEB-INF/log4j-waf.xml</param-value>
</init-param>
<init-param>
<param-name>configuration</param-name>
<param-value>/WEB-INF/waf-policy.xml</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>ESAPI-WAF</filter-name>
<url-pattern>/webresources/*</url-pattern>
</filter-mapping>
Error while Running on server:
Jun 01, 2015 5:02:00 PM org.apache.catalina.core.StandardContext filterStart
SEVERE: Exception starting filter ESAPI-WAF
java.lang.ClassNotFoundException: org.owasp.esapi.waf.ESAPIWebApplicationFirewallFilter
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:506)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:488)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:115)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:258)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4854)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5546)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
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:745)
Seems that the library you are using is not in applications classpath at runtime. Please be sure to add the JAR File of that library in
<WEBAPP>/WEB-INF/lib
or put it into your web containers library directory. For example in case of Apache Tomcat put that JAR file into
<CATALINA_HOME>/lib
directory and don't forget to restart the container or redeploy your application to take effect of that change.

Oracle Weblogic: The root element web-app is missing in the descriptor file

I am trying to use JAX-RS to create a web service hosted on an Oracle Weblogic server. I am new to this technology, so I just followed tutorials given by my instructor. Here is my code:
WebContent/WEB-INF/web.xml
<servlet>
<servlet-name>Jersey REST Service</servlet-name>
<servlet-class>
com.sun.jersey.spi.container.servlet.ServletContainer
</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.edu.cs157b.restful </param-name>
<param-value>AssignmentTwo</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
<servlet-mapping>
<servlet-name>Jersey REST Service</servlet-name>
<url-pattern>/api/*</url-pattern>
</servlet-mapping>
</servlet>
WebContent/WEB-INF/weblogic.xml
<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-web-app xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.5/weblogic-web-app.xsd">
<wls:weblogic-version>12.1.2</wls:weblogic-version>
<wls:context-root>AssignmentTwo</wls:context-root>
</wls:weblogic-web-app>
Here is the error I am getting
<Mar 11, 2014 5:32:16 PM PDT> <Error> <HTTP> <BEA-101064> <[WebAppModule(_auto_generated_ear_:AssignmentTwo)] Error parsing descriptor in Web appplication "/**/AssignmentTwo/WebContent"
weblogic.application.descriptor.MissingRootElementException: [Munger:2156204]The root element web-app is missing in the descriptor file /**/AssignmentTwo/WebContent/WEB-INF/web.xml.
at weblogic.application.descriptor.BasicMunger2._onStartElement(BasicMunger2.java:506)
at weblogic.application.descriptor.BasicMunger2.next(BasicMunger2.java:441)
at weblogic.application.descriptor.VersionMunger._next(VersionMunger.java:342)
at weblogic.application.descriptor.VersionMunger.next(VersionMunger.java:230)
at weblogic.application.descriptor.VersionMunger.consumeInputStream(VersionMunger.java:595)
Truncated. see log file for complete stacktrace
>
<Mar 11, 2014 5:32:16 PM PDT> <Error> <Deployer> <BEA-149265> <Failure occurred in the execution of deployment request with ID "1394584335621" for task "6". Error is: "weblogic.application.ModuleException: [HTTP:101064][WebAppModule(_auto_generated_ear_:AssignmentTwo)] Error parsing descriptor in Web appplication "/**/AssignmentTwo/WebContent"
weblogic.application.descriptor.MissingRootElementException: [Munger:2156204]The root element web-app is missing in the descriptor file /**/AssignmentTwo/WebContent/WEB-INF/web.xml.
at weblogic.application.descriptor.BasicMunger2._onStartElement(BasicMunger2.java:506)
at weblogic.application.descriptor.BasicMunger2.next(BasicMunger2.java:441)
at weblogic.application.descriptor.VersionMunger._next(VersionMunger.java:342)
at weblogic.application.descriptor.VersionMunger.next(VersionMunger.java:230)
at weblogic.application.descriptor.VersionMunger.consumeInputStream(VersionMunger.java:595)
at weblogic.application.descriptor.VersionMunger.init(VersionMunger.java:485)
at weblogic.application.descriptor.VersionMunger.<init>(VersionMunger.java:86)
at weblogic.application.descriptor.VersionMunger.<init>(VersionMunger.java:62)
at weblogic.application.descriptor.VersionMunger.<init>(VersionMunger.java:50)
at weblogic.servlet.internal.WebAppReader2.<init>(WebAppReader2.java:47)
at weblogic.servlet.internal.WebAppDescriptor$MyWebAppDescriptor.createXMLStreamReader(WebAppDescriptor.java:275)
at weblogic.application.descriptor.AbstractDescriptorLoader2.createDescriptorBean(AbstractDescriptorLoader2.java:406)
at weblogic.application.descriptor.AbstractDescriptorLoader2.loadDescriptorBeanWithoutPlan(AbstractDescriptorLoader2.java:778)
at weblogic.application.descriptor.AbstractDescriptorLoader2.loadDescriptorBean(AbstractDescriptorLoader2.java:787)
at weblogic.servlet.internal.WebAppDescriptor.getWebAppBean(WebAppDescriptor.java:142)
at weblogic.servlet.internal.WebAppModule.loadDescriptor(WebAppModule.java:1446)
at weblogic.servlet.internal.WebAppModule.init(WebAppModule.java:244)
at weblogic.servlet.internal.WebAppModule.init(WebAppModule.java:681)
at weblogic.application.internal.flow.ScopedModuleDriver.init(ScopedModuleDriver.java:162)
at weblogic.application.internal.ExtensibleModuleWrapper.init(ExtensibleModuleWrapper.java:98)
at weblogic.application.internal.flow.ModuleListenerInvoker.init(ModuleListenerInvoker.java:84)
at weblogic.application.internal.flow.InitModulesFlow.initModule(InitModulesFlow.java:342)
at weblogic.application.internal.flow.InitModulesFlow.initModules(InitModulesFlow.java:355)
at weblogic.application.internal.flow.InitModulesFlow.prepare(InitModulesFlow.java:383)
at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:706)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42)
at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:237)
at weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:61)
at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:158)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:61)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:207)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:96)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:233)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:749)
at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1238)
at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:252)
at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:172)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:171)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$000(DeploymentReceiverCallbackDeliverer.java:13)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$1.run(DeploymentReceiverCallbackDeliverer.java:46)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:550)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:295)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:254)
[Munger:2156204]The root element web-app is missing in the descriptor file /**/AssignmentTwo/WebContent/WEB-INF/web.xml."
weblogic.application.ModuleException: [HTTP:101064][WebAppModule(_auto_generated_ear_:AssignmentTwo)] Error parsing descriptor in Web appplication "/**/AssignmentTwo/WebContent"
weblogic.application.descriptor.MissingRootElementException: [Munger:2156204]The root element web-app is missing in the descriptor file /**/AssignmentTwo/WebContent/WEB-INF/web.xml.
at weblogic.application.descriptor.BasicMunger2._onStartElement(BasicMunger2.java:506)
at weblogic.application.descriptor.BasicMunger2.next(BasicMunger2.java:441)
at weblogic.application.descriptor.VersionMunger._next(VersionMunger.java:342)
at weblogic.application.descriptor.VersionMunger.next(VersionMunger.java:230)
at weblogic.application.descriptor.VersionMunger.consumeInputStream(VersionMunger.java:595)
at weblogic.application.descriptor.VersionMunger.init(VersionMunger.java:485)
at weblogic.application.descriptor.VersionMunger.<init>(VersionMunger.java:86)
at weblogic.application.descriptor.VersionMunger.<init>(VersionMunger.java:62)
at weblogic.application.descriptor.VersionMunger.<init>(VersionMunger.java:50)
at weblogic.servlet.internal.WebAppReader2.<init>(WebAppReader2.java:47)
at weblogic.servlet.internal.WebAppDescriptor$MyWebAppDescriptor.createXMLStreamReader(WebAppDescriptor.java:275)
at weblogic.application.descriptor.AbstractDescriptorLoader2.createDescriptorBean(AbstractDescriptorLoader2.java:406)
at weblogic.application.descriptor.AbstractDescriptorLoader2.loadDescriptorBeanWithoutPlan(AbstractDescriptorLoader2.java:778)
at weblogic.application.descriptor.AbstractDescriptorLoader2.loadDescriptorBean(AbstractDescriptorLoader2.java:787)
at weblogic.servlet.internal.WebAppDescriptor.getWebAppBean(WebAppDescriptor.java:142)
at weblogic.servlet.internal.WebAppModule.loadDescriptor(WebAppModule.java:1446)
at weblogic.servlet.internal.WebAppModule.init(WebAppModule.java:244)
at weblogic.servlet.internal.WebAppModule.init(WebAppModule.java:681)
at weblogic.application.internal.flow.ScopedModuleDriver.init(ScopedModuleDriver.java:162)
at weblogic.application.internal.ExtensibleModuleWrapper.init(ExtensibleModuleWrapper.java:98)
at weblogic.application.internal.flow.ModuleListenerInvoker.init(ModuleListenerInvoker.java:84)
at weblogic.application.internal.flow.InitModulesFlow.initModule(InitModulesFlow.java:342)
at weblogic.application.internal.flow.InitModulesFlow.initModules(InitModulesFlow.java:355)
at weblogic.application.internal.flow.InitModulesFlow.prepare(InitModulesFlow.java:383)
at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:706)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42)
at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:237)
at weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:61)
at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:158)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:61)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:207)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:96)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:233)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:749)
at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1238)
at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:252)
at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:172)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:171)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$000(DeploymentReceiverCallbackDeliverer.java:13)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$1.run(DeploymentReceiverCallbackDeliverer.java:46)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:550)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:295)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:254)
[Munger:2156204]The root element web-app is missing in the descriptor file /**/AssignmentTwo/WebContent/WEB-INF/web.xml.
at weblogic.servlet.internal.WebAppModule.createModuleException(WebAppModule.java:1824)
at weblogic.servlet.internal.WebAppModule.loadDescriptor(WebAppModule.java:1473)
at weblogic.servlet.internal.WebAppModule.init(WebAppModule.java:244)
at weblogic.servlet.internal.WebAppModule.init(WebAppModule.java:681)
at weblogic.application.internal.flow.ScopedModuleDriver.init(ScopedModuleDriver.java:162)
Truncated. see log file for complete stacktrace
Caused By: weblogic.application.descriptor.MissingRootElementException: [Munger:2156204]The root element web-app is missing in the descriptor file /**/AssignmentTwo/WebContent/WEB-INF/web.xml.
at weblogic.application.descriptor.BasicMunger2._onStartElement(BasicMunger2.java:506)
at weblogic.application.descriptor.BasicMunger2.next(BasicMunger2.java:441)
at weblogic.application.descriptor.VersionMunger._next(VersionMunger.java:342)
at weblogic.application.descriptor.VersionMunger.next(VersionMunger.java:230)
at weblogic.application.descriptor.VersionMunger.consumeInputStream(VersionMunger.java:595)
Truncated. see log file for complete stacktrace
>
<Mar 11, 2014 5:32:16 PM PDT> <Warning> <Deployer> <BEA-149004> <Failures were detected while initiating distribute task for application "_auto_generated_ear_".>
<Mar 11, 2014 5:32:16 PM PDT> <Warning> <Deployer> <BEA-149078> <Stack trace for message 149004
weblogic.application.ModuleException: [HTTP:101064][WebAppModule(_auto_generated_ear_:AssignmentTwo)] Error parsing descriptor in Web appplication "/**/AssignmentTwo/WebContent"
weblogic.application.descriptor.MissingRootElementException: [Munger:2156204]The root element web-app is missing in the descriptor file /**/AssignmentTwo/WebContent/WEB-INF/web.xml.
at weblogic.application.descriptor.BasicMunger2._onStartElement(BasicMunger2.java:506)
at weblogic.application.descriptor.BasicMunger2.next(BasicMunger2.java:441)
at weblogic.application.descriptor.VersionMunger._next(VersionMunger.java:342)
at weblogic.application.descriptor.VersionMunger.next(VersionMunger.java:230)
at weblogic.application.descriptor.VersionMunger.consumeInputStream(VersionMunger.java:595)
at weblogic.application.descriptor.VersionMunger.init(VersionMunger.java:485)
at weblogic.application.descriptor.VersionMunger.<init>(VersionMunger.java:86)
at weblogic.application.descriptor.VersionMunger.<init>(VersionMunger.java:62)
at weblogic.application.descriptor.VersionMunger.<init>(VersionMunger.java:50)
at weblogic.servlet.internal.WebAppReader2.<init>(WebAppReader2.java:47)
at weblogic.servlet.internal.WebAppDescriptor$MyWebAppDescriptor.createXMLStreamReader(WebAppDescriptor.java:275)
at weblogic.application.descriptor.AbstractDescriptorLoader2.createDescriptorBean(AbstractDescriptorLoader2.java:406)
at weblogic.application.descriptor.AbstractDescriptorLoader2.loadDescriptorBeanWithoutPlan(AbstractDescriptorLoader2.java:778)
at weblogic.application.descriptor.AbstractDescriptorLoader2.loadDescriptorBean(AbstractDescriptorLoader2.java:787)
at weblogic.servlet.internal.WebAppDescriptor.getWebAppBean(WebAppDescriptor.java:142)
at weblogic.servlet.internal.WebAppModule.loadDescriptor(WebAppModule.java:1446)
at weblogic.servlet.internal.WebAppModule.init(WebAppModule.java:244)
at weblogic.servlet.internal.WebAppModule.init(WebAppModule.java:681)
at weblogic.application.internal.flow.ScopedModuleDriver.init(ScopedModuleDriver.java:162)
at weblogic.application.internal.ExtensibleModuleWrapper.init(ExtensibleModuleWrapper.java:98)
at weblogic.application.internal.flow.ModuleListenerInvoker.init(ModuleListenerInvoker.java:84)
at weblogic.application.internal.flow.InitModulesFlow.initModule(InitModulesFlow.java:342)
at weblogic.application.internal.flow.InitModulesFlow.initModules(InitModulesFlow.java:355)
at weblogic.application.internal.flow.InitModulesFlow.prepare(InitModulesFlow.java:383)
at weblogic.application.internal.BaseDeployment$1.next(BaseDeployment.java:706)
at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42)
at weblogic.application.internal.BaseDeployment.prepare(BaseDeployment.java:237)
at weblogic.application.internal.EarDeployment.prepare(EarDeployment.java:61)
at weblogic.application.internal.DeploymentStateChecker.prepare(DeploymentStateChecker.java:158)
at weblogic.deploy.internal.targetserver.AppContainerInvoker.prepare(AppContainerInvoker.java:61)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.createAndPrepareContainer(ActivateOperation.java:207)
at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doPrepare(ActivateOperation.java:96)
at weblogic.deploy.internal.targetserver.operations.AbstractOperation.prepare(AbstractOperation.java:233)
at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentPrepare(DeploymentManager.java:749)
at weblogic.deploy.internal.targetserver.DeploymentManager.prepareDeploymentList(DeploymentManager.java:1238)
at weblogic.deploy.internal.targetserver.DeploymentManager.handlePrepare(DeploymentManager.java:252)
at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.prepare(DeploymentServiceDispatcher.java:172)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doPrepareCallback(DeploymentReceiverCallbackDeliverer.java:171)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$000(DeploymentReceiverCallbackDeliverer.java:13)
at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$1.run(DeploymentReceiverCallbackDeliverer.java:46)
at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:550)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:295)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:254)
[Munger:2156204]The root element web-app is missing in the descriptor file /**/AssignmentTwo/WebContent/WEB-INF/web.xml.
at weblogic.servlet.internal.WebAppModule.createModuleException(WebAppModule.java:1824)
at weblogic.servlet.internal.WebAppModule.loadDescriptor(WebAppModule.java:1473)
at weblogic.servlet.internal.WebAppModule.init(WebAppModule.java:244)
at weblogic.servlet.internal.WebAppModule.init(WebAppModule.java:681)
at weblogic.application.internal.flow.ScopedModuleDriver.init(ScopedModuleDriver.java:162)
Truncated. see log file for complete stacktrace
Caused By: weblogic.application.descriptor.MissingRootElementException: [Munger:2156204]The root element web-app is missing in the descriptor file /**/AssignmentTwo/WebContent/WEB-INF/web.xml.
at weblogic.application.descriptor.BasicMunger2._onStartElement(BasicMunger2.java:506)
at weblogic.application.descriptor.BasicMunger2.next(BasicMunger2.java:441)
at weblogic.application.descriptor.VersionMunger._next(VersionMunger.java:342)
at weblogic.application.descriptor.VersionMunger.next(VersionMunger.java:230)
at weblogic.application.descriptor.VersionMunger.consumeInputStream(VersionMunger.java:595)
Truncated. see log file for complete stacktrace
>
The root element web-app is missing in the descriptor file
Your web.xml is missing the root element <web-app>. The nesting is also incorrect. The <servlet-mapping> element is a top-level element like the <servlet> element, not nested inside it.
Your web.xml should have a structure similar to this:
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<servlet>
<servlet-name>Jersey REST Service</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.edu.cs157b.restful </param-name>
<param-value>AssignmentTwo</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Jersey REST Service</servlet-name>
<url-pattern>/api/*</url-pattern>
</servlet-mapping>
</web-app>
If you use an IDE (like Netbeans, Eclipse) when you create a Web-app it will generate a valid web.xml for you. If you create a REST web service it will probably even configure a JAX-RS web.xml for you.

Categories

Resources