aspose file tools*
The moose likes Other Java Products and Servers and the fly likes java. lang. NoClassDefFoundError Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Other Java Products and Servers
Bookmark "java. lang. NoClassDefFoundError" Watch "java. lang. NoClassDefFoundError" New topic
Author

java. lang. NoClassDefFoundError

Tim Hobbs
Greenhorn

Joined: Oct 09, 2003
Posts: 12
I cannot figure out what is going on. Everything worked fine, then I suddenly started getting the following error:



I have spent the last day and a half trying various things. I going insane!

Any help on this would be greatly appreciated.

server specs:
linux running redhat es 3
mysql 4.0.20
resin 2.1.14
custom tags
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61420
    
  67

javax.servlet.jsp.JspContext is a JSP 2.0 class.

As far as I know, Resin 2.x supports JSP 1.2 and JSP 2.0 support was introduced with Resin 3.x.

But the latest 2.x version of Resin I've used is 2.0.6 (currently planning a migration to Resin 3), so I'm not sure exactly what might be in 2.1.14.

Something to check though.
[ September 03, 2004: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Tim Hobbs
Greenhorn

Joined: Oct 09, 2003
Posts: 12
Yeah, and that is what is the most confusing. I must admit, I am not well versed in the ways of Java (prior to this site I knew zero), but I have learned quite a bit. The whole 2.0, 2.4, 2.3, 1.2, 1.1 thing is mighty confusing though!

Anyway, it seems that perhaps there is an issue with using pageContext? I am getting form values using pageContext.getAttribute (I think that is it, I am unable to look at my code right now). Is this a problem? As I said, everything worked fine, but now it is broken. Could it be a problem with the DTD in my TLD file?

Thanks for your assistance,
Tim
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61420
    
  67

Accessing pageContext isn't an issue. The PageContext class has been around for a while. However, in JSP 2.0, PageContext derives from JspContext but not in JSP 1.2.

So the question is: why is a JSP 1.2 engine looking for a JSP 2.0 class?

Are you compiling your servlets and beans against Servlet 2.4 and JSP 2.0, but deploying on a Servlet 2.3 and JSP 1.2 engine?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61420
    
  67

In other words, how are you compiling your classes, and where did you get the jar files that you are using in that process? You should be compiling against the jars that come with the Resin distribution
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61420
    
  67

And...

Could it be a problem with the DTD in my TLD file?


It could be, if you are using a DTD for a "future" version, but unlikely. If it is a problem with the tag library, it would most likely be due to using tag handler classes compiled against JSP 2.0. What tag library is causing the issues?
[ September 03, 2004: Message edited by: Bear Bibeault ]
Tim Hobbs
Greenhorn

Joined: Oct 09, 2003
Posts: 12
Wow, thanks for the responses. There is a LOT of info in there. I guess I have a lot more to learn.

I use Netbeans 3.6 and JDK 1.4.2_05. All my functionality is built in using custom tags. I am attempting to completely separate the code from the HTML (I have an assistant that knows next to nothing about HTML, let alone sprinkling in some JSP here and there).

Like I said, I have had no issues in the past. Everything has worked fine for some time now. Then suddenly, this error pops up.

I would assume that using the most current version of the JDK would not break backwards compatibility, but I guess I could be wrong, no?

Thanks again for all your great info,
Tim
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61420
    
  67

I would assume that using the most current version of the JDK would not break backwards compatibility, but I guess I could be wrong, no?


The version of the JDK you are using is pretty much immaterial. What is germaine here is the versions of the Servlet and JSP APIs you are building against, and which versions you are deploying upon. That's where the mismatch appears to be.
Tim Hobbs
Greenhorn

Joined: Oct 09, 2003
Posts: 12
Well, I must say that confuses me a bit. Like I said, I am pretty new to this all, so I am getting a bit lost. Sorry...

I guess I can explain the steps I take and you can hopefully direct me to what info you need. As I said before, I use Netbeans. I compile the .class files with Netbeans, then I upload 'em.

Does the API stuff have to do with J2EE? Like I said, all these different versions of stuff can get a bit confusing.

Sorry I don't have better answers. I appreciate your assistance,
Tim
Tim Hobbs
Greenhorn

Joined: Oct 09, 2003
Posts: 12
Reading back, it seems that it must be an issue with which jar files are included in the resin/lib directory, no? I added a jar for MySQL, but other than that, the jars are what were there from the original resin install.

Hope this helps,
Tim
Tim Hobbs
Greenhorn

Joined: Oct 09, 2003
Posts: 12
I take that last post back - there are some items that were added. I'll try removing all the jars (except the basics) and starting again.

On that note: how can I easily tell which jars use what servlet?

I cannot tell you how much this has helped. Thanks again,
Tim
Tim Hobbs
Greenhorn

Joined: Oct 09, 2003
Posts: 12
Well, I removed everything, replaced the entire resin directory fresh from the resin.tgz and still the same thing.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61420
    
  67

I don't think it's your resin setup.

Again, what jar files are you compiling your beans, servlets and tag handlers against? Are you using the jar files that came with Resin?

Are your tag handlers in jars that you down-loaded from elsewhere that might have been compiled against JSP 2.0?

The symptoms of your issue all point to compiling classes against the JSP 2.0 API, but trying to run them against JSP 1.2.
Tim Hobbs
Greenhorn

Joined: Oct 09, 2003
Posts: 12
The jar files are mostly all ones that came with Resin, except for a java mail jar and the MySQL jar.

The biggest problem is that everything worked for months, then, suddenly, things no longer worked. I grasp the concept of versions (although I am unaware exactly how I would easliy tell the version of a jar), but I am confused how something could work for months then suddenly no longer work when nothing changed? It seems something must have changed, but I have went back tothe most recent java file changes I made and cannot find anything that sticks out.

Thanks for sticking with me on this one,
Tim
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java. lang. NoClassDefFoundError