You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Tomás Tormo <tt...@indenova.com> on 2007/09/03 13:09:21 UTC

Noob needs help with a webservice wich uses resources located in a folder

Hi

  I'm quite noob about tomcat topic. I'm using tomcat 5.028 in Ubuntu 
6.10 and I would like to find an anwer to my question about web services 
because i'm not able to solve it. I've written a java applicattion wich 
uses a wrapper to communicate with an applicattion written in C, wich is 
the "core" of my applicattion. Both the wrapper and the core are third 
party applicattions, and because of that i don't have the source code, I 
just have the API.

The third party sent me an example application wich uses the core. And, 
as I could see in the script wich lauches the application, this folder 
should be added to the classpath in order to be able to be located by 
the wrapper applicattion. The documentation of the wrapper just says 
that this folder has to exist with an specific name.

My problem is that my applicattion works fine launched from shell (it 
founds the folder and uses the core perfectly) but it doesn't work as a 
webservice. It is not able to find the resource folder (let's call it 
"cfg"). As I can see in the catalina log, the application tries to load 
the resources (via ClassLoader I guess) and then launches an exception 
saying that is not able to find it. The client  gets a HTTPErrorCode0.

I've tried a lot of ways to solve it: I tried to launch tomcat with the 
classpath modified from the shell itself(making it point to the folder), 
tried to export the classpath from startup.sh script, tried to export 
the classpath from catalina.sh script, tried to modify the CATALINA_OPTS 
variable, tried to put the folder in both lib and classes folders of the 
webservice folder... but nothing worked.

Please.. could you help me to solve this problem? I think I've tried all 
the options that came to my mind (except declaring a resource in 
server.xml file, altought I don't know If this wrapper uses JNDI to 
access to the resource..).I hope I explained myself well.  As I think 
you can see, I'm quite noob with tomcat, so please don't be so hard with 
your answers... :'-p

Thank you very much!

---------------------------------------------------------------------
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: Noob needs help with a webservice wich uses resources located in a folder

Posted by Tomás Tormo <tt...@indenova.com>.
Hello

 First of all thank you for your answer. The owner of tomcat it's my 
user, but the problem is that my system doesn't have the group (or user) 
tomcat. I tried to launch tomcat as root (just as a test) moving the 
folder to the same place as the .class is, and later the same moving the 
folder to webapps/service/WEB-INF/lib folder... but nothing worked...

any other idea? I'll keep on trying.

Thank you!!

PTS escribió:
> If my quick read of your problem is correct, (only works when run from 
> command line) then I would venture to say that you may have a rights 
> issue. Who owns the app? By default Tomcat starts from the scripts as 
> owner tomcat where as from the command line it is running as you (root 
> or some admin level). Try chown and chgrp the app to tomcat and see if 
> that helps.
>
> No even moving it into the folder does not give Tomcat the rights to 
> access it. You could also change the access rights but I would be 
> careful there as letting anyone execute code is not a good thing, but 
> chgrp to tomcat and group executable would work. Just make sure you 
> understand what the implications of the changes you make are, even on 
> ownership and group membership.
>
> Doug
>
>
> ----- Original Message ----- From: "Tomás Tormo" <tt...@indenova.com>
> To: <us...@tomcat.apache.org>
> Sent: Monday, September 03, 2007 7:09 AM
> Subject: Noob needs help with a webservice wich uses resources located 
> in a folder
>
>
>> Hi
>>
>>  I'm quite noob about tomcat topic. I'm using tomcat 5.028 in Ubuntu 
>> 6.10 and I would like to find an anwer to my question about web 
>> services because i'm not able to solve it. I've written a java 
>> applicattion wich uses a wrapper to communicate with an applicattion 
>> written in C, wich is the "core" of my applicattion. Both the wrapper 
>> and the core are third party applicattions, and because of that i 
>> don't have the source code, I just have the API.
>>
>> The third party sent me an example application wich uses the core. 
>> And, as I could see in the script wich lauches the application, this 
>> folder should be added to the classpath in order to be able to be 
>> located by the wrapper applicattion. The documentation of the wrapper 
>> just says that this folder has to exist with an specific name.
>>
>> My problem is that my applicattion works fine launched from shell (it 
>> founds the folder and uses the core perfectly) but it doesn't work as 
>> a webservice. It is not able to find the resource folder (let's call 
>> it "cfg"). As I can see in the catalina log, the application tries to 
>> load the resources (via ClassLoader I guess) and then launches an 
>> exception saying that is not able to find it. The client  gets a 
>> HTTPErrorCode0.
>>
>> I've tried a lot of ways to solve it: I tried to launch tomcat with 
>> the classpath modified from the shell itself(making it point to the 
>> folder), tried to export the classpath from startup.sh script, tried 
>> to export the classpath from catalina.sh script, tried to modify the 
>> CATALINA_OPTS variable, tried to put the folder in both lib and 
>> classes folders of the webservice folder... but nothing worked.
>>
>> Please.. could you help me to solve this problem? I think I've tried 
>> all the options that came to my mind (except declaring a resource in 
>> server.xml file, altought I don't know If this wrapper uses JNDI to 
>> access to the resource..).I hope I explained myself well.  As I think 
>> you can see, I'm quite noob with tomcat, so please don't be so hard 
>> with your answers... :'-p
>>
>> Thank you very much!
>>
>> ---------------------------------------------------------------------
>> 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
>
>

---------------------------------------------------------------------
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: Noob needs help with a webservice wich uses resources located in a folder

Posted by PTS <pa...@gmail.com>.
If my quick read of your problem is correct, (only works when run from 
command line) then I would venture to say that you may have a rights issue. 
Who owns the app? By default Tomcat starts from the scripts as owner tomcat 
where as from the command line it is running as you (root or some admin 
level). Try chown and chgrp the app to tomcat and see if that helps.

No even moving it into the folder does not give Tomcat the rights to access 
it. You could also change the access rights but I would be careful there as 
letting anyone execute code is not a good thing, but chgrp to tomcat and 
group executable would work. Just make sure you understand what the 
implications of the changes you make are, even on ownership and group 
membership.

Doug


----- Original Message ----- 
From: "Tomás Tormo" <tt...@indenova.com>
To: <us...@tomcat.apache.org>
Sent: Monday, September 03, 2007 7:09 AM
Subject: Noob needs help with a webservice wich uses resources located in a 
folder


> Hi
>
>  I'm quite noob about tomcat topic. I'm using tomcat 5.028 in Ubuntu 6.10 
> and I would like to find an anwer to my question about web services 
> because i'm not able to solve it. I've written a java applicattion wich 
> uses a wrapper to communicate with an applicattion written in C, wich is 
> the "core" of my applicattion. Both the wrapper and the core are third 
> party applicattions, and because of that i don't have the source code, I 
> just have the API.
>
> The third party sent me an example application wich uses the core. And, as 
> I could see in the script wich lauches the application, this folder should 
> be added to the classpath in order to be able to be located by the wrapper 
> applicattion. The documentation of the wrapper just says that this folder 
> has to exist with an specific name.
>
> My problem is that my applicattion works fine launched from shell (it 
> founds the folder and uses the core perfectly) but it doesn't work as a 
> webservice. It is not able to find the resource folder (let's call it 
> "cfg"). As I can see in the catalina log, the application tries to load 
> the resources (via ClassLoader I guess) and then launches an exception 
> saying that is not able to find it. The client  gets a HTTPErrorCode0.
>
> I've tried a lot of ways to solve it: I tried to launch tomcat with the 
> classpath modified from the shell itself(making it point to the folder), 
> tried to export the classpath from startup.sh script, tried to export the 
> classpath from catalina.sh script, tried to modify the CATALINA_OPTS 
> variable, tried to put the folder in both lib and classes folders of the 
> webservice folder... but nothing worked.
>
> Please.. could you help me to solve this problem? I think I've tried all 
> the options that came to my mind (except declaring a resource in 
> server.xml file, altought I don't know If this wrapper uses JNDI to access 
> to the resource..).I hope I explained myself well.  As I think you can 
> see, I'm quite noob with tomcat, so please don't be so hard with your 
> answers... :'-p
>
> Thank you very much!
>
> ---------------------------------------------------------------------
> 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