wood burning stoves 2.0*
The moose likes IDEs, Version Control and other tools and the fly likes JSP unable to find classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "JSP unable to find classes" Watch "JSP unable to find classes" New topic
Author

JSP unable to find classes

Peter Bergoff
Ranch Hand

Joined: Apr 07, 2004
Posts: 103
Hi everyone,

I recently started using a company to host a java web site. I have been unable to get my site running when I deploy on there virtual host. They use something called the NGASI Application Engine.

FYI - My code works in my development site on my computer.

I have uploaded my application. It's pretty straight forward stuff. The JSP pages are in the context root and the classes are in the WEB-INF/classes directory as they should be.

Whenever one of my JSP pages tries to call a class it can't find the class. This is the error I see on the web page:

An error occurred at line: 3 in the jsp file: /index.jsp
MLOGlobal cannot be resolved
1: <%@ page import="mlo.*" %>
2:
3: <% MLOGlobal.checkGlobalVariables();%>


When I check my log file this is the stack trace I see:

May 26, 2008 12:36:24 PM org.apache.jasper.compiler.JDTCompiler$1 findType
SEVERE: Compilation error
org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException
at org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader.(ClassFileReader.java:329)
at org.apache.jasper.compiler.JDTCompiler$1.findType(JDTCompiler.java:206)
at org.apache.jasper.compiler.JDTCompiler$1.findType(JDTCompiler.java:178)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:123)
at org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getType(PackageBinding.java:126)
at org.eclipse.jdt.internal.compiler.lookup.Scope.findType(Scope.java:1327)
at org.eclipse.jdt.internal.compiler.lookup.Scope.getTypeOrPackage(Scope.java:2351)
at org.eclipse.jdt.internal.compiler.lookup.Scope.getBinding(Scope.java:1568)
at org.eclipse.jdt.internal.compiler.ast.SingleNameReference.resolveType(SingleNameReference.java:797)
at org.eclipse.jdt.internal.compiler.ast.MessageSend.resolveType(MessageSend.java:310)
at org.eclipse.jdt.internal.compiler.ast.MessageSend.resolveType(MessageSend.java:344)
at org.eclipse.jdt.internal.compiler.ast.Expression.resolve(Expression.java:882)
at org.eclipse.jdt.internal.compiler.ast.Block.resolveUsing(Block.java:115)
at org.eclipse.jdt.internal.compiler.ast.TryStatement.resolve(TryStatement.java:751)
at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:432)
at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:190)
at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:403)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1047)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1094)
at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:353)
at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:596)
at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:411)
at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:413)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:308)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)


I have been trying to figure this out for a while. Any help would be really appreciated.

Thanks.

Peter
[ June 03, 2008: Message edited by: Peter Bergoff ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60822
    
  65

Where is the jar file for the mio.* classes?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Peter Bergoff
Ranch Hand

Joined: Apr 07, 2004
Posts: 103
Hi Bear,

I did not use a war or jar file. I have loaded the files directly into the context using the standard directory structure. That's how I've done it on my computer as well and it's worked.

Thanks for your help!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60822
    
  65

So you've placed the un-jarred class files for the mlo.* classes where?

P.S. Could you do all of our eyes a favor and used mixed case for your display name?
Peter Bergoff
Ranch Hand

Joined: Apr 07, 2004
Posts: 103
Hi Bear,

Per your request, case updated. : )

The files are placed in WEB-INF/classes/mlo.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60822
    
  65

Hmm, when i first looked at your post, I though that:

org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException

was a ClassNotFound exception.

I'm not familiar with Eclipse but I'd assume that this means that the class file is malformed in some way.

First thing that I'd try is to clean out all the class files and build from scratch. Meantime, I'm going to move this to the IDEs forum where the Eclipse-savvy hang out.
Peter Bergoff
Ranch Hand

Joined: Apr 07, 2004
Posts: 103
Thanks Bear!

Yeah, that is weird to see an eclipse type message. I have seen error messages due to jdk version mismatch between the eclipse used to compile vs. the tomcat app server's jdk. I developed using jdk 1.6.0_04 while the virtual app server only goes up to jdk 1.6.0_03, which is what it's currently set to.
[ May 28, 2008: Message edited by: Peter Bergoff ]
Peter Bergoff
Ranch Hand

Joined: Apr 07, 2004
Posts: 103
I deleted and reloaded my classes and it did find them. I didn't change anything but now it did work. Weird stuff. Thanks Bear.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JSP unable to find classes
 
Similar Threads
Very simple JSP with Scriplet
getting ServletException
Jboss Console Exception 'sun.misc.InvalidJarIndexException: Invalid index'
getting error when involking jsp file.
Unable to read TLD "META-INF/tld/tiles-jsp.tld" from JAR file