aspose file tools*
The moose likes JSP and the fly likes Stupid, stupid, stupid problem importing a javabean :( Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Stupid, stupid, stupid problem importing a javabean :(" Watch "Stupid, stupid, stupid problem importing a javabean :(" New topic
Author

Stupid, stupid, stupid problem importing a javabean :(

Simon Harvey
Ranch Hand

Joined: Jan 26, 2003
Posts: 79
Hello chaps,
I am having a seriously irritating experience trying to get one of my jsp pages to use a javabean that I've made and I cant seen to figure out what is going on:
I have an import statement at the top of the jsp page which is:

The actual class is in WEB-INF/classes/util/data/
and is called DataTools. The package statement at the top of class file is:
package util.data

Can anyone please tell me if there is anything wrong with that? I'm actually hoping that there is because at least that would be easy to fix!
If anyone else has any suggestions about why a jsp cant see a javabean in the classes directory then that would be greatly appreciated.
Many thanks all
Simon
Ron Newman
Ranch Hand

Joined: Jun 06, 2002
Posts: 1056
What is the error you are getting?


Ron Newman - SCJP 1.2 (100%, 7 August 2002)
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

Yeah, need the error to be certain, but one guess is that your import needs to be:

hth,
bear


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Simon Harvey
Ranch Hand

Joined: Jan 26, 2003
Posts: 79
Sorry guys,
The error is basically just that it can't find my database helper class:

I can't figure out what I need to change. I think its going to be something veyr simple though
Simon Harvey
Ranch Hand

Joined: Jan 26, 2003
Posts: 79
Ok,
Something deeply deeply PANTS is going on with my poor little kitty cat.
Because I wanted to do some testing on the easist and simplest example of using a bean, i created a really simple bean and put it in the classes directory, so, no need to use a package name, and therefore no chance of me getting it wrong!
But it still doesn't work!
What this seems to mean is my jsp pages for whatever reason, can't see into the classes directory in order to instantiate beans. HUMPH!
Does anyone have any ideas at all why that might happen? Even if its a longshot then I'm really at that stage!
Please help, if not for my sake, then think about whats going to happen to this beautiful LG 19 inch monitor. OH THE HUMANITY!
ahem. Thanks
Simon
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61413
    
  67

The following says it all:
[javac] bad class file: C:\tomcat 4.1\webapps\qds\WEB-INF\classes\util\data\DataTools.class
[javac] class file contains wrong class: WEB-INF.classes.util.data.DataTools

Your class file is fu'd. You somehow got javac to think that WEB-INF.classes is part of your package hierarchy. You need to rethink how you are building this class.
hth,
bear
Craig Jackson
Ranch Hand

Joined: Mar 19, 2002
Posts: 405
Yes, it appears the compiler/vm is expecting the class file util.data.DataTools.class, but is getting something else. For example, it is like you took some other class file and copy/renamed it to util.data.DataTools.class.
I would verify your structure/hierarchy and recomple util.data.DataTools.java, hopefullly that will clear up your problem.
Craig.
Simon Harvey
Ranch Hand

Joined: Jan 26, 2003
Posts: 79
Hi guys,
Thanks for your advice. I'm wondering why or how that could have happened. I mean, all I've been doing is recompiling the code as I go along - nothing fancy. The other thing is remember was that I had a really simple javabean and put it into the classes file so that i wouldnt need to use any packages, and that didnt work either (or actually it maybe worked the first time but not after)?
Do you have any ideas what may have happened.
Two questions:
Whenever I make a new jsp page do i need to restart the container (tomcat)?
Whenever I recompile the javabean that a jsp page uses, do i need to restart.
And are their any rules about restatting when you are making or changing servlets
Thanks guys!
Simon
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Stupid, stupid, stupid problem importing a javabean :(