On Nov 10, 2008, at 6:02 PM, ebmm_axis wrote:


So,I've been playing around witht his a little bit more, but I still can't
get it to work...


On the OpenEJB site it states the following:


The service-jar.xml should be placed not in the META-INF but somewhere in your package hierarchy (ours is in /org/apache/openejb/service- jar.xml) which allows the services in your service-jar.xml to be referenced by name (such as DefaultStatefulContainer) or more specifically by package and id
(such as org.apache.openejb#DefaultStatefulContainer).

I have a jar that I have copied to the lib subdirectory with a file called
service-jar.xml.

I don'tknow if the syntax of the service-jar.xml is right or not, but this
is what I've found around the net...

<ServiceProvider
   id="myId"
   provider-type="Resource"
   class-name="org.myclass.myclass.TheClassIWantToUse">
</ServiceProvider>

In my openejb-jar.xml config file I have the following:

<Resource id="defaultResource" type="TheClassIWantToUse" provider="myId">
</Resource>

This is really close, you just need to add the package part to the 'provider' attribute. So if you put it at META-INF/com.foo/service- jar.xml, the provider id would be "com.foo#myId".

That said, there might be a simpler way to do what you want overall. The service-jar.xml stuff is really geared towards plugging in something that needs to be configurable. If you simply want an instance of a specific class injected you can create a property editor for it as described here: http://openejb.apache.org/3.0/custom-injection.html .

Let us know if that helps. Also, feel free to go into detail on the kind of thing you're looking to add to the system as we definitely use that feedback to drive features. We've talked about enhancements to the service-jar.xml/openejb.xml functionality as well as specific enhancements for j2ee connector configuration and more.

-David

Reply via email to