This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Servlets and the fly likes Error allocating a servlet instance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Error allocating a servlet instance" Watch "Error allocating a servlet instance" New topic
Author

Error allocating a servlet instance

A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 979
Hi all,

I get the following error while running a servlet...

I have JDK 1.4 , JRE 1.4 in my system and also JRE 1.5 ...


exception

javax.servlet.ServletException: Error allocating a servlet instance
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
java.lang.Thread.run(Thread.java:534)

root cause

java.lang.UnsupportedClassVersionError: com/abcd/WelcomeClass (Unsupported major.minor version 49.0)
java.lang.ClassLoader.defineClass0(Native Method)
java.lang.ClassLoader.defineClass(ClassLoader.java:537..........


Can any of you shed some light ....what could be the problem...

Regards
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61451
    
  67

Looks like you may have a class file that's corrupt or out-of-date.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42371
    
  64
I think class version 49.0 is the one used by Java 5; maybe you're running it under 1.4. Try compiling it with the "-target 1.4" option.


Ping & DNS - my free Android networking tools app
A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 979
Hi...

The Welcome class is nothing but the HelloServlet class code...

found in servlet-examples.

Also i have only JRE 1.5 and not JDK 1.5 in my system..

Regards
Reghu Ram Thanumalayan
Ranch Hand

Joined: Oct 21, 2003
Posts: 193
The container in which you are running the servlet might be using JRE 1.4.
[ January 04, 2006: Message edited by: Reghu Ram T ]

Cheers,<br />Reghu Ram T<br /> <br />SCJP 1.4 - 98 %, SCBCD 1.3 - 94 %, SCMAD 1.0 - 92 %
A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 979
Yes JAVA_HOME is set to JDK 1.4...

and tomcat uses this...
Reghu Ram Thanumalayan
Ranch Hand

Joined: Oct 21, 2003
Posts: 193
Set your home to JDK 1.5 or JRE 1.5
A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 979
Thanks...I will change it and test ...

Regards
[ January 05, 2006: Message edited by: A Kumar ]
A Kumar
Ranch Hand

Joined: Jul 04, 2004
Posts: 979
Hi,

I uninstalled the JRE 1.5 and changed the settings in the Eclipse workbench

It is working now...

Thank you...

Regards
AKumar
Passioner Erin
Greenhorn

Joined: Jun 15, 2006
Posts: 4
The above solution is the best one i.e recompiling the source when there are version differences

Thanks


With Regards<br />Passioner<br />Live with Passion!!
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61451
    
  67

"jaya ajay",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
JavaRanch Sheriff
ramprasad madathil
Ranch Hand

Joined: Jan 24, 2005
Posts: 489

Bear,

Just to clarify, 'Jaya Ajay' is a common name here in India. Its not fictitious

Regards,
Ram.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61451
    
  67

Thanks ramprasad. You gotta admit it looks suspicious. Sort of as if I used "bear raeb".

Jaya, can you send me an email or PM to corrorborate?
Passioner Erin
Greenhorn

Joined: Jun 15, 2006
Posts: 4
Hi Friends!!

I admit the name caused confusion and didn`t gone through the naming rules of the forum!!

But Whats there in the name?

Our main focus is to solve/support/discuss problems related to technology.

(I hope above words are taken in their own respect)
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

"Passioner",
Welcome to the JavaRanch.

We're a friendly group, but we do require members to have valid display names.

Display names must be two words: your first name, a space, then your last name. Fictitious names are not allowed.

Please edit your profile and correct your display name since accounts with display names get deleted.

What's in a name? The invalid ones get deleted, that's what

Dave
[ August 18, 2006: Message edited by: David O'Meara ]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61451
    
  67

Originally posted by David O'Meara:
What's in a name? The invalid ones get deleted, that's what


Indeed. In fact, this is your final warning. Please change your display name to one that is valid prior to your next post in order to avoid having your account disabled.

bear
Forum sheriff
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Error allocating a servlet instance