Servlet "newspring" is not available - java

Trying to set up a new spring project and im having this issue where I get this error (HTTP Status 404 - Servlet newspring is not available) when I navigate to a page that I expect to get routed through to a controller.
web.xml
<servlet>
<servlet-name>springapp</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springapp</servlet-name>
<url-pattern>/app/*</url-pattern>
</servlet-mapping>
So I looked in the tomcat logs and I see this exception:
SEVERE: Error loading
WebappClassLoader delegate: false
repositories:
/WEB-INF/classes/
----------> Parent Classloader: org.apache.catalina.loader.StandardClassLoader#a1807c
org.springframework.web.servlet.DispatcherServlet
java.lang.ClassNotFoundException:
org.springframework.web.servlet.DispatcherServlet
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1095)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4149)
but the supposedly missing class is actually present in the spring-webmvc.jar which is present in the WEB-INF/libs(at tomcatfolder/webapp/newSpring/WEB-INF/libs).
Is it unable to look here ?

Assuming I read correctly, the folder should be /WEB-INF/lib, not /WEB-INF/libs - note the lack of s at the end!

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

Upgrading jboss server 4.0 with jdk6 to wildfly15 with jdk8

previously my project was on jdk 6 with jboss 4.i upgraded from jdk6 to jdk8 . When i was using jdk 8 with jboss4 it was working properly but after upgrading jboss 4 with wildfly 15 i am getting below error.
in web.xml i configured crystalReportViewer as given below .wildfly 15 is giving error but when i removed the crystalReportConfiguration line then its working properly..
enter code here
<context-param>
<param-name>crystal_image_uri</param-name>
<param-value>crystalreportviewers</param-value>
</context-param>
<context-param>
<param-name>crystal_image_use_relative</param-name>
<param-value>webapp</param-value>
</context-param>
<servlet>
<servlet-name>CrystalReportViewerServlet</servlet-name>
<servlet-class>com.crystaldecisions.report.web.viewer.CrystalReportViewerServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>CrystalReportViewerServlet</servlet-name>
<url-pattern>/CrystalReportViewerHandler</url-pattern>
</servlet-mapping>
Caused by:
org.jboss.as.server.deployment.DeploymentUnitProcessingException:
java.lang.ClassNotFoundException:
com.crystaldecisions.report.web.viewer.CrystalReportViewerServlet from
[Module "deployment.ubarms.war" from Service Module Loader] at
org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.checkDeclaredApplicationClassAsServlet(JaxrsScanningProcessor.java:437)
at
org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.scanWebDeployment(JaxrsScanningProcessor.java:278)
at
org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.deploy(JaxrsScanningProcessor.java:109)
at
org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:144)
... 8 more

Liquibase changelog does not exist - ChangeLogParseException

I am trying to use liquibase on startup in my JEE+WildFly app.
When launching AS, liquibase throws ChangeLogParseException:
09:41:40,602 ERROR [org.jboss.as.server] (management-handler-thread - 1) WFLYSRV0021: Deploy of deployment "bets.war" was rolled back with the following failure message:
{
"WFLYCTL0080: Failed services" => {"jboss.undertow.deployment.default-server.default-host./bets" => "java.lang.RuntimeException: java.lang.RuntimeException: liquibase.exception.ChangeLogParseException: :classpath/WEB-INF/db-changelog.xml does not exist
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: liquibase.exception.ChangeLogParseException: :classpath/WEB-INF/db-changelog.xml does not exist
Caused by: java.lang.RuntimeException: liquibase.exception.ChangeLogParseException: :classpath/WEB-INF/db-changelog.xml does not exist
Caused by: liquibase.exception.ChangeLogParseException: :classpath/WEB-INF/db-changelog.xml does not exist"},
Liquibase params are set in web.xml:
<!-- liquibase auto startup -->
<context-param>
<param-name>liquibase.changelog</param-name>
<param-value>:classpath/WEB-INF/db-changelog.xml</param-value>
</context-param>
<context-param>
<param-name>liquibase.datasource</param-name>
<param-value>java:jboss/datasources/BetsDS</param-value>
</context-param>
<context-param>
<param-name>liquibase.onerror.fail</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>liquibase.contexts</param-name>
<param-value>production</param-value>
</context-param>
<listener>
<listener-class>liquibase.integration.servlet.LiquibaseServletListener</listener-class>
</listener>
Structure is as below:
Looked through subjects here in SO, db-changelog is in .war package:
Tried already renaming liquibase.changelog value to WEB-INF/db-changelog.xml and /WEB-INF/db-changelog.xml, still the same.
Already figured it out.
Moved db-changelog to main/resources/META-INF and set param to
<param-value>META-INF/db-changelog.xml</param-value>
Everything works now:
[2018-05-27 11:27:42,823] Artifact bets:war: Artifact is deployed successfully
[2018-05-27 11:27:42,823] Artifact bets:war: Deploy took 13 582 milliseconds

CXF : java.lang.ClassNotFoundException: org.apache.cxf.transport.servlet.CXFServlet

I am trying to deploy a rest web service in WAS 8.0
The application EAR is getting installed successfully.
However, both on publishing as well as on hitting the service from web browser after publishing, I am getting below error:
[3/13/14 13:42:20:652 IST] 00000024 servlet E com.ibm.ws.webcontainer.servlet.ServletWrapper run SRVE8052E: Logging ClassNotFoundException
java.lang.ClassNotFoundException: class java.lang.ClassNotFoundException: org.apache.cxf.transport.servlet.CXFServlet
at java.beans.Beans.instantiate(Beans.java:190)
at java.beans.Beans.instantiate(Beans.java:75)
at com.ibm.ws.webcontainer.servlet.ServletWrapper$1.run(ServletWrapper.java:1471)
at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.loadServlet(ServletWrapper.java:1460)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.load(ServletWrapper.java:1358)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:982)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3751)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:304)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:962)
at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1662)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:276)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1690)
However, the jar containing the class viz. cxf-rt-transports-http-2.7.4.jar is present inside lib directory of the WAR inside the EAR installed.
What is the cause of the issue ?
How can I resolve it ?
Update: My web.xml is as below:
<web-app>
<display-name>MyService</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>CXFServlet</servlet-name>
<display-name>CXF Servlet</display-name>
<servlet-class>
org.apache.cxf.transport.servlet.CXFServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
</web-app>
I see that you mentioned the word "publish", which hints that you might be using Eclipse, or possibly IBM's RAD or even MyEclipse Blue.
In case that's true, read on...
While your .ear, generated by m2e/Maven, may have the .jar file present in the .war file, there's a chance that the .ear and .war file, generated by m2e-wtp, is missing the .jar file. m2e-wtp's generated .ear file is what's used when you publish/republish your application to WAS from within Eclipse/RAD/MyEclipse Blue.
Try removing the app from your local WAS, finding the location of that m2e-wtp-generated .ear file, and deleting it. From there, m2e-wtp should automatically generate a fresh .ear file if you clean your project (all associated pom, ear, war, etc.)
When you publish your app, it should find the class. I've had the same problem happen to me in the past. My suggestion has fixed the problem.
Other than that, you may need to set the Classloader Policy to PARENT_LAST and check that you're using a single classloader for the entire app (the 2nd set of radio buttons below the Classloader Policy radio buttons) within the WAS admin console. However, I doubt that the Classloader Policy is the issue.

The requested resource is not available while publishing on tomcat

I'm trying to publish a simple java web service using tomcat. Referring to below screenshot, I have HelloWorld.java which is service interface and its HelloWorldImpl.java implementation class.
Also I've created web.xml and sun-jaxws.xml.
When I right click the project, select Run As and then Run on Server, I get 404 error message as shown in bottom of screenshot.
The URL which internal browser tries to reach is http://localhost:8081/MySqlConnect/ where MySqlConnect is project name. Note that I'm using 8081 as port number.
I also tried http://localhost:8081/HelloWorld/hello, but it didn't worked.
I have also provided the code for all files below.
I'm not able to understand where am I going wrong? Any help appreciated.
HelloWorldImpl.java
package com.mycompany.service;
import javax.jws.WebService;
#WebService(endpointInterface = "com.mycompany.service.HelloWorld", serviceName = "HelloWorld")
public class HelloWorldImpl implements HelloWorld {
#Override
public String sayGreeting(String name) {
return "Greeting " + name + "!";
}
}
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems,
Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">
<web-app>
<listener>
<listener-class>
com.sun.xml.ws.transport.http.servlet.WSServletContextListener
</listener-class>
</listener>
<servlet>
<servlet-name>hello</servlet-name>
<servlet-class>
com.sun.xml.ws.transport.http.servlet.WSServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>hello</servlet-name>
<url-pattern>/hello</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>120</session-timeout>
</session-config>
</web-app>
sun-jaxws.xml
<?xml version="1.0" encoding="UTF-8"?>
<endpoints xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime"
version="2.0">
<endpoint name="HelloWorld" implementation="com.mycompany.service.HelloWorldImpl"
url-pattern="/hello" />
</endpoints>
Edit 1
Log-cat
INFO: Starting Servlet Engine: Apache Tomcat/7.0.33
com.sun.xml.ws.transport.http.servlet.WSServletContextListener parseAdaptersAndCreateDelegate
SEVERE: WSSERVLET11: failed to parse runtime descriptor: java.lang.NoClassDefFoundError: javax/xml/ws/soap/AddressingFeature$Responses
java.lang.NoClassDefFoundError: javax/xml/ws/soap/AddressingFeature$Responses
Caused by: java.lang.ClassNotFoundException: javax.xml.ws.soap.AddressingFeature$Responses
Edit 2
As suggested here, I downloaded all libraries and place in tomcat lib folder but now I get this error in log:
com.sun.xml.ws.transport.http.servlet.WSServletContextListener parseAdaptersAndCreateDelegate
SEVERE: WSSERVLET11: failed to parse runtime descriptor: java.lang.NoSuchMethodError: com.sun.xml.ws.assembler.TubelineAssemblyController: method <init>()V not found
java.lang.NoSuchMethodError: com.sun.xml.ws.assembler.TubelineAssemblyController: method <init>()V not found
If I add all libraries to project and then try to run it, I get following error:
com.sun.xml.ws.transport.http.servlet.WSServletContextListener parseAdaptersAndCreateDelegate
SEVERE: WSSERVLET11: failed to parse runtime descriptor: com.sun.xml.ws.util.ServiceConfigurationError: com.sun.xml.ws.policy.jaxws.spi.PolicyFeatureConfigurator: Provider com.sun.xml.ws.transport.tcp.policy.TCPTransportFeatureConfigurator is specified in jar:file:/C:/Apache-Tomcat-7/lib/webservices-rt-2.1-b16.jar!/META-INF/services/com.sun.xml.ws.policy.jaxws.spi.PolicyFeatureConfiguratorbut could not be instantiated: java.lang.ClassCastException
com.sun.xml.ws.util.ServiceConfigurationError: com.sun.xml.ws.policy.jaxws.spi.PolicyFeatureConfigurator: Provider com.sun.xml.ws.transport.tcp.policy.TCPTransportFeatureConfigurator is specified in jar:file:/C:/Apache-Tomcat-7/lib/webservices-rt-2.1-b16.jar!/META-INF/services/com.sun.xml.ws.policy.jaxws.spi.PolicyFeatureConfiguratorbut could not be instantiated: java.lang.ClassCastException
Note this: com.sun.xml.ws.policy.jaxws.spi.PolicyFeatureConfiguratorbut could not be instantiated: java.lang.ClassCastException
The correct url is http://localhost:8081/MySqlConnect/hello as MySqlConnect is the name of your context and hello the web service url.
Also its a webservice so to access it properly you can make a SOAP call.
But the root cause is your web application is not starting due to unable to find class javax.xml.ws.soap.AddressingFeature$Responses.
Have you added right dependencies? Search in those dependencies if this class exists. Response is a inner class of AddressingFeature.

Categories

Resources