0

I'm returning to Spring after a long absence and I'm trying to get a simple web app up and running on Tomcat 6.0 with Hibernate as an ORM.

The error I am getting is:

SEVERE: Servlet.service() for servlet mvc-dispatcher threw exception java.lang.ClassNotFoundException: org.apache.jsp.WEB_002dINF.view.viewAllEnquiries_jsp 

It runs through my controller fine:

@Controller @ComponentScan("com.intl.cigna.ecommerce.dao") public class EnquiryController { @Autowired private EnquiryDao enquiryDao; @RequestMapping("/viewAllEnquiries") public String getAllEnquiries(Model m) { List<Enquiry> enqs = enquiryDao.getAllEnquiries(); m.addAttribute("SEARCH_ENQUIRIES_RESULTS_KEY", enqs); return "viewAllEnquiries"; } } 

But for some reason it appears not to compile the jsp. As when I rename or delete the jsp it cannot(obviously) find it.

The web.xml for the dispatcher is:

 <servlet> <servlet-name>mvc-dispatcher</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>mvc-dispatcher</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping> 

I must be missing something obvious...

2
  • Which view resolver configuration are you using? Where do you physically keep your JSP file? Commented Oct 3, 2012 at 14:44
  • I'm using org.springframework.web.servlet.view.InternalResourceViewResolver And the jsp's are in: <property name="prefix"> <value>/WEB-INF/view/</value> </property> As per the view resolver config. Commented Oct 3, 2012 at 14:46

2 Answers 2

2

Just a guess - but it looks like the JSP might not contain valid java code (missing imports and stuff) - so the JSP won't compile to a servlet and you will get the ClassNotFoundException.

Check the catalina.log file to see if there are compilation errors you are missing.

Sign up to request clarification or add additional context in comments.

6 Comments

It appears not to create a log when running via Eclipse WTP, apart from what is in the console output.
Did you check under `<workspace-dir>\.metadata\.plugins\org.eclipse.wst.server.core\tmp1`?
Also, can you change your JSP to be a simple "hello world" html?
ok, a bit of progress. If I remove the jstl libraries(javax.servlet.jsp.jstl and org.glassfish.web) from the pom and make a simple Hello World jsp then it works. It's as if the jstl is causing the error, so suspected a corrupt jar. But removed them from the repository and rebuilt it, but still errors.
Check the war being created - see if the jstl jar is included under WEB-INF/lib - my guess is that the construction of the war is the problem and the jar is simply missing from the classpath.
|
1

Make sure you have the all the jstl, servlet and jsp dependencies in your pom/ class path:

 <!-- Servlet --> <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.5</version> <scope>provided</scope> </dependency> <dependency> <groupId>javax.servlet.jsp</groupId> <artifactId>jsp-api</artifactId> <version>2.1</version> <scope>provided</scope> </dependency> <dependency> <groupId>javax.servlet.jsp.jstl</groupId> <artifactId>jstl-api</artifactId> <version>1.2</version> </dependency> <dependency> <groupId>org.glassfish.web</groupId> <artifactId>jstl-impl</artifactId> <version>1.2</version> </dependency> 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.