Discussion:
DependencyManager and car-maven-plugin problem
rwengr
2014-02-21 00:51:14 UTC
Permalink
Geronimo 3.0.1, car-maven-plugin 3.0.1, maven 2.2, JDK 1.6_45 (employer
driven)

The basic problem I have is that I cannot get the car-maven-plugin to
generate a CAR file for Geronimo 3.0.1. As far as I can tell the plugin
boots the geronimo kernel to do the packaging. I believe the root cause of
my problem is that the kernel, in this context, cannot resolve dependencies.

*The question is: When initiated by the car-maven-plugin, how does the
dependency manager
[org.apache.geronimo.system.configuration.DependencyManager] resolve
dependencies? How does one correct deficiencies?*

Once I solve this problem, I should be able to solve the other problem which
is the geronimo/car-maven-plugin cannot find the jar file of my module. I
now create my module as a bundle using maven-bundle plugin.

Details:

The first hint of a problem is the following:

[org.apache.geronimo.gbean.runtime.GBeanSingleReference] : Started
geronimo/packaging/fixed/car?j2eeType=GBean,name=DependencyManager
[org.apache.geronimo.system.configuration.DependencyManager] : did not find
geronimo-plugin.xml for bundle org.eclipse.osgi_3.7.1.R37x_v20110808-1106
[0]
[org.apache.geronimo.system.configuration.DependencyManager] : fail to
resovle artifact from the bundle location System Bundle
[org.apache.geronimo.system.configuration.DependencyManager] : did not find
geronimo-plugin.xml for bundle org.eclipse.osgi_3.7.1.R37x_v20110808-1106
[0]
[org.apache.geronimo.gbean.runtime.GBeanInstance] : Registered gbean
geronimo/packaging/fixed/car?j2eeType=GBean,name=DependencyManager as osgi
service under interfaces [org.apache.geronimo.gbean.GBeanLifecycle,
org.apache.geronimo.system.configuration.DependencyManager,
java.lang.Object, org.osgi.framework.BundleListener,
org.osgi.framework.SynchronousBundleListener, java.util.EventListener] with
properties
{osgi.jndi.service.name=geronimo/packaging/GBean/DependencyManager,
org.apache.geronimo.abstractName=geronimo/packaging/fixed/car?j2eeType=GBean,name=DependencyManager}

But, the following in my pom.xml does not fix it. Yes, I tried it without
scope provided. If you look at the error message, there is a "_" instead of
a "-" between version and rest of the bundle name for org.osgi.eclipse.

<dependency>
<groupId>org.eclipse.osgi</groupId>
<artifactId>org.eclipse.osgi</artifactId>
<version>3.7.1.R37x_v20110808_1106</version>
<type>jar</type>
<scope>provided</scope>
</dependency>

Does the maven repository need some "bundle" work? Does car-maven-plugin
only work under Eclipse?

My process (maven) is:
1) Create jar file containing gbean for module.
2) Package this jar file as bundle.
3) Create car file (includes deployment plan) and install it in my local
maven repository.

Then, I should be able to deploy the module.
Thanks in advance.





--
View this message in context: http://apache-geronimo.328035.n3.nabble.com/DependencyManager-and-car-maven-plugin-problem-tp3987646.html
Sent from the Users mailing list archive at Nabble.com.
rwengr
2014-02-25 16:02:33 UTC
Permalink
The answer to this post is:

For a lot of standard components, this type of error message is not fatal.
Geronimo or the car-maven-plugin can load the basics.

For your target project (e.g. custom plugin) it's a different story.

For Geronimo 3.0.1, to generate CAR packaging, the maven project that
compiles your program must generate a bundle with the dependencies embedded.
During packaging, when the car-maven-plugin boots the geronimo kernel, the
dependency manager will have all the info to resolve the dependencies. It
is no longer sufficient to generate a simple jar artifact. For a basic
Geronimo bean, the plugin to generate the bundle looks like this.

The packaging for the target project must be "bundle" instead of "jar"

The geronimo kernel has no access to maven repository when it processes a
bundle, so the bundle has to contain everything that geronimo is not
providing in its processing container (or already loaded in a previously
processed bundle?). This example is for a project that does compilation and
packaging only (no test).

<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.4.0</version>
<extensions>true</extensions>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>bundle</goal>
</goals>
<configuration>
<unpackBundle>true</unpackBundle>
<instructions>
<Import-Package></Import-Package>

<Export-Package>org.apache.geronimo.directory;version=9.0.2</Export-Package>
<Private-Package></Private-Package>
<Embed-Dependency>*</Embed-Dependency>
<_exportContents></_exportContents>
</instructions>
</configuration>
</execution>
</executions>
<configuration>
</configuration>
</plugin>

The jar file will contain the classes you compiled. Any jars necessary for
compilation should be included in their entireity in the target jar file



--
View this message in context: http://apache-geronimo.328035.n3.nabble.com/DependencyManager-and-car-maven-plugin-problem-tp3987646p3987661.html
Sent from the Users mailing list archive at Nabble.com.
rwengr
2014-03-14 01:56:13 UTC
Permalink
The initial answer to this issue is on Page 32 of Pro Apache Geronimo.

The deployment plan has to declare any Geronimo Bean you want to use as a
reference.

<module xmlns="http://geronimo.apache.org/xml/ns/deployment-1.2">
<environment>
<moduleId>
<groupId>org.apache.geronimo.plugins</groupId>
<artifactId>directory</artifactId>
<version>9.0.2</version>
<type>car</type>
</moduleId>
<dependencies/>
<hidden-classes/>
<non-overridable-classes/>
<private-classes/>
</environment>
<gbean name="ServerInfo"
class="org.apache.geronimo.system.serverinfo.BasicServerInfo">
<attribute name="useSystemProperties">true</attribute>
</gbean>
<gbean name="DirectoryService"
class="org.apache.geronimo.directory.DirectoryGBean">
<attribute name="configFile">var/directory/server.xml</attribute>
<attribute name="workingDir">var/directory</attribute>
<reference name="GeronimoServerInfo"><name>ServerInfo</name></reference>
</gbean>
</module>

My build was missing the "ServerInfo" <gbean>.

How did this happen? The project I checked out from svn.apache.org had this
for the plan and I have not created plugins/car before. Maybe this was OK
in Geronimo 2.1 car-maven-plugin.

<module
xmlns="http://geronimo.apache.org/xml/ns/deployment-${geronimoSchemaVersion}">

<gbean name="DirectoryService"
class="org.apache.geronimo.directory.DirectoryGBean">
<attribute name="configFile">var/directory/server.xml</attribute>
<attribute name="workingDir">var/directory</attribute>
<reference name="ServerInfo"><name>ServerInfo</name></reference>
</gbean>

</module>

I was reluctant to spend much time with books on Geronimo 2.

I verified this solution on a simplified example, but it gets more
interesting. The build for this project is still throwing the same error
even though I corrected my plan. That means there is another issue in my
build or my plan causing a problem. But at least I know now how it's
suppose to work.

I might publish a tutorial when I get done with this.





--
View this message in context: http://apache-geronimo.328035.n3.nabble.com/DependencyManager-and-car-maven-plugin-problem-tp3987646p3987706.html
Sent from the Users mailing list archive at Nabble.com.

Loading...