Tomcat deployment resource not found - java

I just deployed a web application to my server using tomcat manager.
When I'm running the web app locally I can get:
http://localhost:8080/CookEatWebApp/resources/ingredient SUCCESSFULLY
However, after deployment I get:
http://162.253.126.28/CookEatWebApp/resources/ingredient NOT FOUND
http://162.253.126.28/CookEatWebApp - this is working and showing the index.jsp page successfully.
What am I doing wrong?

The solution for this was to redeploy the latest code which contained the required controller

Related

Azure App Service with java or container returns only 404 when App Insights enabled

I wanted to deploy a built spring boot jar to Azure AppService, but the chosen mode with Linux did responded only 404 "Not found" (that looked like Tomcat error page) after deploy although I could see in logs the app had been deployed correctly.
During troubleshooting I changed the mode of AppService to the one with container image. But it did not help.
Then I found the 404 is caused by enabling the App Insights which causes adding a -javaagent:/agent/java/applicationinsights-agent-codeless.jar to JAVA_TOOL_OPTS env var.
The codeless variant is not available anywhere online so with some struggle I downloaded the jar to my local machine, set Insights connection string env variable and reproduced the error. With the applicationinsights-agent downloaded from github releases I got different error, but did not investigate further.
When enabled, App Insights worked as I could see it send traces etc. But it the HTTP routing in the app is broken therefore the App Insights is useless.
I don's see how I could fix this, so any advice is appreciated.
There can be multiple scenarios which is causing the issue:
In your case you are getting 404 error, because your jar file might not deploy properly in App Services which is causing this issue.
Check if the below steps help to resolve your issue:
Try restarting your App service.
You may be trying to manually push the jar file through FTP in App Service which basically causes the problem during deployment, because it basically a step of copying the jar file into Tomcat webapps directory.
So, you can deploy your jar file using maven plugin.
Below are the commands to configure and deploy the jar file in App Service of your spring boot application.
Command to configure the App Service:
mvn com.microsoft.azure:azure-webapp-maven-plugin:2.5.0:config
Command to package and deploy the jar file to App Service:
mvn package azure-webapp:deploy
I have tried in my environment and got expected results:
I have used the above-mentioned commands to configure and deploy the jar file to App Service.
I have enabled Application Insights and my application is working fine as expected.
I have also tried with Docker Container:
Enabled Application Insights:
Enabled Port 8080 by adding WEBSITES_PORT :8080 as a setting in Web App> Configuration>Application settings.
Output:

Tomcat does not compile jsp in work directory

I am migrating a Spring-Boot application to a new server (Amazon-Linux). I could not deploy the application using Tomcat manager. Uploading the ROOT.war using the manager fails.
So, I deployed the application by manually uploading the ROOT.war. At first, it seemed that the deployment went well, the first page of the application (login) was loading. But after submitting the credentials, the application is not redirecting me to the home page. After investigation, it turned out that in the work directory (work/Catalina/............../WEB_002dINF/jsp/) there are only two files (my_login_jsp.class, my_login_jsp.java). So, does that mean compilation for other jsp files are being failed?
Please advise how this can be fixed?
Found the solution. There is something wrong with the Tomcat package that comes with amazon-linux-extras.
After removing the aws package, now I am using Tomcat downloaded from the official website. The is working perfectly.

Tomcat in Eclipse is giving error 404:requested resource not found

I am making a project in Java which is a online web application. I am facing issues with Tomcat 8 and jsp, if I try to run my jsp files on server it gives an error that 404:requested resource now found.
I tried every way given on you channel but nothing helped. Now I'm at an stage I have configured the server 100 times and nothing helps. I created a new project on other workspace and copied everything there and then run those jsp files it executed well for once and then after that when I stopped the server it again started giving the same error.
Whenever I restart the server the server does not start and gives error Tomcat failed to start and then when I remove my project below the server name it starts. If I configure new server same happens.
I can't figure out where the problem lies as earlier I was able to run my project using same Eclipse Luna IDE.
Based on your question, it seems you need to configure eclipse to take control from Tomcat.
Maybe this can help as well: HTTP Status 404 - The requested resource (/) is not available

NoTargetForURIException While deploying application on Websphere with IntelliJ

i tried many times to deploy my jee application using intelliJ on Websphere 8.5 the compilation goes well untill i get this error on browser :
Error 404: com.ibm.ws.webcontainer.servlet.exception.NoTargetForURIException: No target servlet configured for uri: /RootServlet
everything is well configured on web.xml, welcomefile - servlet name - and servlet mapping
Is there anyone who can help me with this issue ?
Ps : i'm using websphere 8.5.5.11 Developer
Well, i figured it out: localhost:8080/myappname_war_exploded, and in my application.xml in my WAR I had myappname, so just deleting the _war_exploded resolved the issue.

FAIL - Deployed application at context path /RxCircle but context failed to start

FAIL - Deployed application at context path /RxCircle but context failed to start
The module has not been deployed.
at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:210)
at org.netbeans.modules.maven.j2ee.ExecutionChecker.performDeploy(ExecutionChecker.java:173)
at org.netbeans.modules.maven.j2ee.ExecutionChecker.executionResult(ExecutionChecker.java:125)
at org.netbeans.modules.maven.execute.MavenCommandLineExecutor.run(MavenCommandLineExecutor.java:202)
at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
i am using tomcat 6
netbeans 7.0
java 6
i am getting this error when i am running my application in netbeans..
I suspect that either (1) Your web.xml is missing, (2) your applicationContext is malformed or (3) your versions are not playing nicely together.
Since you are using Netbeans you can view the Server Log by doing this:
Open the Services window (if it is not open go to: Window > Services)
Right-click on the Tomcat Server and select View Server Log.
Now you can see the actual exception that is causing Tomcat not to deploy your war.
This is a very generic error message and can be due to any reason like wrong servlet filter defined or malformed application context file.
To understand fully you need to get more logging details from tomcat.
So set the logging level to debug in tomcat and then start the tomcat.
Below url you may refer for further details
http://tomcat.apache.org/tomcat-6.0-doc/logging.html
How to set level logging to DEBUG in Tomcat?
Hopefully you will get more details about the deployment error root cause.
Try stopping the Tomcat server so as to allow Netbeans to run it. If the server is already running when Netbeans tries to deploy an app Netbeans will display the delopy failed message.
I had the same issue. I was using Java 8, Tomcat 8, NetBeans 8.1.
What I did was, I manually replaced:
1. nbproject/build-impl.xml
2. web/WEB-INF/web.xml
with a previous version of the files. Please make sure to have backups.
I have faced same issue
I searched lot of solutions but not worked
If you are facing the same problem then the solution is
First you have backup your web.xml code file from your
project NetBeanss
Now delete web.xml from project
Now right click on web-inf file chose web after that chose deployment descriptor
After that
Now you can run your prj check your solution is solve as context will run on localhost server
Afte thaer will some error because we can't save our servlet file link so do it
Run it
Now you will see your problem solve
It's worked for.me

Categories

Resources