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 Florent Georges <li...@fgeorges.org> on 2007/08/30 13:45:21 UTC

ClassLoader to look for a resource within META-INF ?

  Hi

  I have just saw the following in AxisDataLocatorImpl,
within loadServiceData():

    String file = "META-INF/" + DRConstants.SERVICE_DATA.FILE_NAME;
    serviceData = util.buildOM(axisService.getClassLoader(), file);

  It sounds strange to me to ask a class loader (that is what
buildOM() will do) for a resource whose the name starts with
"META-INF/".  I thought the directory META-INF stands in was
not intended to be a directory where class loading could be
rooted at, but I am maybe completely wrong.

  To illustrate with a concrete example, I am using WebLogic
8.1sp4 and the looked resource is not found when placed into
the META-INF directory, but it is found if I put it into a
new META-INF directory created within WEB-INF/classes/.  The
resource looked for is ServiceData.xml.

  Did I miss something?

  Regards,

--drkm



























      _____________________________________________________________________________ 
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail 


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: ClassLoader to look for a resource within META-INF ?

Posted by Florent Georges <li...@fgeorges.org>.
Sanka Samaranayke wrote:

  Hi

> IFAIK, in Axis2 world, META-INF folder inside a service
> archive file (e.g. foo.aar) is used to store any metadata
> about the service.

  Yes.  But I have inherited a web application that embeds
the Axis2 engine and doesn't use an AAR to add a service.  The
service's classes were within WEB-INF, as the rest of the
webapp (except axis2-web).  So there was no service's
directory where I could create a META-INF directory.

  So I have changed the structure of the webapp and have created
a directory WEB-INF/services/my-service and have structured it
more like the AAR files are.

  Seems to work like a charm, now.

  Thanks for the idea,

--drkm


























      _____________________________________________________________________________ 
Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail 


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: ClassLoader to look for a resource within META-INF ?

Posted by Sanka Samaranayke <ss...@gmail.com>.
Florent Georges wrote:
>   Hi
>
>   I have just saw the following in AxisDataLocatorImpl,
> within loadServiceData():
>
>     String file = "META-INF/" + DRConstants.SERVICE_DATA.FILE_NAME;
>     serviceData = util.buildOM(axisService.getClassLoader(), file);
>
>   It sounds strange to me to ask a class loader (that is what
> buildOM() will do) for a resource whose the name starts with
> "META-INF/".  I thought the directory META-INF stands in was
> not intended to be a directory where class loading could be
> rooted at, but I am maybe completely wrong.
>   
IFAIK, in Axis2 world, META-INF folder inside a service archive file
(e.g. foo.aar) is used to store any metadata about the service. For 
instances it contains services.xml which specifies static properties of 
the service.

I guess it was this motive to include ServiceData.xml inside META-INF
folder since it specifies service metadata. It is also the understanding that 
any classes or files that belong to a Service should be loaded using 
the ClassLoader of that service. Therefore I don't see any problems with 
the current implementation. Anyway I may be missing something .. 

Thanks,
Sanka


>   To illustrate with a concrete example, I am using WebLogic
> 8.1sp4 and the looked resource is not found when placed into
> the META-INF directory, but it is found if I put it into a
> new META-INF directory created within WEB-INF/classes/.  The
> resource looked for is ServiceData.xml.
>   
>   Did I miss something?
>
>   Regards,
>
> --drkm
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>       _____________________________________________________________________________ 
> Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail 
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
>   


-- 
Sanka Samaranayake
WSO2 Inc.

http://www.bloglines.com/blog/sanka
http://www.wso2.org/


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: ClassLoader to look for a resource within META-INF ?

Posted by Sanka Samaranayke <ss...@gmail.com>.
Florent Georges wrote:
>   Hi
>
>   I have just saw the following in AxisDataLocatorImpl,
> within loadServiceData():
>
>     String file = "META-INF/" + DRConstants.SERVICE_DATA.FILE_NAME;
>     serviceData = util.buildOM(axisService.getClassLoader(), file);
>
>   It sounds strange to me to ask a class loader (that is what
> buildOM() will do) for a resource whose the name starts with
> "META-INF/".  I thought the directory META-INF stands in was
> not intended to be a directory where class loading could be
> rooted at, but I am maybe completely wrong.
>   
IFAIK, in Axis2 world, META-INF folder inside a service archive file
(e.g. foo.aar) is used to store any metadata about the service. For 
instances it contains services.xml which specifies static properties of 
the service.

I guess it was this motive to include ServiceData.xml inside META-INF
folder since it specifies service metadata. It is also the understanding that 
any classes or files that belong to a Service should be loaded using 
the ClassLoader of that service. Therefore I don't see any problems with 
the current implementation. Anyway I may be missing something .. 

Thanks,
Sanka


>   To illustrate with a concrete example, I am using WebLogic
> 8.1sp4 and the looked resource is not found when placed into
> the META-INF directory, but it is found if I put it into a
> new META-INF directory created within WEB-INF/classes/.  The
> resource looked for is ServiceData.xml.
>   
>   Did I miss something?
>
>   Regards,
>
> --drkm
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>       _____________________________________________________________________________ 
> Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail 
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
>   


-- 
Sanka Samaranayake
WSO2 Inc.

http://www.bloglines.com/blog/sanka
http://www.wso2.org/


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org