Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Import class not working for Servlet

 
Mike Jenkins
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to get my first import to work in Tomcat 5.5 container but it is giving me error.

Here is my Controller:


Here is my bean file:


My JSP called Third.jsp:


I mapped in the web.xml so it should show on the web as:
http://127.0.0.1:8080/test/First

My error:

java.lang.NoClassDefFoundError: First (wrong name: beans/First)



My First.java is located in Tomcat 5.5 Home\webapps\test\WEB-INF\classes and the bean is located in Tomcat 5.5 Home\webapps\test\WEB-INF\classes\beans. My jsp is located in C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\test


Please advise.
[ July 23, 2006: Message edited by: Mike Jenkins ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64631
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your import is not valid. You cannot import a package, you must import classes.
 
Mike Jenkins
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please advise how I do that?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64631
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Same way as for Java classes.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to either list each class explicitly:


or, to import all beans in a package, you can use the wildcard (*):
 
Mike Jenkins
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks to both of you.
It now works.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic