• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

InstantiationException using tomcat4.0 in jsp with beans

 
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i am using tomcat4.0 and jsp and beans.whenever i try to use a bean to instantiate a class via bean on a jsp page using tomcat 4.0 it give me the error InstantiationExcetion and says that the org.apache.jsp.Count(count is the name of my class which i want to import is not instantiated but the point i haven't stored my class is not in the package it says(org.apache.jsp).i have stored it in the following directory of the tomcat folder.c tomcat webapps root web-inf classes.still when i restart the server it give me the same error message.that it cannot find the class at that particular path.
 
Ranch Hand
Posts: 645
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
mihir ,
what i got from u is
u hava a class called Count is following path
c:\tomcat\webapps\root\web-inf\classes.
Now try this add ur class in packge under classess
say mypack
so ur Count.java will b as
package mypack;
........
......
......

and ur class file will be in following path
c:\tomcat\webapps\root\web-inf\classes\mypack.
Lastly add this line to ur jsp page
<%@page import="mypack.*" %>
and njoy ur Count class :-)
Praful
 
Sheriff
Posts: 67749
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since this is Tomcat specific, I'm moving it along to the Tomcat forum.
bear
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The reason this is Tomcat specific, in case anyone was wondering, is that Tomcat will NOT be able to import un-packaged beans into a JSP.

It assigns them instead, to the 'org.apache.jsp' package, which of course, is incorrect.

Simply by packaging them up, everything works fine, as Praful shows you.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic