You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Nathan S. Haigh" <n....@sheffield.ac.uk> on 2007/06/20 15:18:37 UTC

classpath and public_html directories

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I'm pretty new to Java and tomcat and can't seem to figure this out.

I have an application that works fine under:
/usr/local/tomcat/weapps/app_name

However, when I put it into a user's home directory e.g.
/home/user_name/public_html/app_name

I get a lot of errors (shown at end). Are these to do with tomcat not
being ale to find some of the classes? be gentle when explaining the
CLASSPATH as I'm pretty new to this!

Cheers
Nath


org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 7 in the generated java file
Only a type can be imported.
org.apache.commons.fileupload.servlet.ServletFileUpload resolves to a
package

An error occurred at line: 8 in the generated java file
Only a type can be imported.
org.apache.commons.fileupload.disk.DiskFileItemFactory resolves to a package

An error occurred at line: 9 in the generated java file
Only a type can be imported. org.apache.commons.io.FilenameUtils
resolves to a package

An error occurred at line: 13 in the generated java file
Only a type can be imported. db.Modify resolves to a package

An error occurred at line: 14 in the generated java file
Only a type can be imported. db.MassList resolves to a package

An error occurred at line: 15 in the generated java file
Only a type can be imported. db.Mass resolves to a package

An error occurred at line: 16 in the generated java file
Only a type can be imported. db.Adducts resolves to a package

An error occurred at line: 17 in the generated java file
Only a type can be imported. db.AdductCollection resolves to a package

An error occurred at line: 18 in the generated java file
Only a type can be imported. massIO.FileHandler resolves to a package
[ -- snip -- ]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGeSksczuW2jkwy2gRAgGaAJ9qgwH/fPlHqEmF0apKRgYjvJ327ACgk0UI
ihFhB4tCjatQRE9aIQwc6sw=
=WuaT
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: classpath and public_html directories

Posted by "Nathan S. Haigh" <n....@sheffield.ac.uk>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Caldarale, Charles R wrote:
>> From: Nathan S. Haigh [mailto:n.haigh@sheffield.ac.uk] 
>> Subject: Re: classpath and public_html directories
>>
>> Doesn't tomcat set the classpath itself using the bin/setclasspath.sh
>> script?
> 
> Yes, but depending on the version of Tomcat it will either ignore or
> extend CLASSPATH, so you want to make sure the variable is null before
> running the scripts.

Upon starting tomcat, the setclasspath.sh clears out the CLASSPATH

> 
>>             homeBase="/home"
>> userClass="org.apache.catalina.startup.PasswdUserDatabase"/>
> 
> I haven't tried it, but the doc implies you need:
> 
>     userClass="org.apache.catalina.startup.HomesUserDatabase"

I have changed this as you/docs suggest.

- -- snip --

Still no joy! :(

I've just found out what the CLASSPATH is that tomcat is using during
startup:
:/usr/local/tomcat/bin/bootstrap.jar:/usr/local/tomcat/bin/commons-logging-api.jar

does this look correct?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD4DBQFGeUgpczuW2jkwy2gRAmvuAKCUSMs2SLQeHJwq+A8HfxzBI+Ty2gCYmOFa
oUPBztjmz0U5vBb8xWnolg==
=xWuS
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: classpath and public_html directories

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Nathan S. Haigh [mailto:n.haigh@sheffield.ac.uk] 
> Subject: Re: classpath and public_html directories
> 
> Doesn't tomcat set the classpath itself using the bin/setclasspath.sh
> script?

Yes, but depending on the version of Tomcat it will either ignore or
extend CLASSPATH, so you want to make sure the variable is null before
running the scripts.

>             homeBase="/home"
> userClass="org.apache.catalina.startup.PasswdUserDatabase"/>

I haven't tried it, but the doc implies you need:

    userClass="org.apache.catalina.startup.HomesUserDatabase"

when specifying a homeBase attribute; the PasswdUserDatabase class looks
only in the /etc/passwd file identify the users.

> It appears to me that tomcat knows about those jar files put und
> tomcat_home/webapps/appname/WEB-INF/lib but not those relative to a
> WEB-INF directory like /home/*/public_html/appname/WEB-INF/lib

Correct - you normally need an appname.xml file in conf/Catalina/[host]
to tell Tomcat where the app is located.  The contents of said file
should be something like this:

<Context docBase="/home/[user]/public_html/appname" />

The UserConfig Listener creates these <Context> elements internally,
avoiding the need to build one maually for every user.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: classpath and public_html directories

Posted by "Nathan S. Haigh" <n....@sheffield.ac.uk>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Caldarale, Charles R wrote:
>> From: Nathan S. Haigh [mailto:n.haigh@sheffield.ac.uk] 
>> Subject: Re: classpath and public_html directories
>>
>>> Seriously messing with the CLASSPATH environment
>>> variable will cause loads of headaches.  Best to
>>> just not mess with it and let tomcat ignore it.
>> That's fine - I haven't touched it! :)
> 
> But other program installations may have (e.g., QuickTime on Windows
> sets it globally).  It should be removed before attempting to run
> Tomcat.

Lucky I'm running Debian! :)

Doesn't tomcat set the classpath itself using the bin/setclasspath.sh
script?

> 
>> Also, one thing that puzzles me, is that this works fine in the tomcat
>> installation webapp dir at /usr/local/tomcat/webapps/appname
>>
>> But not under public_html in a user's directory.
> 
> Permissions problem?

I don't think so, they have the same group/other permissions as the
files under /usr/local/tomcat/webapps/appname

> 
> When you deploy in /home/user_name/public_html/app_name, you must have
> set up a conf/Catalina/[host]/appname.xml file; what does that look
> like?


I haven't got a file like this. However, I did modify conf/server.xml to
contain:
<Host ...>
	<!-- reload servlets when .class files change -->
        <DefaultContext reloadable="true"  />
	
        <Listener className="org.apache.catalina.startup.UserConfig"
            directoryName="public_html"
            homeBase="/home"
            userClass="org.apache.catalina.startup.PasswdUserDatabase"/>
</Host>

- From what I read, I thought that this would be enough to get tomcat
server webapps from /home/*/public_html/appname. But no joy! :(

It appears to me that tomcat knows about those jar files put under
tomcat_home/webapps/appname/WEB-INF/lib but not those relative to a
WEB-INF directory like /home/*/public_html/appname/WEB-INF/lib

Cheers
Nath

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGeTvuczuW2jkwy2gRAn5/AKC8y5z/wjPnI61Clg663QniR7uAjACcD8Jj
h+yusgc9jnm7jfBrj4HI8J0=
=m9ZB
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: classpath and public_html directories

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Nathan S. Haigh [mailto:n.haigh@sheffield.ac.uk] 
> Subject: Re: classpath and public_html directories
> 
> > Seriously messing with the CLASSPATH environment
> > variable will cause loads of headaches.  Best to
> > just not mess with it and let tomcat ignore it.
> 
> That's fine - I haven't touched it! :)

But other program installations may have (e.g., QuickTime on Windows
sets it globally).  It should be removed before attempting to run
Tomcat.

> Also, one thing that puzzles me, is that this works fine in the tomcat
> installation webapp dir at /usr/local/tomcat/webapps/appname
> 
> But not under public_html in a user's directory.

Permissions problem?

When you deploy in /home/user_name/public_html/app_name, you must have
set up a conf/Catalina/[host]/appname.xml file; what does that look
like?

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: classpath and public_html directories

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Nathan S. Haigh [mailto:n.haigh@sheffield.ac.uk] 
> Subject: Re: classpath and public_html directories
> 
> Now, the next question is, does that mean that each user can only have
> one webapp!?

That appears to be the case; effectively, each user *is* a webapp.
Shouldn't be too hard to write your own userClass for the <Host>
Listener to implement whatever scheme you want.  The existing code looks
pretty simple, so extending it doesn't look difficult.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: classpath and public_html directories

Posted by "Nathan S. Haigh" <n....@sheffield.ac.uk>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Caldarale, Charles R wrote:

- -- snip --

> 
> I haven't tried this yet, but I think the CIMMS_user directory shouldn't
> be there.  My understanding of the doc is that the HomesUserDatabase
> Listener creates one webapp (docBase) per user - not an appBase per
> user.  Try moving everything under CIMMS_user to public_html - eliminate
> the CIMMS_user level.

Yeah! This worked!!

Now, the next question is, does that mean that each user can only have
one webapp!? I would have thought it should be possible to have:
~/public_html/webapp1
~/public_html/webapp2
etc

without having to explicitly define this in the tomcat config files. For
my current setup - this isn't much of a problem, but it would be nice to
know if this can be setup.


> 
>> I have no conf/Catalina dir at all.
> 
> Tomcat doesn't create it unless needed.
> 
>> Could you point me to a step-by-step install of tomcat 6
>> and how to setup users public_html areas and I can check
>> if I have done this correctly.
> 
> I think you're already aware of this:
> http://tomcat.apache.org/tomcat-6.0-doc/config/host.html#User%20Web%20Ap
> plications
> 
> [Note to Mark T: the above still contains a reference to
> DefaultContext.]
> 
>> It just seems odd that it works from the tomcat 
>> home but not the users public_html area!
> 
> One problem might be the <DefaultContext> element you've added to your
> <Host> - that has not been valid for some time.  The proper location for
> such parameters is in:
>     $CATALINA_HOME/conf/context.xml

Thanks, I've moved this also.

> or
>     $CATALINA_HOME/conf/[enginename]/[hostname]/context.xml.default
> as documented in:
> http://tomcat.apache.org/tomcat-6.0-doc/config/context.html#Introduction
> 
> However, I doubt that it's causing the results you're seeing.
> 
>  - Chuck
> 
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGeo8E2PljpJuieWURAvxOAKCCDrIkB8/jhacPhIcY0uftoQV4jgCZAbdS
AXrStuun/4egJyokaxHAAwQ=
=ckoP
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: classpath and public_html directories

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Nathan S. Haigh [mailto:n.haigh@sheffield.ac.uk] 
> Subject: Re: classpath and public_html directories
> 
> Surely, each webapp directory should e totally independent!?

Yes, they are.  Each webapp uses a separate classloader.

> Could the jar files in
> /home/user/public_html/CIMMS_user/WEB-INF/lib
> be conflicting with
> /usr/local/tomcat/webapps/CIMMS/WEB-INF/lib

No, they wouldn't conflic.

I haven't tried this yet, but I think the CIMMS_user directory shouldn't
be there.  My understanding of the doc is that the HomesUserDatabase
Listener creates one webapp (docBase) per user - not an appBase per
user.  Try moving everything under CIMMS_user to public_html - eliminate
the CIMMS_user level.

> I have no conf/Catalina dir at all.

Tomcat doesn't create it unless needed.

> Could you point me to a step-by-step install of tomcat 6
> and how to setup users public_html areas and I can check
> if I have done this correctly.

I think you're already aware of this:
http://tomcat.apache.org/tomcat-6.0-doc/config/host.html#User%20Web%20Ap
plications

[Note to Mark T: the above still contains a reference to
DefaultContext.]

> It just seems odd that it works from the tomcat 
> home but not the users public_html area!

One problem might be the <DefaultContext> element you've added to your
<Host> - that has not been valid for some time.  The proper location for
such parameters is in:
    $CATALINA_HOME/conf/context.xml
or
    $CATALINA_HOME/conf/[enginename]/[hostname]/context.xml.default
as documented in:
http://tomcat.apache.org/tomcat-6.0-doc/config/context.html#Introduction

However, I doubt that it's causing the results you're seeing.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: classpath and public_html directories

Posted by "Nathan S. Haigh" <n....@sheffield.ac.uk>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

David Smith wrote:

 -- snip --
> 
>>>> Also your log indicates you have packages declared the same name as some
>>>> of your classes.  Modify, MassList, Mass, Adducts, and AdductList should
>>>> be declared to be of package db, not db.Modify for example.  Same goes
>>>> for masIO.FileHandler -- should be declared of package massIO, not
>>>> massIO.FileHandler.
>>>>     
> 
> I think you may be incorrect with this. I have double checked, and they
> are all declared as the correct package and not as package.class as you
> suggest (unless I misunderstand). e.g. at the top of my
> massIO.FileHandler class I have:
> "package massIO;"
> 
> Is this what you mean?
>   
>> Well.. yes.  The error about trying to use a package name as a type has
>> to come from somewhere.  I've never seen it show up unless the jvm is
>> really finding a package name matching the declared type.  Not knowing
>> more about your setup, I'll let you explore that one.

I think this is the root of all my prolems - it would be good if you
could help me to find this problem - I'm happy to post any info you need
in order to help me find the problem.

> 
> Also, one thing that puzzles me, is that this works fine in the tomcat
> installation webapp dir at /usr/local/tomcat/webapps/appname
> 
> But not under public_html in a user's directory.
> 
>   
>> Well... my last thought is there is another webapp of the same name
>> visible to tomcat and there's some confusion about which one is active. 
>> Make sure the one you had in tomcat's webapps directory is really gone
>> and you have restarted tomcat.  Also make sure you don't have a
>> appname.xml file in the conf/Catalina/localhost directory of tomcat
>> conflicting with your webapp in public_html.

This app is from my svn repository and I have a few other similarly
named apps in the tomcat home webapps dir and in my own user space.
Surely, each webapp directory should e totally independent!? Could the
jar files in /home/user/public_html/CIMMS_user/WEB-INF/lib be
conflicting with /usr/local/tomcat/webapps/CIMMS/WEB-INF/lib

I have no conf/Catalina dir at all.

Could you point me to a step-by-step install of tomcat 6 and how to
setup users public_html areas and I can check if I have done this
correctly. It just seems odd that it works from the tomcat home but not
the users public_html area!

Cheers
Nathan
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGeic1czuW2jkwy2gRAp5DAJ9RU18MxTLO/AdYtC7lXyYxI+qMsACguxo7
2azLundpAVUFv8YNxIHP5n0=
=g1wr
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: classpath and public_html directories

Posted by David Smith <dn...@cornell.edu>.
Reply inline -


Nathan S. Haigh wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> David Smith wrote:
>   
>> Hi Nathan.
>>
>> If setup properly, the location of your webapp shouldn't cause issues
>> with finding various classes.  Just don't mention that dirty, dirty word
>> CLASSPATH  :-).  Seriously messing with the CLASSPATH environment
>> variable will cause loads of headaches.  Best to just not mess with it
>> and let tomcat ignore it.
>>     
>
> That's fine - I haven't touched it! :)
>   

Just making sure.  I cringe when I see that word -- it always brings 
trouble.
>   
>> You can find information on tomcat's classloader structure at
>> http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html
>> (assuming you are using tomcat 5.5).  Each version of tomcat has it's
>> own version of this document.
>>     
>
> I recently installed tomcat 6.0.13 and running with JVM version 1.6.0_01-b06
>
> I'll have a look at this doc now.
>   

Then the default classloader structure will be simpler than what was in 
tomcat 5.5.  The two important directories will be your webapp's 
WEB-INF/lib folder and tomcat's own /lib folder.
>   
>> The errors you are getting indicate your webapp can't find
>> commons-fileupload.jar and commons-io.jar.  Those should be stored in
>> WEB-INF/lib of your webapp.
>>     
>
> here are the files in WEB-INF/lib:
> commons-fileupload-1.1.1.jar
> commons-io-1.2.jar
> mysql-connector-java-3.1.10-bin.jar
>
> does it matter they have their version number in their filenames?
>
>   
Nope.  The name of the jars makes no impact (other than they have to 
have the .jar file extension).  Check permissions.  Best way I've found 
is to sudo to the tomcat user account and attempt to access the jars in 
your webapp.  Then you'll get the exact same response in your terminal 
shell that tomcat would get.

>> Also your log indicates you have packages declared the same name as some
>> of your classes.  Modify, MassList, Mass, Adducts, and AdductList should
>> be declared to be of package db, not db.Modify for example.  Same goes
>> for masIO.FileHandler -- should be declared of package massIO, not
>> massIO.FileHandler.
>>     
>
> I think you may be incorrect with this. I have double checked, and they
> are all declared as the correct package and not as package.class as you
> suggest (unless I misunderstand). e.g. at the top of my
> massIO.FileHandler class I have:
> "package massIO;"
>
> Is this what you mean?
>   
Well.. yes.  The error about trying to use a package name as a type has 
to come from somewhere.  I've never seen it show up unless the jvm is 
really finding a package name matching the declared type.  Not knowing 
more about your setup, I'll let you explore that one.

> Also, one thing that puzzles me, is that this works fine in the tomcat
> installation webapp dir at /usr/local/tomcat/webapps/appname
>
> But not under public_html in a user's directory.
>
>   
Well... my last thought is there is another webapp of the same name 
visible to tomcat and there's some confusion about which one is active.  
Make sure the one you had in tomcat's webapps directory is really gone 
and you have restarted tomcat.  Also make sure you don't have a 
appname.xml file in the conf/Catalina/localhost directory of tomcat 
conflicting with your webapp in public_html.

--David

> I'll read that webpage while I await a response.
> Thanks
> Nath
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFGeTSJczuW2jkwy2gRAiypAKC3jKW0s/6ZerYCE5dgnJWVz8vcTgCglzy3
> MGoahlleptf24M+0fTICy6g=
> =7CSs
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>   


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: classpath and public_html directories

Posted by "Nathan S. Haigh" <n....@sheffield.ac.uk>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

David Smith wrote:
> Hi Nathan.
> 
> If setup properly, the location of your webapp shouldn't cause issues
> with finding various classes.  Just don't mention that dirty, dirty word
> CLASSPATH  :-).  Seriously messing with the CLASSPATH environment
> variable will cause loads of headaches.  Best to just not mess with it
> and let tomcat ignore it.

That's fine - I haven't touched it! :)

> 
> You can find information on tomcat's classloader structure at
> http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html
> (assuming you are using tomcat 5.5).  Each version of tomcat has it's
> own version of this document.

I recently installed tomcat 6.0.13 and running with JVM version 1.6.0_01-b06

I'll have a look at this doc now.

> 
> The errors you are getting indicate your webapp can't find
> commons-fileupload.jar and commons-io.jar.  Those should be stored in
> WEB-INF/lib of your webapp.

here are the files in WEB-INF/lib:
commons-fileupload-1.1.1.jar
commons-io-1.2.jar
mysql-connector-java-3.1.10-bin.jar

does it matter they have their version number in their filenames?

> 
> Also your log indicates you have packages declared the same name as some
> of your classes.  Modify, MassList, Mass, Adducts, and AdductList should
> be declared to be of package db, not db.Modify for example.  Same goes
> for masIO.FileHandler -- should be declared of package massIO, not
> massIO.FileHandler.

I think you may be incorrect with this. I have double checked, and they
are all declared as the correct package and not as package.class as you
suggest (unless I misunderstand). e.g. at the top of my
massIO.FileHandler class I have:
"package massIO;"

Is this what you mean?

Also, one thing that puzzles me, is that this works fine in the tomcat
installation webapp dir at /usr/local/tomcat/webapps/appname

But not under public_html in a user's directory.

I'll read that webpage while I await a response.
Thanks
Nath
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGeTSJczuW2jkwy2gRAiypAKC3jKW0s/6ZerYCE5dgnJWVz8vcTgCglzy3
MGoahlleptf24M+0fTICy6g=
=7CSs
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: classpath and public_html directories

Posted by David Smith <dn...@cornell.edu>.
Hi Nathan.

If setup properly, the location of your webapp shouldn't cause issues 
with finding various classes.  Just don't mention that dirty, dirty word 
CLASSPATH  :-).  Seriously messing with the CLASSPATH environment 
variable will cause loads of headaches.  Best to just not mess with it 
and let tomcat ignore it.

You can find information on tomcat's classloader structure at 
http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html 
(assuming you are using tomcat 5.5).  Each version of tomcat has it's 
own version of this document.

The errors you are getting indicate your webapp can't find 
commons-fileupload.jar and commons-io.jar.  Those should be stored in 
WEB-INF/lib of your webapp.

Also your log indicates you have packages declared the same name as some 
of your classes.  Modify, MassList, Mass, Adducts, and AdductList should 
be declared to be of package db, not db.Modify for example.  Same goes 
for masIO.FileHandler -- should be declared of package massIO, not 
massIO.FileHandler.

--David

Nathan S. Haigh wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> I'm pretty new to Java and tomcat and can't seem to figure this out.
>
> I have an application that works fine under:
> /usr/local/tomcat/weapps/app_name
>
> However, when I put it into a user's home directory e.g.
> /home/user_name/public_html/app_name
>
> I get a lot of errors (shown at end). Are these to do with tomcat not
> being ale to find some of the classes? be gentle when explaining the
> CLASSPATH as I'm pretty new to this!
>
> Cheers
> Nath
>
>
> org.apache.jasper.JasperException: Unable to compile class for JSP:
>
> An error occurred at line: 7 in the generated java file
> Only a type can be imported.
> org.apache.commons.fileupload.servlet.ServletFileUpload resolves to a
> package
>
> An error occurred at line: 8 in the generated java file
> Only a type can be imported.
> org.apache.commons.fileupload.disk.DiskFileItemFactory resolves to a package
>
> An error occurred at line: 9 in the generated java file
> Only a type can be imported. org.apache.commons.io.FilenameUtils
> resolves to a package
>
> An error occurred at line: 13 in the generated java file
> Only a type can be imported. db.Modify resolves to a package
>
> An error occurred at line: 14 in the generated java file
> Only a type can be imported. db.MassList resolves to a package
>
> An error occurred at line: 15 in the generated java file
> Only a type can be imported. db.Mass resolves to a package
>
> An error occurred at line: 16 in the generated java file
> Only a type can be imported. db.Adducts resolves to a package
>
> An error occurred at line: 17 in the generated java file
> Only a type can be imported. db.AdductCollection resolves to a package
>
> An error occurred at line: 18 in the generated java file
> Only a type can be imported. massIO.FileHandler resolves to a package
> [ -- snip -- ]
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFGeSksczuW2jkwy2gRAgGaAJ9qgwH/fPlHqEmF0apKRgYjvJ327ACgk0UI
> ihFhB4tCjatQRE9aIQwc6sw=
> =WuaT
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>   


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org