Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Illegal constant pool type  RSS feed

 
Alessandro Ilardo
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there,
I've got this error on my servlet, which runs on Tomcat 5.0.28


javax.servlet.ServletException: Error allocating a servlet instance
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:300)
org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:374)
org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:743)
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:675)
org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:866)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
java.lang.Thread.run(Thread.java:534)



java.lang.ClassFormatError: virtual_lab/eu/controller/news/NewsController (Illegal constant pool type)
java.lang.ClassLoader.defineClass0(Native Method)
java.lang.ClassLoader.defineClass(ClassLoader.java:539)
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1634)
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:860)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1307)
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1189)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:300)
org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:374)
org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:743)
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:675)
org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:866)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
java.lang.Thread.run(Thread.java:534)

Ant clue?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could this be a Java version conflict?

Which compiler created the class and which JVM is running the servlet container?

Bill
 
Alessandro Ilardo
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
thank your for your reply. Unfortunatly, it is not (I suppose) the JVM version, for two reasons:
1. The servlet worked, till two weeks ago.
2. The IDE, is NetBeans 5.5.1 and the compiler version (Source version) is set on 1.4. Tomcat has 1.4.2

What actually means and what may cause this exception?

Thanks in advance

[ December 18, 2007: Message edited by: Alessandro Ilardo ]
[ December 18, 2007: Message edited by: Alessandro Ilardo ]
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the servlet worked until two weeks ago, the obvious question is "what changed in your system?"

Are you adding new functions to the servlet involving new classes? A new library? Where did the

come from? Compiled on the same machine or a different one?

What changed in the server configuration files?

Bill
 
Alessandro Ilardo
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
that's a good question. The server admin, simply said: "nothing has changed...."

back to my question, what that exception actually means??
 
Herman Schelti
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Alessandro,

I had this error once: a few bytes appeared to be missing after I uploaded classes to the server. Maybe you should check this.

And when does this happen: if the application starts, or if you access a certain url?

Herman
 
Alessandro Ilardo
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It just happens on a specific url (only that servlet mentioned in the exception trace)

Should I try to restart the instance or upload again the servlet?
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[Alessandro]: back to my question, what that exception actually means??

Well, have you looked at the JavaDoc for that error? "Thrown when the Java Virtual Machine attempts to read a class file and determines that the file is malformed or otherwise cannot be interpreted as a class file." Fundamentally, there's some incompatibility between the compiler that created your class file, and the JVM which is trying to interpret that class file. If it was as big as the difference between JDK 1.4 and JDK 5, or some other version, you probably would have gotten a different message, like "java.lang.UnsupportedClassVersionError: Test (Unsupported major.minor version 50.0)" Instead, you've probably got some incompatibility between JDK 1.4.x and JDK 1.4.y. (whatever x and y are.) One this probably has a bug of some sort. I suggest you try to find the exact version number of both the compiler and JVM, and upgrade whichever one is older.
 
Alessandro Ilardo
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I removed some comments along the code. It works properly now.
Thanks to all for your support and marry Christmas.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I doubt very much that the comments had anything to do with it.

Probably the recompile and upload of replacement class file fixed the problem.

Bill
 
Alessandro Ilardo
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, I confirm that removing some lines (obliviously not program code ) from the source code solved the problem.
The previous attempt were in fact: start e stop Tomcat and upload the class file in order to exclude file corruption.

Instead, I would consider, lines too long.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!