• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

How do I run maven-based web app JSP?

 
Ranch Hand
Posts: 549
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This question should appear stupid but really i just can't run my jsp page after did the proper maven configuration.

When I start my tomcat, it just gives me a HTTP 404 error and said the resources are not found.

I hope someone can tell me what could be the cause.

Another strange thing is, now after started tomcat, when I right click on the jsp, Eclipse just shows run configuration, and the usual run java Application is missing.

BTW, I did not add in other java classes and other mvc stuff cos I just want to see if the bootstrap template will render on the jsp.

Hope to get some advice here.

Tks.
 
Saloon Keeper
Posts: 5776
146
Android Mac OS X Firefox Browser VI Editor Tomcat Server Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the Maven angle on this? Maven would just create the war file, which you would then deploy. It isn't involved at runtime.

What we need to know is what URL you're trying to access, and how the resource behind it is mapped.
 
tangara goh
Ranch Hand
Posts: 549
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Managed to resolve this.

But, I find it puzzling cos I have to pull out all the Bootstrap template's css font etc and put it under src/main/webapp, along with all the jsps.  It is just not able to work with all these files placed in a Bootstrap folder and reference from there, even though it is also under the same directory - src/main/wepp.

Any idea Tim?
 
Bartender
Posts: 21004
128
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this for a stand-alone Tomcat, or a Spring Boot Tomcat?

Not that I expect that much difference, but obviously there's some - Spring Boot webapps are self-deploying.
 
tangara goh
Ranch Hand
Posts: 549
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Tim Holloway wrote:Is this for a stand-alone Tomcat, or a Spring Boot Tomcat?

Not that I expect that much difference, but obviously there's some - Spring Boot webapps are self-deploying.



This is using stand-alone Tomcat, and here's a snippet of the .war file generated by Maven :

Please find attached.

I wonder if it is correct ?

.war-how-bootstrap-files-appear.jpg
[Thumbnail for .war-how-bootstrap-files-appear.jpg]
 
Saloon Keeper
Posts: 2690
343
Android Eclipse IDE Angular Framework MySQL Database TypeScript Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rather than opening the war file in the editor as a text file, use the jar command from the command line to show the contents of your war file

For example:
 
Tim Holloway
Bartender
Posts: 21004
128
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think that your Bootstrap files should go directly under /src/main/webapp, but that's just an intelligent guess, since I don't know the product.

Your screenshot doesn't show any JSPs at all, so we can't tell. Also we'd need to know what the URL is that you are using to try and get the JSP.

The best way to list the index of your WAR is to use the JAR utility program to list the JAR directory and copy/paste the text from that listing between Code tags in our message editor. Raw graphic snapshots can be very hard to read.
 
Police line, do not cross. Well, this tiny ad can go through:
create, convert, edit or print DOC and DOCX in Java
https://products.aspose.com/words/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!