Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

SAL and AO dependecies

Peter Faber January 27, 2013

Hi,

I'm trying to set up a plugin for Jira 5.1.8 using both SAL and Active Objects (AO).

Unfortunately, if I try to import the ao service i get following error:

[INFO] [talledLocalContainer] org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ao': FactoryBean threw exception on object creation; nested exception is
 java.lang.LinkageError: loader constraint violation: loader (instance of org/springframework/osgi/context/internal/classloader/ChainedClassLoader) previously initiated loading for a different type with name "com/atlassian/sal/api/transaction/TransactionCallback"

I guess it has to do with OSGi not beeing able to resolve a conflict between SAL and AO.

Here's my atlassian-plugin.xml:

<atlassian-plugin> 
...

    <ao key="ao-module">
        <entity>${project.groupId}.${project.artifactId}.ao.WorklogScheduler</entity>
    </ao>

    <component-import key="translator" interface="com.atlassian.sal.api.message.I18nResolver" />
    <component-import key="ao" name="Active Objects service" interface="com.atlassian.activeobjects.external.ActiveObjects">
        <description>Component to access Active Objects functionality from the plugin</description>
        </component-import>
    <component-import key="applicationProperties" interface="com.atlassian.sal.api.ApplicationProperties" />

</atlassian-plugin>

And my pom.xml:

...

    <dependencies>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-api</artifactId>
            <version>${jira.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.activeobjects</groupId>
            <artifactId>activeobjects-plugin</artifactId>
            <version>${ao.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.sal</groupId>
            <artifactId>sal-api</artifactId>
            <version>${sal.version}</version>
            <scope>provided</scope>
        </dependency>
        
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.10</version>
            <scope>test</scope>
        </dependency>

    <build>
        <plugins>
            <plugin>
                <groupId>com.atlassian.maven.plugins</groupId>
                <artifactId>maven-jira-plugin</artifactId>
                <version>${amps.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <pluginArtifacts>

                        <pluginArtifact>
                            <groupId>com.atlassian.activeobjects</groupId>
                            <artifactId>activeobjects-plugin</artifactId>
                            <version>${ao.version}</version>
                        </pluginArtifact>
                        <pluginArtifact>
                            <groupId>com.atlassian.activeobjects</groupId>
                            <artifactId>activeobjects-jira-spi</artifactId>
                            <version>${ao.version}</version>
                        </pluginArtifact>
                    </pluginArtifacts>
                    <productVersion>${jira.version}</productVersion>
                    <productDataVersion>${jira.version}</productDataVersion>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <properties>
        <jira.version>5.1.8</jira.version>
        <amps.version>4.1.2</amps.version>
        <sal.version>2.6.0</sal.version>
        <ao.version>0.19.7</ao.version>

    </properties>

Any help greatly appreciated!

4 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Peter Faber January 28, 2013

Seems that my IDE packaged some dependencies in my plugin.jar which coaused the conflict.

Deleting the target directory and rebuilding from scratch (altlas-run) solved the problem

ConradR
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 28, 2013

atlas-clean is always a good idea for those kind of conflicts! :)

Anton Kozyr April 14, 2013

I'm experiencing very similar problem but atlas-clean / atlas-run doesn't help.

Here is an error message:

[INFO] [talledLocalContainer] org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ao': FactoryBean threw exception on object creation; nested exception is java.lang.LinkageError: loader constraint violation: loader (instance of org/springframework/osgi/context/internal/classloader/ChainedClassLoader) previously initiated loading for a different type with name "net/java/ao/RawEntity"

The bit from pom.xml:

<properties>
        <confluence.version>4.3.7</confluence.version>
        <confluence.data.version>4.3.7</confluence.data.version>
        <amps.version>4.1.6</amps.version>
        <ao.version>0.20</ao.version>
    </properties>

And here is configuration of AO from atlassian-plugin.xml:

<component-import key="ao" name="Active Objects service" interface="com.atlassian.activeobjects.external.ActiveObjects">
		<description>Component to access Active Objects functionality from the plugin</description>
	</component-import>

	<ao key="ao-module">
		<description>Module configuring the Active Object service</description>
		<entity>com.ourcompany.atlassian.OurEntity</entity>
	</ao>

OurEntity implements RawEntity (I think it's where I get this LinkageError), but how else I can implement entity then? I can use Entity, but I need String ID. If I remove both configuration elements from atlassian-plugin.xml, plugin fails to initialise one of components, because of dependency on ActiveObjects bean.

0 votes
MaximeC July 31, 2014

It works for me, thank you Lukasz

I added net.java.ao, in my obr generation descriptor (in my pom.xml) and it works.

<instructions>
<Import-Package>
			javax.xml.datatype,
			javax.xml.parsers,
			org.xml.sax,
			org.w3c.dom,
			javax.ws.rs,
			javax.xml.bind,
			net.java.ao,
		*;resolution:=optional,
		</Import-Package>
		<Private-Package>
			com.atlassian.upm.license.storage.lib*
            			</Private-Package>
	(...)

0 votes
Łukasz_Krupa
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 25, 2013

I face the same problem and the reason was a missing import for net.java.ao package.

You can search MANIFEST.MF for net.java.ao and extend it appropriately to you package version.

0 votes
Anton Kozyr April 14, 2013

I'm experiencing very similar problem but atlas-clean / atlas-run doesn't help.

Here is an error message:

[INFO] [talledLocalContainer] org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ao': FactoryBean threw exception on object creation; nested exception is java.lang.LinkageError: loader constraint violation: loader (instance of org/springframework/osgi/context/internal/classloader/ChainedClassLoader) previously initiated loading for a different type with name "net/java/ao/RawEntity"

The bit from pom.xml:

<properties>
        <confluence.version>4.3.7</confluence.version>
        <confluence.data.version>4.3.7</confluence.data.version>
        <amps.version>4.1.6</amps.version>
        <ao.version>0.20</ao.version>
    </properties>

And here is configuration of AO from atlassian-plugin.xml:

<component-import key="ao" name="Active Objects service" interface="com.atlassian.activeobjects.external.ActiveObjects">
		<description>Component to access Active Objects functionality from the plugin</description>
	</component-import>

	<ao key="ao-module">
		<description>Module configuring the Active Object service</description>
		<entity>com.ourcompany.atlassian.OurEntity</entity>
	</ao>

OurEntity implements RawEntity (I think it's where I get this LinkageError), but how else I can implement entity then? I can use Entity, but I need String ID. If I remove both configuration elements from atlassian-plugin.xml, plugin fails to initialise one of components, because of dependency on ActiveObjects bean.

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events