views:

59

answers:

2

I have project in with 2 separate modules(frontend and backend, first depends on second). When I'm trying to access backend code from frontend code, things going fine. Things turn for the worse when I do the same from jsp.

This is stacktrase for simple accessign a bean:

 <jsp:useBean id="mybean" class="backend.main.MyBean" scope="request"></jsp:useBean>


org.apache.jasper.JasperException: /results.jsp(9,0) The value for the useBean class attribute backend.main.MyBean is invalid.

org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40) org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407) org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148) org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1220) org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1178) org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361) org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2411) org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2417) org.apache.jasper.compiler.Node$Root.accept(Node.java:495) org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361) org.apache.jasper.compiler.Generator.generate(Generator.java:3416) org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:231) org.apache.jasper.compiler.Compiler.compile(Compiler.java:347) org.apache.jasper.compiler.Compiler.compile(Compiler.java:327) org.apache.jasper.compiler.Compiler.compile(Compiler.java:314) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260) javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

And this error will appear if I try to access regular class:

An error occurred at line: 12 in the jsp file: /results.jsp
backend.main.RegularClass cannot be resolved to a type

Stacktrace:

org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)

org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330) org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439) org.apache.jasper.compiler.Compiler.compile(Compiler.java:349) org.apache.jasper.compiler.Compiler.compile(Compiler.java:327) org.apache.jasper.compiler.Compiler.compile(Compiler.java:314) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260) javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

Sorry for so many stacktraces.

UPD: Even if I access bean from same module and that bean refers to some class in another module program fails.

A: 

Can you paste code from your class? Just the package name and constructors should be enough

Is your class having a default constructor with no arguments? I suspect it is not having any default public constructor.

Gala101
When I tried to solve problem myself I'd created mock version of this 2 modules with 2 classes with same code (simple beans with get/set methods). And when I refered from jsp to class in the same module everithing worked, in case of second class in another module app failed with stacktraces in OP-post.P.S. Both have public constructors.
Jeriho
+1  A: 

Are the classses of the backend module really deployed ? Not all dependencies are automativcally bundled in WAR. Check frontend module dependencies, if they are exported and consider looking in afrtifact's layout. First of all I'd check WAR contents in target directory.

binary_runner