You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Alex Dovlecel <do...@kbs.twi.tudelft.nl> on 2002/11/24 19:20:12 UTC

Tomcat stuff ...

Sorry for asking this question to this place... it might be out of 
topic... 

I have a SOAP service. I have packed it in a jar file and placed in the 
tomcat/webapps/axis/WEB-INF/lib directory. The service should access the 
myservconfig.xml file. Where should I place this file and how to access it? 

I have tried to put it in the jar archive (root level) and access it with 
Thread.getCurrentThread().getClassLoader().getREsourceAsStream( "/myfile.xml" 
). But this returns null. Resource not found!!! 

I have also tried to deploy the app not as a jar but by copying the files in 
classes directory. And the myfile.xml in classes dir. The same result. 
Resource is not found!!! 

So where is tomcat looking for the resource? It should check at least the 
jar. But it does not!!! (it seems). 

Please give me some ideas or tell me how should I do that... And, if 
possible, as quick as you can... 

Tx alot
dovle



Re: Tomcat stuff ...

Posted by Alex Dovlecel <do...@kbs.twi.tudelft.nl>.
Does axis have its own classloader for loading the services? (I don't think 
so, but it is better to ask some people that are shure about this...) 

Tx 
dovle

> K, I have done all that I could think of... and still does not work... I am
> just trying to get a resource from my jar file!!! What is wrong?
>
> It seems to be a tomcat issue :o((( Or, to be more exact, a tomcat
> classloader issue.
>
> I have made a simple main method wich checks if the /settings.xml resource
> exists. Packed the soap service as a jar and executed the method. The
> method told me the resource is there and could load it!!!
>
> Then I packed my soap service (as jar file), and the settings.xml is in
> root dir of the jar file, I have placed the myser.jar in the <tomcat
> home>/webapps/axis/WEB-INF/lib and called the service.
>
> The init of the service was looking for the /settings.xml file. NOT FOUND
> !!! should check the way tomcat allows me to look for the resources...
> classloader s@@!#cks this time... :o(((
>
> > Those two places will do even though they have specific purpose. In
> > addition to that option, you could create an addition directory, e.g.,
>
> I have tried to place my file settings.xml in axis/../classes. Not
> working...
>
> :o(
> :
> > So you can easily access there by the following code:
> >
> > ServletContext sctx = getServletContext();
> > String wsContextPath = sctx.getRealPath(java.io.File.separator);
>
> Being a SOAP service, I think I cannot get hold of the ServletContext... or
> i can?
>
> Pls tell me what is wrong,
> dovle

Re: Tomcat stuff ...

Posted by Alex Dovlecel <do...@kbs.twi.tudelft.nl>.
K, I have done all that I could think of... and still does not work... I am 
just trying to get a resource from my jar file!!! What is wrong? 

It seems to be a tomcat issue :o((( Or, to be more exact, a tomcat 
classloader issue. 

I have made a simple main method wich checks if the /settings.xml resource 
exists. Packed the soap service as a jar and executed the method. The method 
told me the resource is there and could load it!!! 

Then I packed my soap service (as jar file), and the settings.xml is in root 
dir of the jar file, I have placed the myser.jar in the <tomcat 
home>/webapps/axis/WEB-INF/lib and called the service.

The init of the service was looking for the /settings.xml file. NOT FOUND !!! 
should check the way tomcat allows me to look for the resources... 
classloader s@@!#cks this time... :o((( 

> Those two places will do even though they have specific purpose. In
> addition to that option, you could create an addition directory, e.g.,
I have tried to place my file settings.xml in axis/../classes. Not working... 
:o( 

> So you can easily access there by the following code:
>
> ServletContext sctx = getServletContext();
> String wsContextPath = sctx.getRealPath(java.io.File.separator);
Being a SOAP service, I think I cannot get hold of the ServletContext... or i 
can? 

Pls tell me what is wrong,
dovle

Re: Tomcat stuff ...

Posted by Alex Dovlecel <do...@kbs.twi.tudelft.nl>.
And how can I gent the context from an Axis service??? 

dovle  (no getServletContext() and I think you cannot) 

> Those two places will do even though they have specific purpose. In
> addition to that option, you could create an addition directory, e.g.,
>
> webapps/<webapp context>/conf
>
> where, 'conf' can be replaced whatever you name it.
>
> So you can easily access there by the following code:
>
> ServletContext sctx = getServletContext();
> String wsContextPath = sctx.getRealPath(java.io.File.separator);
>
>
> Pae
>
> > I have had success doing similar things, I place the files in either
> > tomcat/common/classes or tomcat/webapps/axis/WEB-INF/classes, depending
> > on whether more than one service needs access to them.
> >
> > Derek.
> >
> > Alex Dovlecel wrote:
> > >Sorry for asking this question to this place... it might be out of
> > >topic...
> > >
> > >I have a SOAP service. I have packed it in a jar file and placed in the
> > >tomcat/webapps/axis/WEB-INF/lib directory. The service should access the
> > >myservconfig.xml file. Where should I place this file and how to access
>
> it?
>
> > >I have tried to put it in the jar archive (root level) and access it
> > > with Thread.getCurrentThread().getClassLoader().getREsourceAsStream(
>
> "/myfile.xml"
>
> > >). But this returns null. Resource not found!!!
> > >
> > >I have also tried to deploy the app not as a jar but by copying the
> > > files
>
> in
>
> > >classes directory. And the myfile.xml in classes dir. The same result.
> > >Resource is not found!!!
> > >
> > >So where is tomcat looking for the resource? It should check at least
> > > the jar. But it does not!!! (it seems).
> > >
> > >Please give me some ideas or tell me how should I do that... And, if
> > >possible, as quick as you can...
> > >
> > >Tx alot
> > >dovle

Re: Tomcat stuff ...

Posted by Pae Choi <pa...@earthlink.net>.
Those two places will do even though they have specific purpose. In
addition to that option, you could create an addition directory, e.g.,

webapps/<webapp context>/conf

where, 'conf' can be replaced whatever you name it.

So you can easily access there by the following code:

ServletContext sctx = getServletContext();
String wsContextPath = sctx.getRealPath(java.io.File.separator);


Pae


> I have had success doing similar things, I place the files in either
> tomcat/common/classes or tomcat/webapps/axis/WEB-INF/classes, depending
> on whether more than one service needs access to them.
>
> Derek.
>
>
> Alex Dovlecel wrote:
>
> >Sorry for asking this question to this place... it might be out of
> >topic...
> >
> >I have a SOAP service. I have packed it in a jar file and placed in the
> >tomcat/webapps/axis/WEB-INF/lib directory. The service should access the
> >myservconfig.xml file. Where should I place this file and how to access
it?
> >
> >I have tried to put it in the jar archive (root level) and access it with
> >Thread.getCurrentThread().getClassLoader().getREsourceAsStream(
"/myfile.xml"
> >). But this returns null. Resource not found!!!
> >
> >I have also tried to deploy the app not as a jar but by copying the files
in
> >classes directory. And the myfile.xml in classes dir. The same result.
> >Resource is not found!!!
> >
> >So where is tomcat looking for the resource? It should check at least the
> >jar. But it does not!!! (it seems).
> >
> >Please give me some ideas or tell me how should I do that... And, if
> >possible, as quick as you can...
> >
> >Tx alot
> >dovle
> >
> >
> >
>
>


Re: Tomcat stuff ...

Posted by Derek Eichele <ei...@swbell.net>.
I have had success doing similar things, I place the files in either 
tomcat/common/classes or tomcat/webapps/axis/WEB-INF/classes, depending 
on whether more than one service needs access to them.

Derek.


Alex Dovlecel wrote:

>Sorry for asking this question to this place... it might be out of 
>topic... 
>
>I have a SOAP service. I have packed it in a jar file and placed in the 
>tomcat/webapps/axis/WEB-INF/lib directory. The service should access the 
>myservconfig.xml file. Where should I place this file and how to access it? 
>
>I have tried to put it in the jar archive (root level) and access it with 
>Thread.getCurrentThread().getClassLoader().getREsourceAsStream( "/myfile.xml" 
>). But this returns null. Resource not found!!! 
>
>I have also tried to deploy the app not as a jar but by copying the files in 
>classes directory. And the myfile.xml in classes dir. The same result. 
>Resource is not found!!! 
>
>So where is tomcat looking for the resource? It should check at least the 
>jar. But it does not!!! (it seems). 
>
>Please give me some ideas or tell me how should I do that... And, if 
>possible, as quick as you can... 
>
>Tx alot
>dovle
>
>
>