Re: Problems running pre-compiled JSP classes when in subdirectories

2004-01-12 Thread Jules Gosnell
Larry Isaacs wrote:
There is a choice when pre-compiling JSPs.

1. Compile to real servlets.  This involves precompiling
   the JSPs to classes and adding mappings to the web.xml
   so they execute just like other servlets.  This
   cuts the JspServlet out of the picture and the JSPs
   are executed the same as other servlets.
2. Pre-populate Tomcat's work directory.  This also involves
   precompiling the JSPs to classes, under the work
   directory, but continues to use the JspServlet to execute
   the JSPs.
The critical point is that the expected packages to which the
JSPs are compiled are different between these two choices.
The JspServlet expects every JSP to be compiled into the
org.apache.jsp package.  Thus, every index.jsp is expected
to be compiled as the org.apache.jsp.index_jsp class, even though
the class file may be in various subdirectories, for example
dir.  The JspServlet avoids the obvious naming collisions
by loading each JSP class into a separate classloader. (Nice
trick, but can make life tough for debuggers.)
For choice 1, the JSPs need to be compiled into a directory
structure where the package matches the directory structure
in the standard Java way.  Each JSP's fully qualified class
name would need to be unique and entered into the web.xml.
I have a requirement for this precompilation mode (1) on TC 4.1.29.

5.0.x seems to have been patched to do this (preserve the 
directory/package structure of the original jsp src) , but fixes do not 
appear to have been merged back into 4.1.x and are unfortunately tangled 
up with a number of other changes to 5.0.x.

I guess I am therefore looking for a patch to the 4.1.x branch. I'd be 
very grateful if anyone here would furnish me with one. Otherwise I 
shall probably have to put one together myself, in which case I shall 
post it here if anyone is interested.

Thanks for your time,

Jules


The error below appears that the index.jsp in question has been
compiled sort of per choice 1, but is being run under choice 2.
The class file appears to be at the right location under the work
directory, but it was compiled to the wrong package, i.e.
the package includes dir, when it shouldn't.
I don't use JspC, so I can't help much with respect to its use.
I'm currently not sure about its usability state in the various
Tomcat releases. In the past, it has had difficulting getting the
package right in the context of these two choices.  I would think
that in the current releases, it can be coaxed into doing the
right thing for one or both of these choices, but I can't say
much more than that.
However, I have used the Ant jspc task along with the javac task
to accomplish choice 2 without much difficulty in a number of
different Tomcat 4.1 releases.  I would assume there would be no
problems as well in the current Tomcat 5 release, but I haven't
actually tried it yet.
Cheers,
Larry

-Original Message-
From: Antony Paul [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 07, 2004 8:46 AM
To: Tomcat Users List
Subject: Re: Problems running pre-compiled JSP classes when 
in subdirectories

The generated servlets are not put in a package. When Tomcat 
is compiling
JSP it is put in org.apache.jsp. How to set this in the jspc task.
The files are generated as usual in the work directory in the 
same structure
as Tomcat itself compiles JSP files.

Antony Paul
- Original Message -
From: Ralph Einfeldt [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Wednesday, January 07, 2004 7:06 PM
Subject: RE: Problems running pre-compiled JSP classes when in
subdirectories
May be you should have a look at the following:

- the package statements in the generated source files
- the file structure of the generate class files

-Original Message-
From: Jay Glanville [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 07, 2004 2:20 PM
To: 'Tomcat Users List'
Subject: Problems running pre-compiled JSP classes when in
subdirectories


Here's my application's background.  I have two files:
 WEBROOT/index.jsp
 WEBROOT/dir/index.jsp
java.lang.NoClassDefFoundError: org/apache/jsp/index_jsp 
(wrong name:

org/apache/jsp/dir/index_jsp)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
at java.lang.ClassLoader.defineClass(ClassLoader.java:448)
at
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
/**
 * Jules Gosnell
 * Partner
 * Core Developers Network (Europe)
 **/
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Problems running pre-compiled JSP classes when in subdirectories

2004-01-12 Thread Jules Gosnell
I take it all back :-)

Always test internal bug reports before going to a public list and...

One of my golden rules - except that I didn't...

So it looks like we now have one working testcase here and one case of 
pilot error to look at.

Apologies for the wasted bandwidth,

Jules

Jules Gosnell wrote:
Larry Isaacs wrote:

There is a choice when pre-compiling JSPs.

1. Compile to real servlets.  This involves precompiling
   the JSPs to classes and adding mappings to the web.xml
   so they execute just like other servlets.  This
   cuts the JspServlet out of the picture and the JSPs
   are executed the same as other servlets.
2. Pre-populate Tomcat's work directory.  This also involves
   precompiling the JSPs to classes, under the work
   directory, but continues to use the JspServlet to execute
   the JSPs.
The critical point is that the expected packages to which the
JSPs are compiled are different between these two choices.
The JspServlet expects every JSP to be compiled into the
org.apache.jsp package.  Thus, every index.jsp is expected
to be compiled as the org.apache.jsp.index_jsp class, even though
the class file may be in various subdirectories, for example
dir.  The JspServlet avoids the obvious naming collisions
by loading each JSP class into a separate classloader. (Nice
trick, but can make life tough for debuggers.)
For choice 1, the JSPs need to be compiled into a directory
structure where the package matches the directory structure
in the standard Java way.  Each JSP's fully qualified class
name would need to be unique and entered into the web.xml.


I have a requirement for this precompilation mode (1) on TC 4.1.29.

5.0.x seems to have been patched to do this (preserve the 
directory/package structure of the original jsp src) , but fixes do not 
appear to have been merged back into 4.1.x and are unfortunately tangled 
up with a number of other changes to 5.0.x.

I guess I am therefore looking for a patch to the 4.1.x branch. I'd be 
very grateful if anyone here would furnish me with one. Otherwise I 
shall probably have to put one together myself, in which case I shall 
post it here if anyone is interested.

Thanks for your time,

Jules


The error below appears that the index.jsp in question has been
compiled sort of per choice 1, but is being run under choice 2.
The class file appears to be at the right location under the work
directory, but it was compiled to the wrong package, i.e.
the package includes dir, when it shouldn't.
I don't use JspC, so I can't help much with respect to its use.
I'm currently not sure about its usability state in the various
Tomcat releases. In the past, it has had difficulting getting the
package right in the context of these two choices.  I would think
that in the current releases, it can be coaxed into doing the
right thing for one or both of these choices, but I can't say
much more than that.
However, I have used the Ant jspc task along with the javac task
to accomplish choice 2 without much difficulty in a number of
different Tomcat 4.1 releases.  I would assume there would be no
problems as well in the current Tomcat 5 release, but I haven't
actually tried it yet.
Cheers,
Larry

-Original Message-
From: Antony Paul [mailto:[EMAIL PROTECTED] Sent: Wednesday, 
January 07, 2004 8:46 AM
To: Tomcat Users List
Subject: Re: Problems running pre-compiled JSP classes when in 
subdirectories

The generated servlets are not put in a package. When Tomcat is 
compiling
JSP it is put in org.apache.jsp. How to set this in the jspc task.
The files are generated as usual in the work directory in the same 
structure
as Tomcat itself compiles JSP files.

Antony Paul
- Original Message -
From: Ralph Einfeldt [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Wednesday, January 07, 2004 7:06 PM
Subject: RE: Problems running pre-compiled JSP classes when in
subdirectories
May be you should have a look at the following:

- the package statements in the generated source files
- the file structure of the generate class files

-Original Message-
From: Jay Glanville [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 07, 2004 2:20 PM
To: 'Tomcat Users List'
Subject: Problems running pre-compiled JSP classes when in
subdirectories


Here's my application's background.  I have two files:
 WEBROOT/index.jsp
 WEBROOT/dir/index.jsp
java.lang.NoClassDefFoundError: org/apache/jsp/index_jsp 


(wrong name:

org/apache/jsp/dir/index_jsp)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
at java.lang.ClassLoader.defineClass(ClassLoader.java:448)
at


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED

Re: Problems running pre-compiled JSP classes when in subdirectories

2004-01-08 Thread Riaan Oberholzer
 The generated servlets are not put in a package.
 When Tomcat is compiling JSP it is put in 
 org.apache.jsp. How to set this in the jspc task.
 The files are generated as usual in the work
 directory in the same structure
 as Tomcat itself compiles JSP files.

Not entirely true. You can compile the java sources of
the JSP's yourself. I do it and it prevents the delay
(for Tomcat to compile it) when you first execute a
JSP. You also pick up any possible JSP errors when
building, not after deployment.

You can also specify *any* package, it doesn't have to
be org.apache.jsp... I eg use com.myapp.jsp

The Tomcat HOW-TO documentation has a good example of
the complete process. Jasper 2 JSP Engine How To,
option Web Application Compilation.

I followed it exactly and mine works 100%. The main
difference from what you guys explain (I think), is
that I do not only generate java sources for the
jsp's, but also compile them (my jsp's are thus
delivered as .class files) and also include the
servlet mappings in the web.xml. Its all very easy to
do with ant.


 Antony Paul
 - Original Message -
 From: Ralph Einfeldt
 [EMAIL PROTECTED]
 To: Tomcat Users List
 [EMAIL PROTECTED]
 Sent: Wednesday, January 07, 2004 7:06 PM
 Subject: RE: Problems running pre-compiled JSP
 classes when in
 subdirectories
 
 
 May be you should have a look at the following:
 
 - the package statements in the generated source
 files
 - the file structure of the generate class files
 
  -Original Message-
  From: Jay Glanville
 [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, January 07, 2004 2:20 PM
  To: 'Tomcat Users List'
  Subject: Problems running pre-compiled JSP classes
 when in
  subdirectories
 
 
 
  Here's my application's background.  I have two
 files:
WEBROOT/index.jsp
WEBROOT/dir/index.jsp
  java.lang.NoClassDefFoundError:
 org/apache/jsp/index_jsp (wrong name:
  org/apache/jsp/dir/index_jsp)
  at java.lang.ClassLoader.defineClass0(Native
 Method)
  at

java.lang.ClassLoader.defineClass(ClassLoader.java:537)
  at

java.lang.ClassLoader.defineClass(ClassLoader.java:448)
  at
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 
 
 

-
 To unsubscribe, e-mail:
 [EMAIL PROTECTED]
 For additional commands, e-mail:
 [EMAIL PROTECTED]
 


__
Do you Yahoo!?
Yahoo! Hotjobs: Enter the Signing Bonus Sweepstakes
http://hotjobs.sweepstakes.yahoo.com/signingbonus

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Problems running pre-compiled JSP classes when in subdirectories

2004-01-08 Thread Antony Paul
The problem is when files are kept in work directory. I dont want to put the
generated files in web-inf\classes and add mapping. My purpose is to compile
jsp pages as part of a build before the application is given for testing. I
will keep files in work directory. This I have to do frequently and I want
to detect any compilation errors and make it faster for the QA fellow to
access the application.

Antony Paul

- Original Message -
From: Riaan Oberholzer [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Thursday, January 08, 2004 1:06 PM
Subject: Re: Problems running pre-compiled JSP classes when in
subdirectories


  The generated servlets are not put in a package.
  When Tomcat is compiling JSP it is put in
  org.apache.jsp. How to set this in the jspc task.
  The files are generated as usual in the work
  directory in the same structure
  as Tomcat itself compiles JSP files.

 Not entirely true. You can compile the java sources of
 the JSP's yourself. I do it and it prevents the delay
 (for Tomcat to compile it) when you first execute a
 JSP. You also pick up any possible JSP errors when
 building, not after deployment.

 You can also specify *any* package, it doesn't have to
 be org.apache.jsp... I eg use com.myapp.jsp

 The Tomcat HOW-TO documentation has a good example of
 the complete process. Jasper 2 JSP Engine How To,
 option Web Application Compilation.

 I followed it exactly and mine works 100%. The main
 difference from what you guys explain (I think), is
 that I do not only generate java sources for the
 jsp's, but also compile them (my jsp's are thus
 delivered as .class files) and also include the
 servlet mappings in the web.xml. Its all very easy to
 do with ant.


  Antony Paul
  - Original Message -
  From: Ralph Einfeldt
  [EMAIL PROTECTED]
  To: Tomcat Users List
  [EMAIL PROTECTED]
  Sent: Wednesday, January 07, 2004 7:06 PM
  Subject: RE: Problems running pre-compiled JSP
  classes when in
  subdirectories
 
 
  May be you should have a look at the following:
 
  - the package statements in the generated source
  files
  - the file structure of the generate class files
 
   -Original Message-
   From: Jay Glanville
  [mailto:[EMAIL PROTECTED]
   Sent: Wednesday, January 07, 2004 2:20 PM
   To: 'Tomcat Users List'
   Subject: Problems running pre-compiled JSP classes
  when in
   subdirectories
  
  
  
   Here's my application's background.  I have two
  files:
 WEBROOT/index.jsp
 WEBROOT/dir/index.jsp
   java.lang.NoClassDefFoundError:
  org/apache/jsp/index_jsp (wrong name:
   org/apache/jsp/dir/index_jsp)
   at java.lang.ClassLoader.defineClass0(Native
  Method)
   at
 
 java.lang.ClassLoader.defineClass(ClassLoader.java:537)
   at
 
 java.lang.ClassLoader.defineClass(ClassLoader.java:448)
   at
 
 
 -
  To unsubscribe, e-mail:
  [EMAIL PROTECTED]
  For additional commands, e-mail:
  [EMAIL PROTECTED]
 
 
 
 
 -
  To unsubscribe, e-mail:
  [EMAIL PROTECTED]
  For additional commands, e-mail:
  [EMAIL PROTECTED]
 


 __
 Do you Yahoo!?
 Yahoo! Hotjobs: Enter the Signing Bonus Sweepstakes
 http://hotjobs.sweepstakes.yahoo.com/signingbonus

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Problems running pre-compiled JSP classes when in subdirectories

2004-01-07 Thread Jay Glanville
I originally posted this question back in mid-December, but without any
responses.  In the hopes that someone will have a hit or a solution, I'm
reposting the question again.


I'm having a problem when I try to use my pre-compiled JSP files: I
receive a NoClassDefFoundError exception.  Here's what I'm doing ...

I have pre-compiled my JSP classes using the JspC plugin from ant.  My
files compile without complaint.  However, when I try to access the
files through tomcat, I receive some NoClassDefFoundError exceptions.
But these exceptions only occur when I'm accessing JSPs in the
subdirectories off of the web root.

Here's my application's background.  I have two files:
  WEBROOT/index.jsp
  WEBROOT/dir/index.jsp
The contents of the two files are just simple HTML.  I precompiled the
JSP using the JspC ant target, then compiled using javac.  Finally, I
created a context pointing the work directory to the location of my java
and class files.  When I tried to access the first file
(http://localhost/context/index.jsp) everything went fine.  However,
when I tried to access the second file
(http://localhost/context/dir/index.jsp), I received the
NoClassDefFoundError.  The log file looks like this:

2003-12-15 20:11:25 StandardWrapperValve[jsp]: Servlet.service() for
servlet jsp threw exception
javax.servlet.ServletException: org/apache/jsp/index_jsp (wrong name:
org/apache/jsp/dir/index_jsp)
at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
[deleted ...]
- Root Cause -
java.lang.NoClassDefFoundError: org/apache/jsp/index_jsp (wrong name:
org/apache/jsp/dir/index_jsp)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
at java.lang.ClassLoader.defineClass(ClassLoader.java:448)
at
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:215)
[deleted]

Now, according to my research on this mailing list, the most frequent
reason for a NoClassDef error is capitalization.  However, this isn't
the case in my situation as the two package names are completely
different: org/apache/jsp/index_jsp vs. org/apache/jsp/dir/index_jsp.

I'm using Tomcat 4.1.29.

Any suggestions on how to alleviate this situation would be greatly
appreciated.

Thanks

JDG

PS: I should also point out that I have tried the recommended way of
precompiling my JSP by converting to servlets
(http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jasper-howto.html#Web%2
0Application%20Compilation).  However, I have a problem with this
method: it makes it that much harder to patch my application.  With the
non-servlet approach, I just simply deliver the modified JSP files. With
the servlet approach, I need to deliver the classes, plus ensure that
the web.xml is correct (add new entries, remove old ones, modify where
needed), plus restart the context.




--
Jay Glanville



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Problems running pre-compiled JSP classes when in subdirectories

2004-01-07 Thread Antony Paul
I have same problem but it is not thoroughly investigated. Any help will be
appreciated

Antony Paul

- Original Message -
From: Jay Glanville [EMAIL PROTECTED]
To: 'Tomcat Users List' [EMAIL PROTECTED]
Sent: Wednesday, January 07, 2004 6:50 PM
Subject: Problems running pre-compiled JSP classes when in subdirectories


 I originally posted this question back in mid-December, but without any
 responses.  In the hopes that someone will have a hit or a solution, I'm
 reposting the question again.


 I'm having a problem when I try to use my pre-compiled JSP files: I
 receive a NoClassDefFoundError exception.  Here's what I'm doing ...

 I have pre-compiled my JSP classes using the JspC plugin from ant.  My
 files compile without complaint.  However, when I try to access the
 files through tomcat, I receive some NoClassDefFoundError exceptions.
 But these exceptions only occur when I'm accessing JSPs in the
 subdirectories off of the web root.

 Here's my application's background.  I have two files:
   WEBROOT/index.jsp
   WEBROOT/dir/index.jsp
 The contents of the two files are just simple HTML.  I precompiled the
 JSP using the JspC ant target, then compiled using javac.  Finally, I
 created a context pointing the work directory to the location of my java
 and class files.  When I tried to access the first file
 (http://localhost/context/index.jsp) everything went fine.  However,
 when I tried to access the second file
 (http://localhost/context/dir/index.jsp), I received the
 NoClassDefFoundError.  The log file looks like this:

 2003-12-15 20:11:25 StandardWrapperValve[jsp]: Servlet.service() for
 servlet jsp threw exception
 javax.servlet.ServletException: org/apache/jsp/index_jsp (wrong name:
 org/apache/jsp/dir/index_jsp)
 at
 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 [deleted ...]
 - Root Cause -
 java.lang.NoClassDefFoundError: org/apache/jsp/index_jsp (wrong name:
 org/apache/jsp/dir/index_jsp)
 at java.lang.ClassLoader.defineClass0(Native Method)
 at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
 at java.lang.ClassLoader.defineClass(ClassLoader.java:448)
 at
 org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:215)
 [deleted]

 Now, according to my research on this mailing list, the most frequent
 reason for a NoClassDef error is capitalization.  However, this isn't
 the case in my situation as the two package names are completely
 different: org/apache/jsp/index_jsp vs. org/apache/jsp/dir/index_jsp.

 I'm using Tomcat 4.1.29.

 Any suggestions on how to alleviate this situation would be greatly
 appreciated.

 Thanks

 JDG

 PS: I should also point out that I have tried the recommended way of
 precompiling my JSP by converting to servlets
 (http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jasper-howto.html#Web%2
 0Application%20Compilation).  However, I have a problem with this
 method: it makes it that much harder to patch my application.  With the
 non-servlet approach, I just simply deliver the modified JSP files. With
 the servlet approach, I need to deliver the classes, plus ensure that
 the web.xml is correct (add new entries, remove old ones, modify where
 needed), plus restart the context.




 --
 Jay Glanville



 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Problems running pre-compiled JSP classes when in subdirectories

2004-01-07 Thread Ralph Einfeldt
May be you should have a look at the following:

- the package statements in the generated source files
- the file structure of the generate class files

 -Original Message-
 From: Jay Glanville [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, January 07, 2004 2:20 PM
 To: 'Tomcat Users List'
 Subject: Problems running pre-compiled JSP classes when in
 subdirectories
 
 
 
 Here's my application's background.  I have two files:
   WEBROOT/index.jsp
   WEBROOT/dir/index.jsp
 java.lang.NoClassDefFoundError: org/apache/jsp/index_jsp (wrong name:
 org/apache/jsp/dir/index_jsp)
   at java.lang.ClassLoader.defineClass0(Native Method)
   at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
   at java.lang.ClassLoader.defineClass(ClassLoader.java:448)
   at

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Problems running pre-compiled JSP classes when in subdirectories

2004-01-07 Thread Antony Paul
The generated servlets are not put in a package. When Tomcat is compiling
JSP it is put in org.apache.jsp. How to set this in the jspc task.
The files are generated as usual in the work directory in the same structure
as Tomcat itself compiles JSP files.

Antony Paul
- Original Message -
From: Ralph Einfeldt [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Wednesday, January 07, 2004 7:06 PM
Subject: RE: Problems running pre-compiled JSP classes when in
subdirectories


May be you should have a look at the following:

- the package statements in the generated source files
- the file structure of the generate class files

 -Original Message-
 From: Jay Glanville [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, January 07, 2004 2:20 PM
 To: 'Tomcat Users List'
 Subject: Problems running pre-compiled JSP classes when in
 subdirectories



 Here's my application's background.  I have two files:
   WEBROOT/index.jsp
   WEBROOT/dir/index.jsp
 java.lang.NoClassDefFoundError: org/apache/jsp/index_jsp (wrong name:
 org/apache/jsp/dir/index_jsp)
 at java.lang.ClassLoader.defineClass0(Native Method)
 at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
 at java.lang.ClassLoader.defineClass(ClassLoader.java:448)
 at

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Problems running pre-compiled JSP classes when in subdirectories

2004-01-07 Thread Antony Paul
exception

javax.servlet.ServletException: org/apache/jsp/index_jsp (wrong name:
index_jsp)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)


java.lang.NoClassDefFoundError: org/apache/jsp/index_jsp (wrong name:
index_jsp)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
at java.lang.ClassLoader.defineClass(ClassLoader.java:431)
at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:215)
at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:131)


Interestingly if the jsp is comiled to servlet using jspc ant task and page
is requested through browser then everything
goes fine. If the generated source file is compiled using javac target of it
is showing this error.

Antony Paul
- Original Message -
From: Edson Alves Pereira [EMAIL PROTECTED]
To: 'Tomcat Users List' [EMAIL PROTECTED]
Sent: Wednesday, January 07, 2004 8:12 PM
Subject: RE: Problems running pre-compiled JSP classes when in
subdirectories


 Show us the exception how it appears to you.

  --
  De: Jay Glanville[SMTP:[EMAIL PROTECTED]
  Responder: Tomcat Users List
  Enviada: quarta-feira, 7 de janeiro de 2004 10:20
  Para: 'Tomcat Users List'
  Assunto: Problems running pre-compiled JSP classes when in
  subdirectories
 
  I originally posted this question back in mid-December, but without any
  responses.  In the hopes that someone will have a hit or a solution, I'm
  reposting the question again.
 
 
  I'm having a problem when I try to use my pre-compiled JSP files: I
  receive a NoClassDefFoundError exception.  Here's what I'm doing ...
 
  I have pre-compiled my JSP classes using the JspC plugin from ant.  My
  files compile without complaint.  However, when I try to access the
  files through tomcat, I receive some NoClassDefFoundError exceptions.
  But these exceptions only occur when I'm accessing JSPs in the
  subdirectories off of the web root.
 
  Here's my application's background.  I have two files:
WEBROOT/index.jsp
WEBROOT/dir/index.jsp
  The contents of the two files are just simple HTML.  I precompiled the
  JSP using the JspC ant target, then compiled using javac.  Finally, I
  created a context pointing the work directory to the location of my java
  and class files.  When I tried to access the first file
  (http://localhost/context/index.jsp) everything went fine.  However,
  when I tried to access the second file
  (http://localhost/context/dir/index.jsp), I received the
  NoClassDefFoundError.  The log file looks like this:
 
  2003-12-15 20:11:25 StandardWrapperValve[jsp]: Servlet.service() for
  servlet jsp threw exception
  javax.servlet.ServletException: org/apache/jsp/index_jsp (wrong name:
  org/apache/jsp/dir/index_jsp)
  at
  org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
  [deleted ...]
  - Root Cause -
  java.lang.NoClassDefFoundError: org/apache/jsp/index_jsp (wrong name:
  org/apache/jsp/dir/index_jsp)
  at java.lang.ClassLoader.defineClass0(Native Method)
  at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
  at java.lang.ClassLoader.defineClass(ClassLoader.java:448)
  at
  org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:215)
  [deleted]
 
  Now, according to my research on this mailing list, the most frequent
  reason for a NoClassDef error is capitalization.  However, this isn't
  the case in my situation as the two package names are completely
  different: org/apache/jsp/index_jsp vs. org/apache/jsp/dir/index_jsp.
 
  I'm using Tomcat 4.1.29.
 
  Any suggestions on how to alleviate this situation would be greatly
  appreciated.
 
  Thanks
 
  JDG
 
  PS: I should also point out that I have tried the recommended way of
  precompiling my JSP by converting to servlets
  (http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jasper-howto.html#Web%2
  0Application%20Compilation).  However, I have a problem with this
  method: it makes it that much harder to patch my application.  With the
  non-servlet approach, I just simply deliver the modified JSP files. With
  the servlet approach, I need to deliver the classes, plus ensure that
  the web.xml is correct (add new entries, remove old ones, modify where
  needed), plus restart the context.
 
 
 
 
  --
  Jay Glanville
 
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Problems running pre-compiled JSP classes when in subdirectories

2004-01-07 Thread Antony Paul
I think the problem is the compiled source file is not in the org.apache.jsp
package. How to set this in jspc task.

Antony Paul

- Original Message -
From: Antony Paul [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Wednesday, January 07, 2004 7:41 PM
Subject: Re: Problems running pre-compiled JSP classes when in
subdirectories


 exception

 javax.servlet.ServletException: org/apache/jsp/index_jsp (wrong name:
 index_jsp)
 at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)


 java.lang.NoClassDefFoundError: org/apache/jsp/index_jsp (wrong name:
 index_jsp)
 at java.lang.ClassLoader.defineClass0(Native Method)
 at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
 at java.lang.ClassLoader.defineClass(ClassLoader.java:431)
 at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:215)
 at org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:131)


 Interestingly if the jsp is comiled to servlet using jspc ant task and
page
 is requested through browser then everything
 goes fine. If the generated source file is compiled using javac target of
it
 is showing this error.

 Antony Paul
 - Original Message -
 From: Edson Alves Pereira [EMAIL PROTECTED]
 To: 'Tomcat Users List' [EMAIL PROTECTED]
 Sent: Wednesday, January 07, 2004 8:12 PM
 Subject: RE: Problems running pre-compiled JSP classes when in
 subdirectories


  Show us the exception how it appears to you.
 
   --
   De: Jay Glanville[SMTP:[EMAIL PROTECTED]
   Responder: Tomcat Users List
   Enviada: quarta-feira, 7 de janeiro de 2004 10:20
   Para: 'Tomcat Users List'
   Assunto: Problems running pre-compiled JSP classes when in
   subdirectories
  
   I originally posted this question back in mid-December, but without
any
   responses.  In the hopes that someone will have a hit or a solution,
I'm
   reposting the question again.
  
  
   I'm having a problem when I try to use my pre-compiled JSP files: I
   receive a NoClassDefFoundError exception.  Here's what I'm doing ...
  
   I have pre-compiled my JSP classes using the JspC plugin from ant.  My
   files compile without complaint.  However, when I try to access the
   files through tomcat, I receive some NoClassDefFoundError exceptions.
   But these exceptions only occur when I'm accessing JSPs in the
   subdirectories off of the web root.
  
   Here's my application's background.  I have two files:
 WEBROOT/index.jsp
 WEBROOT/dir/index.jsp
   The contents of the two files are just simple HTML.  I precompiled the
   JSP using the JspC ant target, then compiled using javac.  Finally, I
   created a context pointing the work directory to the location of my
java
   and class files.  When I tried to access the first file
   (http://localhost/context/index.jsp) everything went fine.  However,
   when I tried to access the second file
   (http://localhost/context/dir/index.jsp), I received the
   NoClassDefFoundError.  The log file looks like this:
  
   2003-12-15 20:11:25 StandardWrapperValve[jsp]: Servlet.service() for
   servlet jsp threw exception
   javax.servlet.ServletException: org/apache/jsp/index_jsp (wrong name:
   org/apache/jsp/dir/index_jsp)
   at
   org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
   [deleted ...]
   - Root Cause -
   java.lang.NoClassDefFoundError: org/apache/jsp/index_jsp (wrong name:
   org/apache/jsp/dir/index_jsp)
   at java.lang.ClassLoader.defineClass0(Native Method)
   at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
   at java.lang.ClassLoader.defineClass(ClassLoader.java:448)
   at
  
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:215)
   [deleted]
  
   Now, according to my research on this mailing list, the most frequent
   reason for a NoClassDef error is capitalization.  However, this isn't
   the case in my situation as the two package names are completely
   different: org/apache/jsp/index_jsp vs. org/apache/jsp/dir/index_jsp.
  
   I'm using Tomcat 4.1.29.
  
   Any suggestions on how to alleviate this situation would be greatly
   appreciated.
  
   Thanks
  
   JDG
  
   PS: I should also point out that I have tried the recommended way of
   precompiling my JSP by converting to servlets
  
(http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jasper-howto.html#Web%2
   0Application%20Compilation).  However, I have a problem with this
   method: it makes it that much harder to patch my application.  With
the
   non-servlet approach, I just simply deliver the modified JSP files.
With
   the servlet approach, I need to deliver the classes, plus ensure that
   the web.xml is correct (add new entries, remove old ones, modify where
   needed), plus restart the context.
  
  
  
  
   --
   Jay Glanville

RE: Problems running pre-compiled JSP classes when in subdirectories

2004-01-07 Thread Jay Glanville
)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.java:191)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.ja
va:246)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:241
7)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
:180)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherVa
lve.java:171)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:641)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
:172)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:641)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
java:174)
at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
nvokeNext(StandardPipeline.java:643)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4
80)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at
org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:193)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:78
1)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processC
onnection(Http11Protocol.java:549)
at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:58
9)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool
.java:666)
at java.lang.Thread.run(Thread.java:534)


--
Jay Glanville


 -Original Message-
 From: Edson Alves Pereira [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, January 07, 2004 9:43 AM
 To: 'Tomcat Users List'
 Subject: RE: Problems running pre-compiled JSP classes when 
 in subdirectories
 
 
   Show us the exception how it appears to you.
 
  --
  De: Jay Glanville[SMTP:[EMAIL PROTECTED]
  Responder:  Tomcat Users List
  Enviada:quarta-feira, 7 de janeiro de 2004 10:20
  Para:   'Tomcat Users List'
  Assunto:Problems running pre-compiled JSP classes when in
  subdirectories
  
  I originally posted this question back in mid-December, but without 
  any responses.  In the hopes that someone will have a hit or a 
  solution, I'm reposting the question again.
  
  
  I'm having a problem when I try to use my pre-compiled JSP files: I 
  receive a NoClassDefFoundError exception.  Here's what I'm doing ...
  
  I have pre-compiled my JSP classes using the JspC plugin 
 from ant.  My 
  files compile without complaint.  However, when I try to access the 
  files through tomcat, I receive some NoClassDefFoundError 
 exceptions. 
  But these exceptions only occur when I'm accessing JSPs in the 
  subdirectories off of the web root.
  
  Here's my application's background.  I have two files:
WEBROOT/index.jsp
WEBROOT/dir/index.jsp
  The contents of the two files are just simple HTML.  I 
 precompiled the 
  JSP using the JspC ant target, then compiled using javac.  
 Finally, I 
  created a context pointing the work directory to the location of my 
  java and class files.  When I tried to access the first file
  (http://localhost/context/index.jsp) everything went fine.  
 However, 
  when I tried to access the second file 
  (http://localhost/context/dir/index.jsp), I received the 
  NoClassDefFoundError.  The log file looks like this:
  
  2003-12-15 20:11:25 StandardWrapperValve[jsp]: 
 Servlet.service() for 
  servlet jsp threw exception
  javax.servlet.ServletException: org/apache/jsp/index_jsp 
 (wrong name:
  org/apache/jsp/dir/index_jsp)
  at
  org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
  [deleted ...]
  - Root Cause -
  java.lang.NoClassDefFoundError: org/apache/jsp/index_jsp 
 (wrong name

RE: Problems running pre-compiled JSP classes when in subdirectories

2004-01-07 Thread Larry Isaacs
There is a choice when pre-compiling JSPs.

1. Compile to real servlets.  This involves precompiling
   the JSPs to classes and adding mappings to the web.xml
   so they execute just like other servlets.  This
   cuts the JspServlet out of the picture and the JSPs
   are executed the same as other servlets.

2. Pre-populate Tomcat's work directory.  This also involves
   precompiling the JSPs to classes, under the work
   directory, but continues to use the JspServlet to execute
   the JSPs.

The critical point is that the expected packages to which the
JSPs are compiled are different between these two choices.

The JspServlet expects every JSP to be compiled into the
org.apache.jsp package.  Thus, every index.jsp is expected
to be compiled as the org.apache.jsp.index_jsp class, even though
the class file may be in various subdirectories, for example
dir.  The JspServlet avoids the obvious naming collisions
by loading each JSP class into a separate classloader. (Nice
trick, but can make life tough for debuggers.)

For choice 1, the JSPs need to be compiled into a directory
structure where the package matches the directory structure
in the standard Java way.  Each JSP's fully qualified class
name would need to be unique and entered into the web.xml.

The error below appears that the index.jsp in question has been
compiled sort of per choice 1, but is being run under choice 2.
The class file appears to be at the right location under the work
directory, but it was compiled to the wrong package, i.e.
the package includes dir, when it shouldn't.

I don't use JspC, so I can't help much with respect to its use.
I'm currently not sure about its usability state in the various
Tomcat releases. In the past, it has had difficulting getting the
package right in the context of these two choices.  I would think
that in the current releases, it can be coaxed into doing the
right thing for one or both of these choices, but I can't say
much more than that.

However, I have used the Ant jspc task along with the javac task
to accomplish choice 2 without much difficulty in a number of
different Tomcat 4.1 releases.  I would assume there would be no
problems as well in the current Tomcat 5 release, but I haven't
actually tried it yet.

Cheers,
Larry

 -Original Message-
 From: Antony Paul [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, January 07, 2004 8:46 AM
 To: Tomcat Users List
 Subject: Re: Problems running pre-compiled JSP classes when 
 in subdirectories
 
 
 The generated servlets are not put in a package. When Tomcat 
 is compiling
 JSP it is put in org.apache.jsp. How to set this in the jspc task.
 The files are generated as usual in the work directory in the 
 same structure
 as Tomcat itself compiles JSP files.
 
 Antony Paul
 - Original Message -
 From: Ralph Einfeldt [EMAIL PROTECTED]
 To: Tomcat Users List [EMAIL PROTECTED]
 Sent: Wednesday, January 07, 2004 7:06 PM
 Subject: RE: Problems running pre-compiled JSP classes when in
 subdirectories
 
 
 May be you should have a look at the following:
 
 - the package statements in the generated source files
 - the file structure of the generate class files
 
  -Original Message-
  From: Jay Glanville [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, January 07, 2004 2:20 PM
  To: 'Tomcat Users List'
  Subject: Problems running pre-compiled JSP classes when in
  subdirectories
 
 
 
  Here's my application's background.  I have two files:
WEBROOT/index.jsp
WEBROOT/dir/index.jsp
  java.lang.NoClassDefFoundError: org/apache/jsp/index_jsp 
 (wrong name:
  org/apache/jsp/dir/index_jsp)
  at java.lang.ClassLoader.defineClass0(Native Method)
  at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
  at java.lang.ClassLoader.defineClass(ClassLoader.java:448)
  at
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Problems running pre-compiled JSP classes when in subdirectories

2004-01-07 Thread Jay Glanville
Thanks Edson.  I'll try that later this week.

JDG

--
Jay Glanville


 -Original Message-
 From: Edson Alves Pereira [mailto:[EMAIL PROTECTED] 
 Sent: Wednesday, January 07, 2004 12:00 PM
 To: 'Tomcat Users List'
 Subject: RE: Problems running pre-compiled JSP classes when 
 in subdirectories
 
 
   That´s the answer, you need to specify org.apache as 
 your JSP package. Here´s a example from my build.xml how to use jspc
 
   jspc   srcdir  =${webapp}/jsp//Place where 
 JSPC can find
 web.xml
   destdir =${webapp}//place where 
 jsp files will
 be created
   verbose =9
   package=org.apache//root package
   uriroot =jsp  // alias that 
 you would use
 for JSP pages
   webxml  =${webapp}/WEB-INF/jsp.xml// file 
 to manage
 JSP files
   classpathref=base-path
   webapp basedir=${webapp}/
   /jspc
 
 
  --
  De: Antony Paul[SMTP:[EMAIL PROTECTED]
  Responder:  Tomcat Users List
  Enviada:quarta-feira, 7 de janeiro de 2004 11:13
  Para:   Tomcat Users List
  Assunto:Re: Problems running pre-compiled JSP classes when in
  subdirectories
  
  I think the problem is the compiled source file is not in the 
  org.apache.jsp package. How to set this in jspc task.
  
  Antony Paul
  
  - Original Message -
  From: Antony Paul [EMAIL PROTECTED]
  To: Tomcat Users List [EMAIL PROTECTED]
  Sent: Wednesday, January 07, 2004 7:41 PM
  Subject: Re: Problems running pre-compiled JSP classes when in 
  subdirectories
  
  
   exception
  
   javax.servlet.ServletException: org/apache/jsp/index_jsp (wrong 
   name:
   index_jsp)
   at 
 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
  
  
   java.lang.NoClassDefFoundError: org/apache/jsp/index_jsp (wrong 
   name:
   index_jsp)
   at java.lang.ClassLoader.defineClass0(Native Method)
   at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
   at java.lang.ClassLoader.defineClass(ClassLoader.java:431)
   at
  
 org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:215
  )
   at
  
 org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:131
  )
  
  
   Interestingly if the jsp is comiled to servlet using jspc 
 ant task 
   and
  page
   is requested through browser then everything
   goes fine. If the generated source file is compiled using javac 
   target
  of
  it
   is showing this error.
  
   Antony Paul
   - Original Message -
   From: Edson Alves Pereira [EMAIL PROTECTED]
   To: 'Tomcat Users List' [EMAIL PROTECTED]
   Sent: Wednesday, January 07, 2004 8:12 PM
   Subject: RE: Problems running pre-compiled JSP classes when in 
   subdirectories
  
  
Show us the exception how it appears to you.
   
 --
 De: Jay Glanville[SMTP:[EMAIL PROTECTED]
 Responder: Tomcat Users List
 Enviada: quarta-feira, 7 de janeiro de 2004 10:20
 Para: 'Tomcat Users List'
 Assunto: Problems running pre-compiled JSP classes when in 
 subdirectories

 I originally posted this question back in mid-December, but 
 without
  any
 responses.  In the hopes that someone will have a hit or a 
 solution,
  I'm
 reposting the question again.


 I'm having a problem when I try to use my pre-compiled JSP 
 files: I receive a NoClassDefFoundError exception.  
 Here's what 
 I'm doing ...

 I have pre-compiled my JSP classes using the JspC plugin from 
 ant.
  My
 files compile without complaint.  However, when I try 
 to access 
 the files through tomcat, I receive some NoClassDefFoundError
  exceptions.
 But these exceptions only occur when I'm accessing 
 JSPs in the 
 subdirectories off of the web root.

 Here's my application's background.  I have two files:
   WEBROOT/index.jsp
   WEBROOT/dir/index.jsp
 The contents of the two files are just simple HTML.  I 
 precompiled
  the
 JSP using the JspC ant target, then compiled using javac.  
 Finally,
  I
 created a context pointing the work directory to the 
 location of 
 my
  java
 and class files.  When I tried to access the first file
 (http://localhost/context/index.jsp) everything went fine.  
 However, when I tried to access the second file 
 (http://localhost/context/dir/index.jsp), I received the 
 NoClassDefFoundError.  The log file looks like this:

 2003-12-15 20:11:25 StandardWrapperValve[jsp]: 
 Servlet.service() 
 for servlet jsp threw exception
 javax.servlet.ServletException: 
 org/apache/jsp/index_jsp (wrong
  name:
 org/apache/jsp/dir/index_jsp)
 at
 
 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249
 )
 at 
 javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 [deleted

Problems running pre-compiled JSP classes when in subdirectories

2003-12-18 Thread Glanville, Jay
I have pre-compiled my JSP classes using the JspC plugin from ant.  My
files compile without complaint.  However, when I try to access the
files through tomcat, I receive some NoClassDefFoundError exceptions.
But these exceptions only occur when I'm accessing JSPs in the
subdirectories off of the web root.

Here's my application's background.  I have two files:
  WEBROOT/index.jsp
  WEBROOT/dir/index.jsp
The contents of the two files are just simple HTML.  I precompiled the
JSP using the JspC ant target, then compiled using javac.  Finally, I
created a context pointing the work directory to the location of my java
and class files.  When I tried to access the first file
(http://localhost/context/index.jsp) everything went fine.  However,
when I tried to access the second file
(http://localhost/context/dir/index.jsp), I received the
NoClassDefFoundError.  The log file looks like this:

2003-12-15 20:11:25 StandardWrapperValve[jsp]: Servlet.service() for
servlet jsp threw exception
javax.servlet.ServletException: org/apache/jsp/index_jsp (wrong name:
org/apache/jsp/dir/index_jsp)
at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
[deleted ...]
- Root Cause -
java.lang.NoClassDefFoundError: org/apache/jsp/index_jsp (wrong name:
org/apache/jsp/dir/index_jsp)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
at java.lang.ClassLoader.defineClass(ClassLoader.java:448)
at
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:215)
[deleted]

Now, according to my research on this mailing list, the most frequent
reason for a NoClassDef error is capitalization.  However, this isn't
the case in my situation as the two package names are completely
different: org/apache/jsp/index_jsp vs. org/apache/jsp/dir/index_jsp.

I'm using Tomcat 4.1.29.

Any suggestions on how to alleviate this situation would be greatly
appreciated.

Thanks

JDG

PS: I should also point out that I have tried the recommended way of
precompiling my JSP by converting to servlets
(http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jasper-howto.html#Web%2
0Application%20Compilation).  However, I have a problem with this
method: it makes it that much harder to patch my application.  With the
non-servlet approach, I just simply deliver the modified JSP files.
With the servlet approach, I need to deliver the classes, plus ensure
that the web.xml is correct (add new entries, remove old ones, modify
where needed), plus restart the context.




--
Jay Glanville

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]