Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old October 25th, 2002, 10:15 PM
ghatzhat ghatzhat is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Posts: 361 ghatzhat User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 9 m 5 sec
Reputation Power: 7
tomcat can't see beans

i have recently been working on a tomcat 4.0.4 install, and to get my beans to work i had to include the name of the bean class in the "import" directive at the top of the page. i thought this was odd at the time, as no examples i've seen did this, but it worked.

now i have tomcat 4.1.10 (enforced by the deployment environment) and it complains about me trying to import the bean classes (it asks for a period, presumably because it expects me to be importing a package). So i remove the import of the bean class, but then i get "can't resolve symbol" errors when i try to use the bean.

my web app has its context set in server.xml, there's a WEB-INF folder with classes and lib folders within it, and my compiled .class files live in the classes folder.

I think you'll agree, this has "classpath problem" written all over it, but i thought tomcat automatically looked in WEB-INF/classes without it being configured anywhere.

Can anyone help me help my tomcat find its beans?

[my java environment is 1.4.0, my OS is RH7.3]
__________________
Little more than a playground for the bugs that live beneath us...

Reply With Quote
  #2  
Old October 25th, 2002, 11:14 PM
bricker42 bricker42 is offline
Moderator =(8^(|)
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2002
Location: Sacramento, CA
Posts: 1,710 bricker42 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 38 sec
Reputation Power: 8
Send a message via AIM to bricker42
Simplest method: put them in a package.

It's not hard, and it will save you no end of headaches.

Say your package is com.devshed.funky.beans.

Create a folder structure like: WEB-INF/classes/com/devshed/funky/beans, and put all your beans in there.

Then the first (non-comment) line in each of your beans needs to be package com.devshed.funky.beans;.

It really causes headaches when everything is in the default package. I think that's because your jsps are in the org.apache.jasper package (I think), and so it looks for your beans in the same package (or something like that).
__________________
-james

Last edited by bricker42 : October 25th, 2002 at 11:17 PM.

Reply With Quote
  #3  
Old October 26th, 2002, 04:24 AM
ghatzhat ghatzhat is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Posts: 361 ghatzhat User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 9 m 5 sec
Reputation Power: 7
many thanks, bricker42/james, worked a treat.

this is not the first time you have come to my aid... much appreciated.

what gets me is why it didn't work with vanilla classes in the 'classes' folder - all the docs say to just throw them in there, so i did... is this a bug in that version of tomcat, or is it the same with more recent versions? someone needs to get to the bottom of this.

<rant>
i'm getting cheesed off with java/jsp etc - it just doesn't live up to the much vaunted "write once, run anywhere" description. we're trying to deploy my app and are running up against all sorts of problems with versioning, security etc. i guess it's partly my novicedom, but i am seriously thinking about crawling back to my PHP world and never venturing into Java land again.
</rant>

Reply With Quote
  #4  
Old October 26th, 2002, 11:11 PM
bricker42 bricker42 is offline
Moderator =(8^(|)
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2002
Location: Sacramento, CA
Posts: 1,710 bricker42 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 38 sec
Reputation Power: 8
Send a message via AIM to bricker42
Ya, versioning can be a real pain with java.

I suppose it wouldn't be too much different with php, though. Don't develop for 4.2 and deploy with 4.0.6 .

Reply With Quote
  #5  
Old October 27th, 2002, 10:27 AM
ghatzhat ghatzhat is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Posts: 361 ghatzhat User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 9 m 5 sec
Reputation Power: 7
having calmed down, i realise it's just a familiarity thing. like, i can reel off that the PHP superglobals came along at 4.1.0 and that register globals defaulted to off at 4.2.0, and that nothing worked in PHP3 ( ! ), but i'm not so proficient in java land.

that said, i did my docs for my app, which had to describe the development enviroment, and when i'd finished, i realised that i'd given versions for (wait for it): apache, mod_jk, j2sdk, mysql, mm.mysql, tomcat.

surely there has to be a better way...!

Reply With Quote
  #6  
Old October 27th, 2002, 03:38 PM
bricker42 bricker42 is offline
Moderator =(8^(|)
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2002
Location: Sacramento, CA
Posts: 1,710 bricker42 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 38 sec
Reputation Power: 8
Send a message via AIM to bricker42
I'm surprised you didn't need to specify a version for j2ee.

And if you really wanted to, you could cut apache and mod_jk out of your app (probably), then it would closer to php. The only difference would be the jdbc driver.

One nice thing with java is that you can package your app into a .war file, which makes installing it on a new system WAY easier.

Reply With Quote
  #7  
Old October 28th, 2002, 01:54 AM
ghatzhat ghatzhat is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2002
Posts: 361 ghatzhat User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 9 m 5 sec
Reputation Power: 7
Quote:
I'm surprised you didn't need to specify a version for j2ee.

j2sdk -> j2se

i couldn't spot the difference/additional benefit between .war files and the expanded structure - is there any?

the jdbc driver was a sticking point - the server had an app running on mm.mysql version 1.2! the craziest thing is that this app has just been developed! i think we're gonna keep the 1.2 driver for the other app and sling my 2.0.10 (or maybe 2.0.14) into the WEB-INF/lib folder of my app so that we have the best of both worlds....

...and we did decide to cut apache and mod_jk out of the equation!

i guess i've learnt something for the next time: get the entire versioning of the deployment environment signed off before dev work begins...

Reply With Quote
  #8  
Old October 28th, 2002, 10:03 AM
bricker42 bricker42 is offline
Moderator =(8^(|)
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2002
Location: Sacramento, CA
Posts: 1,710 bricker42 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 38 sec
Reputation Power: 8
Send a message via AIM to bricker42
The advantage of .war files is for distribution, really. They're easier to install than a .jar or .zip archive (since the app server handles the unpacking).

I just think that's a more convenient way of distributing an application to a different server.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > tomcat can't see beans


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway