spring-mvc-404 page not found error in maven project - spring

I have been trying to understand and clone the spring mvc login and registration process. As far as I know I am following the same code and process. Only thing I have changed is database details.0 Which works fine I am able to insert the data into the MySQL (8.0.27) database using test file. I am getting the same error even when I am trying his code I am getting error.
here is my code: https://drive.google.com/drive/folders/1JNkZp_O1Lh0y_1NdZ-A85KI1gfgy0_Em?usp=sharing
here is GitHub code: https://github.com/javabyranjith/spring-framework-mvc/tree/master/springmvc-userlogin
Errors I am getting:
action keyword in form was giving error "element loginProcess is not found"-> so I changed it to the form action then it worked
The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.
my questions are
can a different version of Apache Tomcat(10.0.13) server can cause the issue?
since I am using new Eclipse so I have updated the new libraries can this cause the issues?
Please suggest the changes so that I can run this project. Suggest the changes here or directly change it in the google drive folder.

Tomcat 10 does not work with Spring 5. Downgrade to Tomcat 9.
10th has jakarta packages renamed from javax, which spring 5 does not support.
Friendly advice, if you are using code from git, they left versions of stuff like java and tomcat for a reason, and the newest versions like Tomcat 10 and JDK17 went through a lot of changes, so always try with suggested versions and try to migrate them to higher ones. Except for Tomcat 10, you will have to wait for Spring 6 for that.
As for the new eclipse, it does not make any difference, the maven project is still the maven project, src, and pom.xml, the structure remained the same.
First try with suggested versions then you can ramp them up once you are sure that it is working.

Related

War file working on my PC but 404 error with older Tomcat

I had to develop an app with Flutter for my dissertation. The app was an update and an extension of an old app devepoled by another student of my university, 2 years ago.
He developed also the backend that was written in Java using Spring and Maven.
Developing my app, I had to do some changes and additions in his code.
Some days ago I tried to export the backend project as a war file compiling with the JDK 15 (during the developing I used the Intellij's build-in Tomcat to test the new features) and I did the deploy on my Tomcat and I got error 404.
After reading many posts about this error on this site I found the solution by simply installing and compiling with java 12.
At that point, excited by the idea of finally being able to use my application and start the tests necessary for my thesis, I deployed the same war file to the Tomcat running on university server and I got error 404 again:
"HTTP Status 404 - /backend-api/
type Status report
message /backend-api/
description The requested resource is not available.
Apache Tomcat/7.0.52 (Ubuntu)"
I tried to install the same JDK (1:7:0 79) that was used by the developer of the backend during his dissertation, but the problem wasn't solved.
In the second anwser of this thread it seems that they are talking about a similar problem, the point is that I can't modify any setting of the server of my univeristy and, right now, I can not even access to the logs of Tomcat.
I think the problem may be an outdated version of the JDK or Tomcat running on the university server.
But what seems strange to me is that the old version of the backedn is still running on that server and working without problems, and I have not made any changes to the configuration files, but only added a couple of functions.
Do you have any suggestions for me to solve the problem or understand what the cause is?
In a few days I should graduate and without my backend the application is not usable.
On my PC i deployed the war file on Tomcat 7.0.107 with JVM version 1.8.0_271-b09, while the university is running Apache Tomcat / 7.0.52 (Ubuntu) with JVM version 1.7.0_79-b14.
Thanks a lot to anyone who takes their time for trying to help me.

Spring-shell along with spring-boot NullPointerException

I am trying to build a simple app using spring boot and spring shell . My pom.xml is like this:
I am getting the below error when trying to connect to the shell using putty
I am not able to get any pointers.
Putty I downloaded for windows. Trying connecting using user as username, password shown in console, port 2000. Logs says authentication successful. Still a NullPointerException
I am using jdk 1.8 only. Not jre.
There are many open issues on this field right now. One of them is your same issue but specific for macOs, i do not have windows, but perhaps you can reproduce it same way and comment on that jira.
You can check it here:
https://jira.exoplatform.org/projects/CRASH/issues/CRASH-252?filter=allopenissues
If you want to use it, you should return to an older version better :)
Good luck!

How to get rid of this error when starting Tomcat

I am adding some things in an existing Android app, which connects to a Apache Tomcat server to get information from a database, but some of the changes required that I also make minor changes on the webapp (changing some database fields).
I had never used tomcat, but managed to do the simple changes here and there.
But when I deployed it, I noticed some errors(see the photo).
How can I fix them ?
The app works regardless of them, but the server takes a few more seconds to start up.
P.S.I read somewhere that this means that the server already has these libs, and doesnt need to use the ones from the lib folder of the app ?

sonar not working with maven-2.0.9. is there a workaround for /batch_bootstrap error?

I installed sonar-3.7.2 without issue. I have it working properly with oracle. I can analyze maven-3 projects from a client machine on the same network as the sonarqube server.
The docs says it supports maven-3.x and maven-2.2.x. We are in the process of upgrading projects to maven-3 but many of our projects still use maven-2.0.9. I was hoping that the 2.2.x condition was merely due to what people were testing with and not a real limitation but some newly downloaded poms in my artifactory contain the property maven.min.version set to 2.2.1.
I need a version that will work with maven-2.0.9.
I saw a log from one of my coworkers also trying out sonar and it showed maven-2.0.9 was being used successfully. He is using defaults. I am setting up for production.
The error that I get (cleaned up of course):
Caused by: org.sonar.api.utils.HttpDownloader$HttpException: Fail to download [http://myhost:myport/batch_bootstrap/properties?project=mygroupid:myartifactid]. Response code: 400
I have tried sonar 3.7.2, 3.6.3 and 3.5.1 and get the same error in each case. In each case
analyzing a maven-3 project works (to prove everything else is ok)
I have tried adding the webcontext /sonar instead of just /.
I have tried setting the Server base url in the sonarqube server even though I have not tested anything yet related to sending emails.
I saw something about corruption in the local .m2 on another thread. Removing it did not help either.
Any and all suggestions appreciated.
Best Regards, Gord Cody
I think the documentation is quite clear : http://docs.codehaus.org/display/SONAR/Installing+and+Configuring+Maven
SonarQube supports only Maven 2.2.x and 3.x
But my question is : What's the problem to upgrade from maven 2.0.9 to 2.2.x?

A good strategy for knowing the versions of deployed applications?

In order to know which revision number the application is built from, we use to give the ears we deploy to Glassfish names like myapp_2012-01-20_rev22123.ear. Then we can simply login to Glassfish and see what version is deployed in the web interface (as the appname is the name of the ear file). A downside of this approach is that we need to do a manual undeploy/redeploy to update the name...
But I would like to script the undeploy/deploy process, and having each version of an ear get a different name is not very suitable to scripting this redeployment process. Glassfish 2 does not support the "list applications" goal that Glassfish 3 has, which I could have used to retrieve the application name to undeploy.
So is there any good strategy that will easily allow us to see what version is deployed of an application, and that does not suffer from the above fault?
It would be preferable if this meant we did not have to change the existing applications (like add a jsp page or something to show the current scm revision), but a change in a Maven build script would be acceptable.
I faced a similar issue, I finally came around it by using maven-buildnumber-plugin and writing a simple servlet to get build information. You can find the details in the blog post I made.
Why not use the built-in GlassFish Server versioning to assign a version number at deploy time? This will also enable you to rollback to prior versions. For example:
asadmin deploy --name MyApplication:2012-01-20_rev22123 MyApplication.ear
There is more information on application versioning here:
http://docs.oracle.com/cd/E18930_01/html/821-2417/gihzx.html#gkhhv
Hope this helps.

Resources