Hi all,
i tried to build a J2EE library to "pack" some utility classes together, which should only exist once in the container (generic sorting, filtering of context elements and more). I succeeded finally, but i'm not sure, if this is "legal" anyway or if there's a better way to achieve this. The library looks like this:
1. The classes are contained in one single jar at the moment, just for sake of simplicity. This will change in the future.
2. Since some of the utility classes are referencing WD-classes (like WDRuntimeException) again, an outgoing weak reference to the webdnypro service is defined. The Weak Reference appliance matrix in: http://help.sap.com/saphelp_nw04/helpdata/de/9a/4e4f3e065de946e10000000a114084/content.htm says, this is illegal for a library? On the other hand, there are some libraries like the "Remote Profile Library", which also have outgoing service references.
Here's the provider.xml file:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE provider-descriptor SYSTEM "library.provider.dtd"> <provider-descriptor> <display-name>libtest2</display-name> <component-name>libtest2</component-name> <major-version>1</major-version> <minor-version>0</minor-version> <micro-version>0</micro-version> <provider-name>ascoit.de</provider-name> <references> <reference provider-name="engine.sap.com" strength="weak" type="service">webdynpro</reference> </references> <jars> <jar-name>asco-it.de~java~test~proj~deploy.jar</jar-name> </jars> </provider-descriptor>
Any help is appreciated.
Regards
Stefan
Hi Stefan,
A possible solution would be to package the helper classes as Web Dynpro application, and all other users to reference it.
The problem with having reference from a library to a service can be different, one for example is that all libraries are initialized first during the start of the server (when the Web Dynpro or any other service are not available).
Hope that helps!
Karin
Hi Stefan,
You assumed it already, this is not "legal". The architecture of the layering is libraries <- services <- applications, and usages in the other direction often lead to troubles. Sometimes we get lifecycle troubles (especially when referencing applications from services) because of this which are hard and time consuming to debug. So it might be turned off eventually.
Best regards,
Karin
Hi Stefan,
At my client we did just as Karin suggested and packaged all our helper classes into a Web Dynpro development component. Web Dynpro DC do not need to have any visualization pieces.
The only thing to remember (as I'm sure it has been pointed out elsewhere) is to add the Web Dynpro Sharing Reference to the Web Dynpro DC in the using applications as well as the build time DC reference.
Hope this helps,
--Greg
Add a comment