Netbeans 8.2. Maven webapplication won't run on Tomcat but will on Glasfish server - maven

I am developing a simple restful server and want to deploy it on a Tomcat server. When I deploy the project it won't run and gives me the message: http 404, The requested resource is not available.
The project is a default, newly created Maven project and when I select Glasfish it runs fine. Can anyone give help me to find out what I am doing wrong?

I found the problem myself. For anyone struggling. Java Jax-RS doesn't run default on Tomcat. You need Tomcat EE or add EE to Tomcat.

Related

ERROR The requested URL could not be retrieved after deploying in external tomcat server

I am using Spring boot to create a REST API. The API is perfectly working when I am running the project. It works for all the endpoints that I have created. However, When I deploy the application in an external tomcat I am shown an error just like the following image
But The same endpoint was working before getting deployed into tomcat.
I am unable to figure out where the problem lies. I am using
Java 8, Oracle 12C, tomcat 8.5 .
Same Problem when I used Tomcat 10
I found the issue. I accidentally forgot to mention the war file/application name which must be added.

Running Spring boot application in IntelliJ gives white label error

I am trying to run Spring boot web application in IntelliJ which gives me whitelabel error. However, I am able to run the application with eclipse and also external tomcat server.
I have the context mapping available where it is returned from the application but webpage always shows WhiteLabel Error 404.
Please suggest how does the same application works in eclipse and external tomcat but not with IntelliJ.
I am using IntelliJ community edition v 2020.2.3
web pages are available in webapp folder.
First download xammp server to your machine. Then run your spring boot application. I used this method to run my spring boot application. But keep in mind that IntelliJ community doesn't directly support to spring-boot. You have to use IntelliJ ultimate for that.

Spring boot WAR deployment to tomcat

I have recently started packaging my application as a war.
I have noticed whenever I deploy the application within tomcat, 404 errors are now placed into tags, where as when deploying as a standalone, the _body response would be in JSON. Does anyone know why this is happening?
Within the tomcat on a war deployment I get the return _body:
<.!doctype html><.html lang="en"><.head><.title>HTTP Status 404 – Not Found<./title>
On a standalone deployment the return _body =
"{"timestamp":"2018-06-26T18:28:38.731+0000","message":"04ed1a7a-729d-48d7-b306-8e9ff6d7a2e0","details":"uri=/api/userSecurity/login","status":4011003}"
Is there maybe some sort of tomcat setting that is causing this?
Thank you
The user solved the problem by preparing the application with bootstrap to be deployed in tomcat as explained here.

How to create deployable springboot war

I am trying to create a maven spring boot application to be deployed in Tomcat. I am following what is suggested in Spring docs and other stackoverflow suggestions- war, Application.java extending SpringBootServletInitializer, removing spring-boot-maven-plugin from build plugins etc. War file is generated and is deployed in tomcat. But what I found is all static files are packaged under /WEB-INF/classes folder and I am not able to access the page. My project structure is as below:
Can anybody tell me how I can package the war properly to be deployed in Tomcat.
That doesn't change anything.
If you put your static assets in src/main/resources/static (and they end up in WEB-INF/classes/static), Spring Boot will serve them properly. So a src/main/resources/static/foo.png will be available at http://localhost:8080/your-context/foo.png if the context of your webapp is your-context.
Regarding the configuration, you can also go on start.spring.io, click advanced and chose war and you'll get an empty project pre-configured.
Or you can click this: https://start.spring.io/#!packaging=war
The issue is because of version issue. I compiled the application with Java 8 and deployed it in tomcat running under JRE 7. It may help someone facing the same issue.
I got the clue from the below post:
Spring boot war file deploy on Tomcat.

Deploy spring app in Websphere get Error 404: SRVE0190E

I'm trying to deploy a spring + angularJS app (packaging as war) into websphere (7.0.0.25), but even for the sample app I cloned from spring, I always get Error 404: SRVE0190E: File not found. And even for the spring app, I have to explicitly specify index.html in the URL, otherwise I get the same error. But the angular side is tolerable, can anyone help me with the spring side?
The sample application is: https://github.com/spring-guides/gs-convert-jar-to-war-maven.git
After doing "mvn clean package" in "/gs-convert-jar-to-war-maven/complete" to get the war, I follow the steps here to upload and deploy the war in websphere:
http://www.packtpub.com/article/deploying-applications-on-websphere-application-server-7.0-part1
I also tried this post to set the custom properties but still didn't work: http://frightanic.com/software-development/solution-to-error-404-srve0190e-on-websphere-6-1/
Also, both my app and the sample spring app don't have a web.xml as spring will take care of it. Both apps work fine in jetty and Tomcat. Only websphere has the problem. Besides, I don't know how to manually configure a web.xml if that will be the solution (need to be pointed to more resources).
The URLs I tried but failed to access the app are:
localhost:9080
localhost:9080/gs-convert-jar-to-war-0_1_0_war
localhost:9080/someAppName
Thanks in advance!
It turns out that websphere 7 doesn't support some spring annotations/classes. My solution is to write a web.xml file and turn off spring auto-configuration.

Resources