How to enable logging for a Datanucleus application based on Maven? - maven

My question is pretty straightforward.
Given the following POM:
<build>
<plugins>
<plugin>
<groupId>org.datanucleus</groupId>
<artifactId>maven-datanucleus-plugin</artifactId>
<version>3.0.0-release</version>
<configuration>
<log4jConfiguration>${basedir}/src/main/resources/log4j.properties</log4jConfiguration>
<verbose>true</verbose>
<props>${basedir}/src/main/resources/datanucleus.properties</props>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>DataNucleus_Repos2</id>
<name>DataNucleus Repository</name>
<url>http://www.datanucleus.org/downloads/maven2</url>
</repository>
<repository> <!-- Required for transaction-api transitive dep -->
<id>Java_Net_LEGACY</id>
<name>Java.Net legacy</name>
<url>http://download.java.net/maven/1/</url>
<layout>legacy</layout>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>DataNucleus_2</id>
<url>http://www.datanucleus.org/downloads/maven2/</url>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<scope>runtime</scope>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-api-jdo</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-rdbms</artifactId>
<version>3.0.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.9</version>
</dependency>
<dependency>
<groupId>javax.jdo</groupId>
<artifactId>jdo-api</artifactId>
<version>3.0</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jpa_2.0_spec</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.18</version>
</dependency>
</dependencies>
And given that I have the files log4j.properties and datanucleus.properties in their expected place, when I run
mvn compile
I get (taken from datanucleus.log file)
19:36:11,297 (main) ERROR [DataNucleus.Enhancer] - DataNucleus
Enhancer completed with an error. Please review the enhancer log for
full details. Some classes may have been enhanced but some caused
errors Error creating the MetaDataManager for API "JDO" :
org.datanucleus.exceptions.NucleusException: Error creating the
MetaDataManager for API "JDO" : at
org.datanucleus.NucleusContext.getMetaDataManager(NucleusContext.java:964)
at
org.datanucleus.enhancer.DataNucleusEnhancer.getMetaDataManager(DataNucleusEnhancer.java:261)
at
org.datanucleus.enhancer.DataNucleusEnhancer.getFileMetadataForInput(DataNucleusEnhancer.java:716)
at
org.datanucleus.enhancer.DataNucleusEnhancer.enhance(DataNucleusEnhancer.java:590)
at
org.datanucleus.enhancer.DataNucleusEnhancer.main(DataNucleusEnhancer.java:1390)
Caused by: java.lang.reflect.InvocationTargetException at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown
Source) at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
Source) at java.lang.reflect.Constructor.newInstance(Unknown Source)
at
org.datanucleus.plugin.NonManagedPluginRegistry.createExecutableExtension(NonManagedPluginRegistry.java:681)
at
org.datanucleus.plugin.PluginManager.createExecutableExtension(PluginManager.java:314)
at
org.datanucleus.NucleusContext.getMetaDataManager(NucleusContext.java:958)
... 4 more
Caused by: java.lang.NoSuchFieldError: supportsORM at
org.datanucleus.api.jdo.metadata.JDOMetaDataManager.(JDOMetaDataManager.java:142)
... 11 more
I would like to enable logging to see what queries are being done by my application.
A thing to note is that the enhancement works fine when removing log4j dependency from the POM. Of course, the log file doesn't get updated anymore, but the classes are enhanced.
Any idea related to the above behaviour will be greatly appreciated.

The documentation give a different look of the configuration for the plugin in particular in the executions:
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
which might many problems. Furthermore you should remove the repository definitions from your pom, cause based on a short check all these dependencies are available via maven central. If you really need to configure the repositories you should use a repository manager instead.

Related

Using SoapUI maven plugin with GitLab - dependencies could not be resolved

I've been having some difficulties setting up my SoapUI test in Gitlab pipeline. At first I was successful getting them to run in principle. By now I've added my real tests into the project and got into some problems with JDBC steps. I have both Oracle and Postgres connections in my steps. Can some of you tell me what I'm doing wrong?
At first I was getting connection errors left and right. Then I realized I probably need to add dependencies. I added
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.8</version>
</dependency>
but nothing changed. I also added oracle driver but now I'm getting
[ERROR] Failed to execute goal com.smartbear.soapui:soapui-maven-plugin:5.5.0:test (default) on project dsa-otsusetugi-soapui-tests: Execution default of goal com.smartbear.soapui:soapui-maven-plugin:5.5.0:test failed: Plugin com.smartbear.soapui:soapui-maven-plugin:5.5.0 or one of its dependencies could not be resolved: Failed to collect dependencies at com.smartbear.soapui:soapui-maven-plugin:jar:5.5.0 -> com.oracle:ojdbc8:jar:12.2.0.1.0: Failed to read artifact descriptor for com.oracle:ojdbc8:jar:12.2.0.1.0: Could not transfer artifact com.oracle:ojdbc8:pom:12.2.0.1.0 from/to rmv_repo (http://repo.rmv/nexus/repository/maven-public/): Transfer failed for http://repo.rmv/nexus/repository/maven-public/com/oracle/ojdbc8/12.2.0.1.0/ojdbc8-12.2.0.1.0.pom: Unknown host repo.rmv: Name or service not known -> [Help 1]
What's interesting that I don't get any errors during the download phase..
https://pastebin.com/1HGXytJk
Currently my pom file containing dependencies looks like this:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>blaa.blaah</groupId>
<artifactId>blaa-blaah</artifactId>
<version>1.0-SNAPSHOT</version>
<name>BLAAHSoapUITests</name>
<properties>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<maven.version>3.0.0</maven.version>
<soapui.version>5.5.0</soapui.version>
<surefire.version>2.20</surefire.version>
</properties>
<pluginRepositories>
<pluginRepository>
<id>SmartBearPluginRepository</id>
<url>http://smartbearsoftware.com/repository/maven2/</url>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0.0</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>${project.basedir}/test.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.smartbear.soapui</groupId>
<artifactId>soapui-maven-plugin</artifactId>
<version>${soapui.version}</version>
<configuration>
<soapuiProperties>
<property>
<name>soapui.logroot</name>
<value>${project.basedir}/build-testlog/build-testlog-</value>
</property>
</soapuiProperties>
<projectFile>${project.basedir}/${projectfile}</projectFile>
<projectProperties>
<value>END_POINT=${END_POINT}</value>
<value>USER_ID=${USER_ID}</value>
</projectProperties>
<outputFolder>${project.basedir}/build-testlog</outputFolder>
<printReport>true</printReport>
<junitReport>true</junitReport>
</configuration>
<dependencies>
<dependency>
<groupId>com.smartbear.soapui</groupId>
<artifactId>soapui</artifactId>
<version>${soapui.version}</version>
<exclusions>
<exclusion>
<groupId>javafx</groupId>
<artifactId>jfxrt</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc8</artifactId>
<version>12.2.0.1.0</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.8</version>
</dependency>
<dependency>
<groupId>com.jgoodies</groupId>
<artifactId>forms</artifactId>
<version>1.2.1</version>
</dependency>
</dependencies>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<outputDirectory>${project.basedir}/build/reports/html</outputDirectory>
</reporting>
Am I doing something wrong? Am I using wrong dependencies?
Thanks in advance.
If anyone is facing something similar then my problem, as it turned out, was that Gitlab runner didn't have permission to access the postgres database. It did get the driver, but couldn't connect due to security settings.
Anyhow I still had problems with oracle driver, since it's not publically in smartbear repo. What I did is that I added the driver locally with the help of this tutorial: https://gist.github.com/timmolderez/92bea7cc90201cd3273a07cf21d119eb
So in the end my pom looked something like this:
<pluginRepositories>
<pluginRepository>
<id>SmartBearPluginRepository</id>
<url>https://rapi.tools.ops.smartbear.io/nexus/content/groups/public/</url>
</pluginRepository>
<pluginRepository>
<id>in-project</id>
<name>In Project Repo</name>
<url>file://${project.basedir}/lib</url>
</pluginRepository>
</pluginRepositories>
and
<dependency>
<groupId>oracle</groupId>
<artifactId>ojdbc</artifactId>
<version>6.0</version>
</dependency>
groupId, artifactId and version (also folder names and jar, pom files, of course) named like the tutorial said.

bnd-export-maven-plugin questions

I am using bnd-export-maven-plugin to generate a runnable jar, with the pom.xml defined as follows:
<build>
<sourceDirectory>src</sourceDirectory>
<testSourceDirectory>test</testSourceDirectory>
<testResources>
<testResource>
<directory>test</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</testResource>
</testResources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin-version}</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-maven-plugin</artifactId>
<version>${bnd-maven-plugin-version}</version>
<executions>
<execution>
<id>default-bnd-process</id>
<goals>
<goal>bnd-process</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>biz.aQute.bnd</groupId>
<artifactId>bnd-export-maven-plugin</artifactId>
<version>${bnd-maven-plugin-version}</version>
<configuration>
<failOnChanges>false</failOnChanges>
<bndruns>
<bndrun>com.xyz.masterdata.application.services.bndrun</bndrun>
</bndruns>
</configuration>
<executions>
<execution>
<goals>
<goal>export</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>osgi.annotation</artifactId>
<version>7.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.service.jaxrs</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.service.component.annotations</artifactId>
<version>1.3.0</version>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.service.http.whiteboard</artifactId>
<version>1.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.framework</artifactId>
<version>6.0.3</version>
</dependency>
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-jaxrs2</artifactId>
<version>${swagger-maven-plugin-version}</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>${javax.ws.rs-api-version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>${javax.servlet-api-version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>2.25</version>
</dependency>
<dependency>
<groupId>org.ops4j.pax.jdbc</groupId>
<artifactId>pax-jdbc-mysql</artifactId>
<version>1.3.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.46</version>
</dependency>
<dependency>
<groupId>com.xyz.foundation</groupId>
<artifactId>com.xyz.foundation.common.provider</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.xyz.foundation</groupId>
<artifactId>com.xyz.foundation.common.provider</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.xyz.foundation</groupId>
<artifactId>com.xyz.foundation.web.rest.provider</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.xyz.masterdata.party</groupId>
<artifactId>com.xyz.masterdata.party.logic.provider</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.xyz.masterdata.party</groupId>
<artifactId>com.xyz.masterdata.party.rest.provider</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
</dependencies>
My bndrun file is given here:
-runfw: org.eclipse.osgi;version=3.13
-runee: JavaSE-1.8
-runprovidedcapabilities: ${native_capability}
-resolve.effective: active
-runproperties: \
osgi.console=,\
org.osgi.service.http.port=9001,\
osgi.console.enable.builtin=false
-runrequires: \
osgi.identity;filter:='(osgi.identity=org.apache.felix.gogo.shell)',\
osgi.identity;filter:='(osgi.identity=org.apache.felix.gogo.command)',\
bnd.identity;id='com.mysql.jdbc',\
bnd.identity;id='org.ops4j.pax.jdbc.mysql',\
bnd.identity;id='com.fasterxml.jackson.core.jackson-core',\
bnd.identity;id='com.fasterxml.jackson.core.jackson-databind',\
bnd.identity;id='com.fasterxml.jackson.jaxrs.jackson-jaxrs-base',\
bnd.identity;id='com.fasterxml.jackson.jaxrs.jackson-jaxrs-json-provider',\
bnd.identity;id='com.xyz.foundation.common.provider',\
bnd.identity;id='com.xyz.foundation.web.rest.api',\
bnd.identity;id='com.xyz.foundation.web.rest.provider',\
bnd.identity;id='com.xyz.masterdata.party.logic.provider',\
bnd.identity;id='com.xyz.masterdata.party.rest.provider',\
osgi.identity;filter:='(osgi.identity=com.xyz.masterdata.application.services)'
-runbundles: \
ch.qos.logback.classic;version='[1.2.3,1.2.4)',\
ch.qos.logback.core;version='[1.2.3,1.2.4)',\
com.xyz.masterdata.application.services;version='[1.0.0,1.0.1)',\
com.fourthiq.masterdata.party.logic.provider;version='[0.0.0,0.0.1)',\
com.mysql.jdbc;version='[5.1.46,5.1.47)',\
org.apache.aries.jpa.javax.persistence_2.1;version='[2.7.0,2.7.1)',\
org.apache.felix.configadmin;version='[1.9.8,1.9.9)',\
org.apache.felix.configurator;version='[1.0.6,1.0.7)',\
org.apache.felix.gogo.command;version='[1.0.2,1.0.3)',\
org.apache.felix.gogo.runtime;version='[1.0.10,1.0.11)',\
org.apache.felix.gogo.shell;version='[1.0.0,1.0.1)',\
org.apache.felix.scr;version='[2.1.10,2.1.11)',\
org.ops4j.pax.jdbc.mysql;version='[1.3.5,1.3.6)',\
org.osgi.service.transaction.control;version='[1.0.0,1.0.1)',\
slf4j.api;version='[1.7.25,1.7.26)',\
tx-control-provider-jdbc-xa;version='[1.0.0,1.0.1)',\
tx-control-service-xa;version='[1.0.0,1.0.1)',\
com.fasterxml.jackson.core.jackson-annotations;version='[2.9.8,2.9.9)',\
com.fasterxml.jackson.core.jackson-core;version='[2.9.8,2.9.9)',\
com.fasterxml.jackson.core.jackson-databind;version='[2.9.8,2.9.9)',\
com.fasterxml.jackson.jaxrs.jackson-jaxrs-base;version='[2.9.8,2.9.9)',\
com.fasterxml.jackson.jaxrs.jackson-jaxrs-json-provider;version='[2.9.8,2.9.9)',\
com.xyz.foundation.common.provider;version='[0.0.0,0.0.1)',\
com.xyz.foundation.web.rest.api;version='[0.0.0,0.0.1)',\
com.xyz.foundation.web.rest.provider;version='[0.0.0,0.0.1)',\
org.apache.aries.javax.jax.rs-api;version='[1.0.0,1.0.1)',\
com.xyz.masterdata.party.rest.provider;version='[0.0.0,0.0.1)',\
io.swagger.core.v3.swagger-annotations;version='[2.0.7,2.0.8)',\
org.apache.aries.jax.rs.whiteboard;version='[1.0.1,1.0.2)',\
org.apache.felix.http.jetty;version='[4.0.6,4.0.7)',\
org.apache.felix.http.servlet-api;version='[1.1.2,1.1.3)',\
org.apache.servicemix.specs.annotation-api-1.3;version='[1.3.0,1.3.1)',\
org.osgi.service.jaxrs;version='[1.0.0,1.0.1)',\
org.osgi.util.function;version='[1.1.0,1.1.1)',\
org.osgi.util.promise;version='[1.1.0,1.1.1)',\
tx-control-provider-jpa-xa;version='[1.0.0,1.0.1)'
Unfortunately, I get the following error when launching the application:
randy#MacBook-Pro target % java -jar com.xyz.masterdata.application.services.jar
Exception in thread "main" java.lang.NoClassDefFoundError: org/osgi/framework/ServiceListener
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at aQute.launcher.pre.EmbeddedLauncher.executeWithRunPath(EmbeddedLauncher.java:145)
at aQute.launcher.pre.EmbeddedLauncher.findAndExecute(EmbeddedLauncher.java:106)
at aQute.launcher.pre.EmbeddedLauncher.main(EmbeddedLauncher.java:51)
Caused by: java.lang.ClassNotFoundException: org.osgi.framework.ServiceListener
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 14 more
Note that I may use the referenced .bndrun file to launch the application just fine from within Eclipse, and the application is generated just fine when using gradle.
The maven command I used to build this runnable jar file is simply as follows:
mvn clean package
I have further extracted the content of the runnable jar file, with the following showing embedded jar files.
So it is clear the required jar files are not making it into the runnable jar file. But it is unclear to me why this is.
I am making the transition from gradle to maven, however, and seem to be stuck on this last item. Pointers for resolving are appreciated.
Thanks,
Randy
Maybe you are missing a dependency to the felix framework. Not sure why it then works in bndtools though.
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.framework</artifactId>
<version>6.0.3</version>
</dependency>
I think the problem is that you specify "-runfw: org.eclipse.osgi;version=3.13" which selects the equinox framework. You should use bndtools view to switch to the felix framework.
Maybe it works in eclipse as eclipse runs on equinox .. not sure.

Unable to start jira - Unable to execute mojo exception

I am running JIRA 7.0.2 in my system and Atlassian SDK 6.1.2.
OS-Windows 7
I have my own plugins and when ever I try to run jira by atlas-debug I get this exception.
--- maven-jira-plugin:6.1.2:generate-manifest (default-generate-manifest) # jira-menu-items ---
Generating a manifest for this plugin
using maven-bundle-plugin v2.5.3
Manifest com.atlassian.plugins.tutorial:jira-menu-items:atlassian-plugin:1.1 : The default package '.' is not permitted by the Import-Package syntax.
This can be caused by compile errors in Eclipse because Eclipse creates
valid class files regardless of compile errors.
The following package(s) import from the default package null
Error(s) found in manifest configuration
------------------------------------------------------------------------
BUILD FAILURE
------------------------------------------------------------------------
Total time: 2:32.854s
Finished at: Tue Nov 24 22:24:04 IST 2015
Final Memory: 66M/682M
------------------------------------------------------------------------
Failed to execute goal com.atlassian.maven.plugins:maven-jira-plugin:6.1.2:generate-manifest (default-generate-manifest) on project jira-menu-items: Unable to execute mojo: Error(s) found in manifest configuration -> [Help 1]
To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.
For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
POM.XML
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.atlassian.plugins.tutorial</groupId>
<artifactId>jira-menu-items</artifactId>
<version>1.1</version>
<organization>
<name>Milind Company</name>
<url>http://www.milind.com/</url>
</organization>
<name>jira-menu-items</name>
<description>This is the com.atlassian.plugins.tutorial:jira-menu-items plugin for Atlassian JIRA.</description>
<packaging>atlassian-plugin</packaging>
<dependencies>
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-api</artifactId>
<version>${jira.version}</version>
<scope>provided</scope>
</dependency>
<!-- Add dependency on jira-core if you want access to JIRA implementation classes as well as the sanctioned API. -->
<!-- This is not normally recommended, but may be required eg when migrating a plugin originally developed against JIRA 4.x -->
<!--
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-core</artifactId>
<version>${jira.version}</version>
<scope>provided</scope>
</dependency>
-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.2.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-annotation</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-runtime</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-amps-dispatcher-plugin</artifactId>
<version>5.0.18</version>
</dependency>
<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
<version>1.2.6</version>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
<scope>provided</scope>
</dependency>
<!-- WIRED TEST RUNNER DEPENDENCIES -->
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>1.1.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.2-atlassian-1</version>
</dependency>
<!-- Uncomment to use TestKit in your project. Details at https://bitbucket.org/atlassian/jira-testkit -->
<!-- You can read more about TestKit at https://developer.atlassian.com/display/JIRADEV/Plugin+Tutorial+-+Smarter+integration+testing+with+TestKit -->
<!--
<dependency>
<groupId>com.atlassian.jira.tests</groupId>
<artifactId>jira-testkit-client</artifactId>
<version>${testkit.version}</version>
<scope>test</scope>
</dependency>
-->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-jira-plugin</artifactId>
<version>${amps.version}</version>
<extensions>true</extensions>
<configuration>
<productVersion>${jira.version}</productVersion>
<productDataVersion>${jira.version}</productDataVersion>
<enableQuickReload>true</enableQuickReload>
<enableFastdev>false</enableFastdev>
<instructions>
<Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
<Export-Package>net.gisnas.jira.mailqueue.api,</Export-Package>
<Import-Package>org.springframework.osgi.*;resolution:="optional",
org.eclipse.gemini.blueprint.*;resolution:="optional", *</Import-Package>
<Spring-Context>*</Spring-Context>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
<version>1.2.6</version>
<executions>
<execution>
<goals>
<goal>atlassian-spring-scanner</goal>
</goals>
<phase>process-classes</phase>
</execution>
</executions>
<configuration>
<scannedDependencies>
<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-external-jar</artifactId>
</dependency>
</scannedDependencies>
<verbose>false</verbose>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<jira.version>7.0.2</jira.version>
<amps.version>6.1.2</amps.version>
<plugin.testrunner.version>1.2.3</plugin.testrunner.version>
<atlassian.spring.scanner.version>1.2.6</atlassian.spring.scanner.version>
<!-- This key is used to keep the consistency between the key in atlassian-plugin.xml and the key to generate bundle. -->
<atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
<!-- TestKit version 6.x for JIRA 6.x -->
<testkit.version>6.3.11</testkit.version>
</properties>
</project>
Settings.xml
<settings>
<localRepository>C:\Users\Milind\.m2\repository</localRepository>
<profiles>
<profile>
<id>atlassian-repositories</id>
<repositories>
<repository>
<id>atlassian-proxy</id>
<name>Atlassian Maven 2 Proxy</name>
<url>https://m2proxy.atlassian.com/repository/public</url>
</repository>
<repository>
<id>atlassian-contrib</id>
<name>Atlassian Contrib Repository</name>
<url>https://m2proxy.atlassian.com/contrib</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>atlassian-proxy</id>
<name>Atlassian Maven 2 Proxy</name>
<url>https://m2proxy.atlassian.com/repository/public</url>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>atlassian-repositories</activeProfile>
</activeProfiles>
</settings>
Try to clean up the target directory within your plugin directory or simply use command atlas-clean from plugin directory and run your plugin.
If you've made some changes in pom.xml then before running plugin, you should execute this command first atlas-mvn eclipse:eclipse. Every time you made changes in pom you should execute this command.
Please, check once that your JDK version is 8 because JIRA 7.x will only works with JDK 8.
You've set incompatible version for amps in dependency. Use 6.1.2 instead of 5.x
com.atlassian.maven.plugins
maven-amps-dispatcher-plugin
5.0.18
And if you are trying to debug the code in Eclipse after running JIRA from command then you should specify the port number to attach debugger. Your command will be like this atlas-debug --jvm -debug -port 5005.
Hope this will help you to resolve your problem.

jersey and jackson maven dependency issues?

I have just started building a web app using jersey and jackson. After initially getting up and running I decided that it made sense in the long run to convert the project to be a maven one. I'm very new to maven and it seems like I might have run into a dependency issue between jersey and jackson.
I put together a simple test to check that everything had been set up correctly after running into issues with some of my project tests that use jackson. The user object is based on the one in the jackson tutorial
#Test
public void testJacksonSetup() throws IOException {
String json = "{\"name\":{\"first\":\"Joe\",\"last\":\"Sixpack\"},\"verified\":false,\"gender\":\"MALE\",\"userImage\":\"Rm9vYmFyIQ==\"}";
ObjectMapper mapper = new ObjectMapper();
User user = mapper.readValue(json, User.class);
assertEquals("Joe", user.getName().getFirst());
Writer strWriter = new StringWriter();
mapper.writeValue(strWriter, user);
assertEquals(json, strWriter.toString());
}
which is throwing the following exception
org.codehaus.jackson.type.JavaType.isMapLikeType()Z
java.lang.NoSuchMethodError: org.codehaus.jackson.type.JavaType.isMapLikeType()Z
at org.codehaus.jackson.map.ser.BasicSerializerFactory.buildContainerSerializer(BasicSerializerFactory.java:396)
at org.codehaus.jackson.map.ser.BasicSerializerFactory.buildContainerSerializer(BasicSerializerFactory.java:396)
at org.codeh
I tried running the same test in a simple maven java application to make sure there weren't issues with the way I had set up the jackson dependencies and everything worked. I suspect the problem is caused by some dependency issue between jersey and jackson since it also uses jackson. I also suspect that way I cobbled have the pom file for my web app together could be problem. Here is the content of my pom with some slight naming changes (as I said before I'm new to using maven so I'd say this is a pretty ugly pom file)
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.myproject.app</groupId>
<artifactId>app</artifactId>
<version>0.1-SNAPSHOT</version>
</parent>
<groupId>com.myproject.app</groupId>
<version>${project.parent.version}</version>
<artifactId>my-web-app</artifactId>
<name>My web app</name>
<packaging>war</packaging>
<properties>
<netbeans.hint.deploy.server>gfv3</netbeans.hint.deploy.server>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jersey-version>1.8-SNAPSHOT</jersey-version>
</properties>
<profiles>
<profile>
<id>default</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<dependencies>
<dependency>
<groupId>com.myproject.app</groupId>
<artifactId>myproject-core</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>${jersey-version}</version>
<!--<scope>provided</scope>-->
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-json</artifactId>
<version>${jersey-version}</version>
<!--<scope>provided</scope>-->
</dependency>
<dependency>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>jersey-multipart</artifactId>
<version>${jersey-version}</version>
<!--<scope>provided</scope>-->
</dependency>
<dependency>
<groupId>com.sun.jersey.jersey-test-framework</groupId>
<artifactId>jersey-test-framework-grizzly2</artifactId>
<version>${jersey-version}</version>
<scope>test</scope>
</dependency>
<!-- for external testing -->
<dependency>
<groupId>com.sun.jersey.jersey-test-framework</groupId>
<artifactId>jersey-test-framework-external</artifactId>
<version>${jersey-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.8.2</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-xc</artifactId>
<version>1.8.1</version>
</dependency>
</dependencies>
</profile>
</profiles>
<build>
<finalName>mywebapp</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<packagingExcludes>WEB-INF/glassfish-web.xml</packagingExcludes>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<inherited>true</inherited>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<!-- Run the application using "mvn embedded-glassfish:run" -->
<plugin>
<groupId>org.glassfish</groupId>
<artifactId>maven-embedded-glassfish-plugin</artifactId>
<version>3.1</version>
<configuration>
<goalPrefix>embedded-glassfish</goalPrefix>
<app>${basedir}/target/mywebapp.war</app>
<autoDelete>true</autoDelete>
<port>8080</port>
</configuration>
<dependencies>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.servlet</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.ejb</artifactId>
<version>3.1</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>6.1.24</version>
<configuration>
<webApp>${basedir}/target/mywebapp.war</webApp>
<contextPath>treemetrics-api-01</contextPath>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xslt-maven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<id>update-gf-deps</id>
<phase>package</phase> <!-- append to the packaging phase. -->
<goals>
<goal>transform</goal> <!-- goals == mojos -->
</goals>
<configuration>
<xslFile>src/main/xslt/gf.xsl</xslFile>
<srcDir>.</srcDir>
<srcIncludes>pom.xml</srcIncludes>
<destDir>target/gf-pom-file</destDir>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<pluginRepositories>
<pluginRepository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://download.java.net/maven/2/</url>
<layout>default</layout>
</pluginRepository>
<pluginRepository>
<id>maven2-glassfish-repository.dev.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://download.java.net/maven/glassfish/</url>
</pluginRepository>
</pluginRepositories>
<repositories>
<repository>
<id>glassfish-repository</id>
<name>Java.net Repository for Glassfish</name>
<url>http://download.java.net/maven/glassfish</url>
</repository>
<repository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://download.java.net/maven/2/</url>
<layout>default</layout>
</repository>
</repositories>
Does anyone know what is causing the issues with jackson and If there is a dependency issue with jersey and how to resolve it?
As already mentioned, this is probably a version conflict (error message does suggest that something is compiled against 1.8, but an earlier version is being used somehow).
One thing that I have noticed to cause issues is that versions of "core" and "mapper" jars may differ. In this case, for example, it sounds like mapper version 1.8 was being used, but core jar version was earlier. Although Jackson core jar does define proper version, Maven may not rely on that information but by version some other component mandates.
So whenever specifying dependency to Jackson from your own pom.xml, make sure that versions of core (jackson-asl-core) and mapper (jackson-ask-mapper) are both defined, and have same value (or at least same minor versions, 1.8.x).
I was having the same issue after I upgraded the datanucleus-hbase lib.
My solution was to include the two jackson libs:
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-hbase</artifactId>
<version>3.1.0-m1</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>1.9.4</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.4</version>
</dependency>
The jersey-json dependencies have its own jackson dependency.
For Jersey 1.8 its Jackson 1.7.1. So, start by removing the 1.8.1 and 1.8.2 dependencies, they may cause trouble. Maven is not deterministic: if it encounters two versions of the same dependency (with the same count), the chosen one cannot be predicted.
You don't have to create a JSON string neither to call Jackson mapper yourself. Take a look a this fully working/tested app I've post on GitHub. Hope it will help.

maven axis2 java2wsdl sun.net.util.URLUtil.urlNoFragString error

While trying to run java2wsdl axis2 plugin using maven, i get the following error
[axis2-java2wsdl:java2wsdl {execution: default-cli}]
java.lang.NullPointerException
at sun.net.util.URLUtil.urlNoFragString(URLUtil.java:29)
at sun.misc.URLClassPath.getLoader(URLClassPath.java:292)
at sun.misc.URLClassPath.getResource(URLClassPath.java:168)
at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
my plugin in the pom looks as follows
<plugin>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-java2wsdl-maven-plugin</artifactId>
<configuration>
<className>com.merc.ws.books.BookService</className>
</configuration>
</plugin>
my dependencies are as follows
<dependencies>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2</artifactId>
</dependency>
<!-- Dependencies required by client -->
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-codegen</artifactId>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-http</artifactId>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-transport-local</artifactId>
</dependency>
</dependencies>
Try mvn process-classes instead.
Please, try to run mvn process-classes axis2-java2wsdl:java2wsdl and let me know if it helps.
Executing just mvn process-classes or/and adding
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>java2wsdl</goal>
</goals>
</execution>
</executions>
section (according to Maksim Sorokin) didn't work for me.
Make sure your service.wsdl file is in the right place: src/main/axis2/service.wsdl

Resources