Jersey 2.5 and WADL generation : HTTP 404 - jersey

When I access the WADL with the following URL:
http://localhost:8080/MyApp/application.wadl
Tomcat responds HTTP 404.
My configuration is :
- Tomcat 7
- Jersey 2.5.1
- Jackson 2.3.0
- Spring 3.2.5
I would like to know what to do so that Jeresy generates the WADL file.
Thanks.

I solved my problem :
My servlet mapping is :
<servlet-mapping>
<servlet-name>myapp-web-service-rest-v0</servlet-name>
<url-pattern>/wsrest/v0/*</url-pattern>
</servlet-mapping>
Then the WADL URL is :
http://localhost:8080/MyApp/wsrest/v0/application.wadl
Thanks.

Related

Why is upgrading to Tomcat 10.0.5 causing spring boot to shutdown after boot?

I have a spring boot project and I am trying to use Tomcat 10 embedded instead of Tomcat 7. I add the following to my POM...
<properties>
<tomcat.version>10.0.5</tomcat.version>
...
</properties>
Then I run the same command I was running before...
mvn clean package -U && java -cp target\my.jar;props -Dloader.main=com.my.Main org.springframework.boot.loader.PropertiesLauncher
But now it just starts and then shuts itself down. The final messages are...
2021-05-13 15:35:42.105 INFO 10084 --- [ main] com.my.Main : Started Main in 42.918 seconds (JVM running for 44.009)
2021-05-13 15:35:42.190 INFO 10084 --- [extShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
Why would this happen and how can I upgrade without this side effect?
Tomcat 10 is a Jakarta EE 9 servlet container. It basically means, that all javax.* packages were renamed to jakarta.* for copyright reasons (Oracle didn't allow the Eclipse Foundation to use the javax.* names).
Spring Boot 2 and Spring 5 support only the previous Java EE 8 specification, you need to wait for Spring Boot 3 and Spring 6 for Tomcat 10 support. Alternatively you can pass Spring libraries through the Apache Tomcat Migration Tool, which just reached version 1.0 or downgrade to Tomcat 9.0.
See also
Tomcat 10.0.4 doesn't load servlets (#WebServlet classes) with 404 error

Camel Upgrade 2.22 breaks Apache CXF endpoints

I have upgraded Camel 2.22. along with CXF version 3.2.5,Spring boot 2.04.RELEASE
When I start my application I can't see any errors but the can't access endpoints anymore
below is the code:
1) Camel route:
<cxf:cxfEndpoint id="porEndpoint" address="/por/" serviceClass="x.y.z.service.PorService" publishedEndpointUrl="">
<cxf:binding>
<soap:soapBinding version="1.2"/>
</cxf:binding>
</cxf:cxfEndpoint>
2) Properties:
cxf.path=/services
server.servlet.context-path=/fuse-test
3)This URL worked fine earlier :http://localhost:8080/fuse-test/services/por?wsdl
I have enabled trace at context level and log mode as debug but I can't find any errors apart from :
o.s.s.ldap.SpringSecurityLdapTemplate : Ignoring PartialResultException
camel-cxf(v 3.2.5) somehow doesn't include the cxf spring boot. After adding the below dependency the endpoint is available
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxws</artifactId>
<version>3.2.6</version>
</dependency>

JSP page not rendering with Spring Boot in Spring Tool Suite IDE

I ended up getting this log as a result of running my Spring Boot App with a jsp.
2017-12-29 13:30:52.412 WARN 12631 --- [nio-8080-exec-2]
o.s.web.servlet.PageNotFound No mapping found for HTTP
request with URI [/SpringBootTrial/] in DispatcherServlet with name
'dispatcherServlet'
2017-12-29 13:30:56.463 WARN 12631 --- [nio-8080-exec-3]
o.s.web.servlet.PageNotFound No mapping found for HTTP
request with URI [/SpringBootTrial/display] in DispatcherServlet with
name 'dispatcherServlet'
2017-12-29 13:30:56.464 ERROR 12631 --- [nio-8080-exec-3]
o.s.boot.web.support.ErrorPageFilter : Cannot forward to error
page for request [/welcome] as the response has already been
committed. As a result, the response may have the wrong status code.
If your application is running on WebSphere Application Server you may
be able to resolve this problem by setting
com.ibm.ws.webcontainer.invokeFlushAfterService to false
It's evident that in Spring Boot, manual configuration is not needed. So, how should I fix this error?
I am clueless how to fix. I configured the jsp resolver in application.properties.
spring.mvc.view.prefix=/WEB-INF/view/
spring.mvc.view.suffix=.jsp
I have tomcat-embedded-jasper in the pom.xml.

Spring Websocket and 404 status on connection

In a working Spring MVC 4.0.2 project running under Tomcat 7.0.50, I'm trying to implement Spring Websocket with simple broker and sockjs stomp endpoint, following the official reference. So, in the contextConfigLocation (DistpacherServlet property) I've add a value "websocket-config.xml" which contains:
> <websocket:message-broker application-destination-prefix="/app" >
> <websocket:stomp-endpoint path="/monitor">
> <websocket:sockjs />
> </websocket:stomp-endpoint>
> <websocket:simple-broker prefix="/topic"/>
> </websocket:message-broker>
In eclipse console (catalina log) when I start Tomcat, appear the rows
Initializing ExecutorService 'clientInboundChannelExecutor'
Initializing ExecutorService 'clientOutboundChannelExecutor'
Initializing ExecutorService 'messageBrokerSockJsScheduler'
Mapped URL path [/monitor/**] onto handler of type [class org.springframework.web.socket.sockjs.support.SockJsHttpRequestHandler]
In the jsp page I put the code
. . . .
var socket = new SockJS("monitor");
var stompClient = Stomp.over(socket);
. . . .
Unfortunately when I load the jsp page from Chrome (v32), I get this error:
Failed to load resource: the server responded with a status of 404 (Not Found)
http ://localhost:8080/(ProjectName)/monitor/info
Obviously I'm doing this test locally, then all other webapp resources are reachable at http ://localhost/(ProjectName) correctly.
What's wrong?
**** Update 20 Feb 2014
I've tried to follow this resolved stack question, which suggests to use Tomcat8 for Spring Websocket, unfortunately it doesn't work
Any log output on the server side as a result of the request to /monitor/info? How is the DispatcherServlet itself mapped? I would expect to "/" from what you have above.
The SockJS endpoint is basically a URL mapped in Spring MVC (with a SimpleUrlHandlerMapping) so try other Spring MVC mapped controller methods. And turn up logging, could there be a filter or something else returning the 404?
For those who struggle with this issue this might helps.
I had following in web.xml:
<servlet>
<servlet-name>rest</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>rest</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
And had 404 response for this url:
http ://localhost:8080/(ProjectName)/monitor
But this one works like charm:
http ://localhost:8080/(ProjectName)/rest/monitor
Cheers!

Adding Web App to WebSphere Liberty Profile via Eclipse plugin tools

I'm attempting to get an existing web application working with 'WebSphere Application Server Liberty Profile v8.5 Beta' using the 'IBM WebSphere Liberty Profile Tools for Eclipse'.
I have installed the developer tools for Eclipse as well as the liberty profile runtime by following instructions here:
https://www.ibm.com/developerworks/mydeveloperworks/blogs/wasdev/entry/download?lang=en#comment-1321558450546
I then proceed to create the Liberty Profile Server by following the instructions here:
http://publib.boulder.ibm.com/infocenter/wasinfo/beta/index.jsp?topic=%2Fcom.ibm.websphere.w4d.nd.doc%2Ftopics%2Frw4d_dirs.html
I add my web app to the server and start it with the following console output:
Launching TEST (was4d-1.0.0.20111202-0614/websphere-kernel_1.0.0) on Java HotSpot(TM) 64-Bit Server VM, version 1.6.0_26-b03
Boot properties: file:/home/tbuckley/work/WAS/was4d/usr/servers/TEST/bootstrap.properties
Config document: file:/home/tbuckley/work/WAS/was4d/usr/servers/TEST/server.xml
[AUDIT ] CWWKE0001I: The kernel was launched.
[AUDIT ] CWWKE0002I: The kernel started after 0.91
[AUDIT ] CWWKF0007I: A feature update is starting after 0.92 seconds.
[AUDIT ] CWWKZ0058I: Application monitor started after 1.218 seconds.
[AUDIT ] CWWKO0219I: TCP Channel http-default has been started and is now listening for requests on host localhost (IPv4: 127.0.0.1) port 9080.
[AUDIT ] SRVE9998A: Application myWebApp added to web container.
[AUDIT ] CWWKZ0001I: The application myWebApp has started successfully.
[AUDIT ] CWWKF0008I: The feature update is complete after 2.141 seconds.
When I hit the web app url http://localhost:9080/myWebApp/ via a browser I get a blank page and the following console info:
[ERROR ] SRVE0015E: Failure to initialize Web application myWebApp
If I reload the page I get the following:
[WARNING ] SRVE0274W: Error while adding servlet mapping for path-->/login/*, wrapper-->ServletWrapper[Application Servlet:[/login/*]], application-->myWebApp.
[ERROR ] SRVE0015E: Failure to initialize Web application myWebApp
I also have the following servlets/mappings under my web.xml:
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Application Servlet</servlet-name>
<url-pattern>/login/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
Any ideas what could be wrong here or how I could get more detailed debug info?
UPDATE
I just created a skeleton 'dynamic web project' there and put an index.html file in it. I added it to the liberty server and it worked by going to localhost:9080/simpleApp/index.html.
The exisiting dynamic web app I am trying to add is very large and complex.
I found the following under was4d/usr/servers/TEST/logs/ffdc/ffdc_12.02.16_16.40.33.0.log:
------Start of DE processing------ = 16/02/12 16:36:06:170 GMT, key = java.lang.NullPointerException com.ibm.ws.webcontainer.osgi.WebContainer 131
Exception = java.lang.NullPointerException
Source = com.ibm.ws.webcontainer.osgi.WebContainer
probeid = 131
S tack Dump = java.lang.NullPointerException
at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:142)
at com.ibm.ws.webcontainer.webapp.WebApp.initializeServletContainerInitializers(WebApp.java:1860)
at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:499)
at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:5437)
at com.ibm.ws.webcontainer.osgi.WebContainer.discriminate(WebContainer.java:1095)
at com.ibm.ws.webcontainer.osgi.WebContainer.discriminate(WebContainer.java:1009)
at com.ibm.ws.dispatcher.http.internal.channel.HttpDispatcherLink.ready(HttpDispatcherLink.java:143)
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:444)
a t com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleNewRequest(HttpInboundLink.java:378)
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.processRequest(HttpInboundLink.java:278)
at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.ready(HttpInboundLink.java:249)
at com.ibm.ws.tcpchannel.internal.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:174)
at com.ibm.ws.tcpchannel.internal.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:83)
at com.ibm.ws.tcpchannel.internal.WorkQueueManager.requestComplete(WorkQueueManager.java:502)
at com.ibm.ws.tcpchannel.internal.WorkQueueManager.attemptIO(WorkQueueManager.java:550)
at com.ibm.ws.tcpchannel.internal.WorkQueueManager.workerRun(WorkQueueManager.java:899)
at com.ibm.ws.tcpchannel.internal.WorkQueueManager$Worker.run(WorkQueueManager.java:981)
at com.ibm.ws.threading.internal.Worker.executeWork(Worker.java:398)
at com.ibm.ws.threading.internal.Worker.run(Worker.java:380)
at java.lang.Thread.run(Thread.java:662)
The spring setup in the web app appears to be causing some issue?
Thanks
Turns out it is an issue with Spring on certain platforms (WebSphere liberty 8.5 in my case).
Upgrading from Spring 3.1.0 M2 to Spring 3.1.1 fixes the issue:
https://jira.springsource.org/browse/SPR-8496

Resources