Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HelloWeb is not working in Tomcat 6

 
shai ban
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Created my first Spring MVC HelloWeb service based on http://www.tutorialspoint.com/spring/spring_web_mvc_framework.htm. I am running it in Tomcat 6. Added the below spring 3.2 jars into Tomcat's lib folder:

NOTE: Not able to attach. Please download the war file from the link http://www.sendspace.com/file/r6q5kb

commons-logging-1.1.3.jar
jsp-api.jar
servlet-api.jar spring-aop-3.2.3.RELEASE.jar
spring-aspects-3.2.3.RELEASE.jar spring-beans-3.2.3.RELEASE.jar
spring-build-src-3.2.3.RELEASE.jar spring-context-3.2.3.RELEASE.jar
spring-context-support-3.2.3.RELEASE.jar spring-core-3.2.3.RELEASE.jar
spring-expression-3.2.3.RELEASE.jar spring-instrument-3.2.3.RELEASE.jar
spring-instrument-tomcat-3.2.3.RELEASE.jar spring-jdbc-3.2.3.RELEASE.jar
spring-jms-3.2.3.RELEASE.jar spring-orm-3.2.3.RELEASE.jar
spring-oxm-3.2.3.RELEASE.jar spring-struts-3.2.3.RELEASE.jar
spring-test-3.2.3.RELEASE.jar spring-tx-3.2.3.RELEASE.jar
spring-web-3.2.3.RELEASE.jar spring-webmvc-3.2.3.RELEASE.jar
spring-webmvc-portlet-3.2.3.RELEASE.jar

But still the url "http://localhost:8080/HelloWeb/hello" is giving HTTP 404 error (The requested resource is not available)!!!
Anybody?

Thanks.
 
shai ban
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Spring libraries I added through setting a USER DEFINED variable.
And when I deploy the application in the eclipse's embedded tomcat server, then it is working fine!!! I am not able to get it why it is not working in earlier case?
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You shouldn't use either approach. Such libraries should go into the WEB-INF/lib directory of your web app (apart from the servlet API and JSP API, which are included in the Tomcat distribution and should not be moved or included anywhere else).
 
Nam Ha Minh
Ranch Hand
Posts: 502
Eclipse IDE Firefox Browser Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's giving HTTP 404 probably means that you configure the controller's URL mapping improperly. I only can guess because you still keep your code in secret.
 
shai ban
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nam Ha Minh wrote:It's giving HTTP 404 probably means that you configure the controller's URL mapping improperly. I only can guess because you still keep your code in secret.


Mapping is not wrong. It is working in Tomcat embedded in eclipse!!! For code I have shared the spring source url.
 
shai ban
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ulf Dittmer wrote:You shouldn't use either approach. Such libraries should go into the WEB-INF/lib directory of your web app (apart from the servlet API and JSP API, which are included in the Tomcat distribution and should not be moved or included anywhere else).


Then you will end up separate copies of libraries in each web application. I doubt this is correct practice?

2nd thing, even I move apps what you said then also what is the difference between both methods? why it is working when deploying directly in the Tomcat embedded in eclipse.

Thanks.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64824
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Few people are going to download your code. It'd be best if you post the configuration here.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64824
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
shai ban wrote:Then you will end up separate copies of libraries in each web application. I doubt this is correct practice?

It is most certainly a good practice. That makes each web application modular and not dependent upon others or arbitrary external dependencies.
 
shai ban
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Still not clear. Please comment!!!
 
shai ban
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Worked. May be because of log4j.xml where I didn't include the DOCTYPE declaration.

NOTE: I just reverted the log4j.xml again but the error didn't come again!!! Means, still we don't know why that error was coming.
Please let me know if anybody has idea.

Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic