J2EE Libraries, Workshop, and You
Chris Hogue's Blog |
June 8, 2007 11:44 AM
|
Comments (2)
With the 9.0 release WLS introduced a new feature called Shared
J2EE Libraries--sometimes also called J2EE Libraries, or Library Modules. J2EE
Libraries are typically fully valid J2EE modules that are simply deployed with a
flag to indicate it's a library. See the link for details on what they are.
Why would you care? If you're using Workshop for WebLogic, then a lot of the maintenance
of your project is dramatically eased by the use of J2EE Libraries. Instead of dropping
a collection of jars such as Struts and it's dependencies in the WEB-INF/lib folder,
you just reference the Struts J2EE library and it's all taken care of for you. And
if you're using a layered product like WLP or WLI then you're using even more as
these products make extensive use of J2EE Libraries.
This post presents a quick list of the top 3 things you should know about J2EE
Libraries and how they work in the IDE.
List of Available J2EE Libraries
You can find the list of pre-loaded J2EE Libraries through the Window > Preferences
> WebLogic > J2EE Libraries page. By default the libraries that BEA products
ship will be shown here. Notice that you can also add your own libraries to the
list--a prerequisite to using them in a project.
Adding a Reference to a J2EE Library
Actually you can do this a couple of ways. The easiest is to select the right facets
when creating a project. Facets will do all the setup of the libraries for you.
For example, if you create a Dynamic Web Project and select the Struts facet, you'll
get a project that looks something like this.
Notice that it shows a reference to the struts-1.2 library. The node under the
Java Resources > Libraries tree is called a classpath container and is the bit
that makes the classes in that library available on your build-time classpath.
You'll also notice a listing of the J2EE Libraries in the WebLogic Deployment Descriptor
(i.e. weblogic.xml). This is the reference that makes it available to your application
at runtime.
References can also be added after project creation and without the use of facets.
Because there are a couple of places to modify to add the reference, rather than
trying to add them in all the right places simply open the Project Explorer. On
the WebLogic Deployment Descriptor > J2EE Libraries node, select Add... When
you add a library reference from here the IDE will do all the setup for you.
Auto-Deployment
When you have J2EE Library references on a project, the IDE will help you deploy
them to your development server. If your domain does not already have the required
library deployed, the IDE will deploy it for you automatically. So if you add Struts
for example, and are developing against a plain WLS domain that doesn't already
have the library deployed, it will automatically be deployed for you when you publish
your project.
Awareness of this feature is important because when you go to deploy your project
to another server you will have to make sure the right libraries are deployed on
that server.
I hope this information is helpful--more on J2EE Libraries later...
Comments
Comments are listed in date ascending order (oldest first) | Post Comment
-
Hi Chris,
I agree with you that this is a great feature. However for some reason, these deployable libraries have not been deployed in our environments (dev, qa, prod, etc) yet (WebLogic9.2).
So when I create my web service in workshop, I also used annotation based Control framework (@Control) and I specified DO NOT use shared libraries, copy all reference jar files into my ear file's lib folder (WBE-INF/lib) whenever necessary. However, when I deploy the ear file to the server (in dev for instance) I still got the following error:
javax.enterprise.deploy.model.exceptions.DDBeanCreateException: [J2EE Deployment SPI:260142]The descriptor at 'META-INF/annotation-manifest.xml' in module 'IAAEventRouter.war' is not recognized, and could not be parsed.
So my question is:
Is this because the library files ("weblogic-controls-1.0" and "beehive-controls-1.0" for example) need to be deployed regardless if I want to use the control framework? If not then what's the workround solution besides specify "Do not use shared library"?
Thanks,
Gang Li
Posted by: ganglican on November 22, 2007 at 1:19 PM
-
Gang,
Do you have any utility projects in your application ?
cheers
-Raj
Posted by: akraj on November 26, 2007 at 2:00 PM
|