I am developing a Dynamic web project. Project is running well on local server but not on live. On live server it throws exception at the line I have used any java object:
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: 7 in the jsp file: /groups.jsp
CollectionAppService cannot be resolved to a type
4: <%
5: String json = "[]";
6: try {
7: CollectionAppService collectionAppService = new CollectionAppService();
8: json = collectionAppService.getGroupsJson();
9: } catch (Exception e) {
10: e.printStackTrace();
Project run on local server but also have errors in error log for max class files:
Error:
Thu Sep 20 01:16:11 GMT+05:30 2012
File not found: /Users/sukhpal/Data/Workspaces/J2EE Workspace/CollectionApp/build/classes/com/mut/service/common/Constants.class.
Please help.(Tomcat is enabled on my live server).
Following is link of live server http://mutmanager.com/webservice/groups.jsp
It looks like you forgot to import your CollectionAppService
in your JSP:
<%@ page import="your.package.CollectionAppService" %>
But, there is a major problem, you should not put Java code in your JSP. Instead, you should move your code to a class and invoke it from a Servlet or similar.
Main article for this:
Do not forget that learning is good, but also learning in the right way.
After read your question again, I see this Stacktrace line:
File not found: /Users/sukhpal/Data/Workspaces/J2EE Workspace/CollectionApp/build/classes/com/mut/service/common/Constants.class
I guess that your problem is Constant
class (and your CollectionApp
as well) is inside a project B. You're using absolute path references from another project that contains these classes and maybe you're not uploading it.
Imagine this situation: You have a web project (project A) and you have some classes that already do a heavy and fancy job in another project (project B) that you reuse on most projects you work on. In your development environment, you have a reference from project A to project B, but then you only upload project A to your production environment. In this way, when project A wants to call a class from project B, it will never find it, and the exception is thrown.
The best solution:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With