views:

24

answers:

1

I'm trying to a simple thing: instantiate a normal Java Object from a JSP deployed in the default domain on GlassFish. GlassFish can never seem to find the class so I keep getting NoClassDefFoundErrors. The JSP is found, but not the classes. I have put copies of the package directory containing the class everywhere, in almost every directory under domain1(the default domain I'm using) but still nothing. Here's the directory structure:

C:/glassfishv3/glassfish/domains/domain1
  lib/
  docroot/

     testJsp.jsp
     WEB-INF/
        web.xml
        classes
           betterpack
               TestJavaClass.class
                  int doStuff()
  config/

in testJsp.jsp it does this:

     <%  betterpack.TestJavaCLass tj1 = new betterpack.TestJava(startClass) %>
     then later:
     <%=tj1.doStuff()%>

I get a no ClassDefFoundError on the line of the instantiation. I also put copies of the betterpack directory in almost every other directory like the lib/ directory under docroot, in the docroot... nothing. Oh I figured that the contextpath is actually in config because when you write to a file, it ends up in the config directory so I put a copy of the betterpack folder there too. What could be the problem?

+1  A: 

<% betterpack.TestJavaCLass tj1 = new betterpack.TestJava(startClass) %>

Do you really have TestJava.class file in WEB-INF/classes folder ? As per your dir structure, you don't have such a class file.

chedine
Also, `TestJavaCLass` != `TestJavaClass`.
BalusC