GWT using ActiveMQ through Spring problems - spring

I have a standalone Spring command and control application that broadcasts system status using ActiveMQ through the Spring JMS API. This works fine, I have tested it and have a test client program that can register to listen to the topic.
I also have a Spring based GWT application and I am trying to have it register to one of the ActiveMQ topics so it can receive status messages from the C&C application. In the GWT project, I have an applicationContext.xml under WEB-INF:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:amq="http://activemq.apache.org/schema/core"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://activemq.apache.org/schema/core
http://activemq.apache.org/schema/core/activemq-core-5.2.0.xsd">
<amq:topic id="embedded.sysModel" physicalName="org.apache.activemq.spring.embedded.sysmodel" />
</beans>
When I run the GWT application from Eclipse I get the following error(s).
15:16:20,067 ERROR [org.springframework.web.context.ContextLoader] -
Context initialization failed
org.springframework.beans.factory.parsing.BeanDefinitionParsingException:
Configuration problem: Unable to locate Spring NamespaceHandler for
XML schema namespace [http://activemq.apache.org/schema/core]
Offending resource: ServletContext resource
[/WEB-INF/applicationContext.xml]
Now at this point I do not even have any code in the GWT app that is referencing ActiveMQ or the Spring JMS Template. I did at first, but I backed everything out to find the first point of failure. And it appears to be the amq:topic line. If I comment that line out of the applicationContext.xml file, my GWT app initializes and runs just fine.
Here is my pom.xml for GWT
<?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">
<!-- POM generated by gwt-maven-plugin archetype -->
<modelVersion>4.0.0</modelVersion>
<groupId>gui-spring-gwt</groupId>
<artifactId>ourappgui</artifactId>
<packaging>war</packaging>
<version>2.0</version>
<properties>
<!-- convenience to define GWT version in one place -->
<gwt.version>2.4.0</gwt.version>
<spring.version>3.0.6.RELEASE</spring.version>
<!-- tell the compiler we can use 1.5 -->
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
</properties>
<dependencies>
<!-- GWT dependencies (from central repo) -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwt.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
<!-- test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>10.5.3.0_1</version>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derbyclient</artifactId>
<version>10.5.3.0_1</version>
</dependency>
</dependencies>
<build>
<outputDirectory>war/WEB-INF/classes</outputDirectory>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>2.3.0-1</version>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>${gwt.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>generateAsync</goal>
<goal>test</goal>
</goals>
</execution>
</executions>
<configuration>
<runTarget>pevcogui.html</runTarget>
</configuration>
</plugin>
<!-- If you want to use the target/web.xml file mergewebxml produces,
tell the war plugin to use it. Also, exclude what you want from the final
artifact here. <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId>
<configuration> <webXml>target/web.xml</webXml> <warSourceExcludes>.gwt-tmp/**</warSourceExcludes>
</configuration> </plugin> -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1-beta-1</version>
<configuration>
<warSourceDirectory>war</warSourceDirectory>
</configuration>
</plugin>
</plugins>
</build>
</project>

The problem is that the xsd for http://activemq.apache.org/schema/core can't be found. activemq.xsd is part of the activemq-core-xxx.jar, and will be found when this jar is in your classpath. But you don't have a dependency on that.
So add the dependency to activemq-core if you use xmlns:amq:
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-core</artifactId>
<version>5.5.0</version><!-- or whatever version you use -->
</dependency>

It seems that this problem is rooted in the Eclipse GWT plugin. I found this post : Spring NamespaceHandler issue when launching Maven-based GWT App from Eclipse IDE after migration to Spring 3 which discussed a similar problem. This post on the Spring forum is talks about a similar problem with spring-security.
My workaround is to run the GWT app from the command line using "mvn gwt:run". Launching this way keeps the classpath intact. I get a successful build using maven at the cmd line and I can deploy to Glassfish. Its only when launching from within Eclipse that I get the error.

Related

Spring boot with Minio Client:okhttp3.RequestBody.create([BLokhttp3/MediaType;)Lokhttp3/RequestBody; didn't exist error

I am trying to connect to minio server by using minio client in spring boot. Getting this error:
An attempt was made to call a method that does not exist. The attempt
was made from the following location:
io.minio.S3Base.<clinit>(S3Base.java:104)
The following method did not exist:
okhttp3.RequestBody.create([BLokhttp3/MediaType;)Lokhttp3/RequestBody;
The method's class, okhttp3.RequestBody, is available from the
following locations:
jar:file:/home/user/.m2/repository/com/squareup/okhttp3/okhttp/3.14.4/okhttp-3.14.4.jar!/okhttp3/RequestBody.class
It was loaded from the following location:
file:/home/user/.m2/repository/com/squareup/okhttp3/okhttp/3.14.4/okhttp-3.14.4.jar
Action:
Correct the classpath of your application so that it contains a
single, compatible version of okhttp3.RequestBody
Process finished with exit code 0
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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.tigerit.tigerhrm</groupId>
<artifactId>tigerit-hrm-api</artifactId>
<version>beta-1.4.0</version>
<!--<packaging>jar</packaging>-->
<packaging>war</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.0.RELEASE</version>
<!-- <!– https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-parent –>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.0</version>-->
</parent>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<other lib versions here>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
//some_dependecies are removed to reduce the file size
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<!-- log4j -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${logger.version}</version>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.7</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-fileupload/commons-fileupload -->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.12.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.minio/minio-->
<dependency>
<groupId>io.minio</groupId>
<artifactId>minio</artifactId>
<version>8.3.9</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp -->
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>3.14.4</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.mysema.maven</groupId>
<artifactId>apt-maven-plugin</artifactId>
<version>1.1.3</version>
<executions>
<execution>
<goals>
<goal>process</goal>
</goals>
<configuration>
<outputDirectory>target/generated-sources</outputDirectory>
<processor>com.querydsl.apt.jpa.JPAAnnotationProcessor</processor>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
I am using java 8.
I tried without com.squareup.okhttp3 dependency added in the pom.xml file too. Not working for both cases.
Solution:
Try overriding the okhttp3.version property in your pom and set it to a newer version of the com.squareup.okhttp3:okhttp dependency (4.10.0 works for me). Or just explicitly set this dependency yourself.
Or rather, if at all feasible, try updating your starter-parent version (not sure if this would work with java 8 though).
Reasoning:
The reason for maven (or, in my case, gradle) fetching an older version of okhttp library is the unfortunate pinning of this particular library version in spring boot dependencies in versions before 2.7:
<okhttp3.version>3.14.9</okhttp3.version>
In 2.7 they changed it to 4.9.3.

Generating RESTful Webservices from entity classes in a netbeans maven webapp causes app to fail, displaying "Payara Server, deploy, null, false"

I want to make a persistence microservice for my application with jee 8.The resource endpoint works well with a simple PersistenceResource class. I have generated the entities from the mysql database and the app still works fine. Unfortunately, the moment i generate 'RESTful WebServices from entity classes' payara server fails to run. The message in the server log is
Deploying on Payara Server
profile mode: false
debug mode: false
force redeploy: true
In-place deployment at /home/nkengasong/NetBeansProjects/CreatixxPersistence/target/CreatixxPersistence
Payara Server, deploy, null, false
The same error is displayed when i generate Session Beans For Entity Classes. Please what might be the problem? I have been searching the internet for hours now.
The app is a traditional maven-archetype-webapp and i am using:
NetBeans IDE 9.0
Payara Server
Java EE 8
Open JDK 11
Ubuntu 18.04 lts (same problem on windows 10)
Below is my pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
<groupId>com.jee8ng</groupId>
<artifactId>CreatixxPersistence</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>CreatixxPersistence Maven Webapp</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<failOnMissingWebXml>false</failOnMissingWebXml>
</properties>
<dependencies>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.core</artifactId>
<version>2.5.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.asm</artifactId>
<version>2.5.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.antlr</artifactId>
<version>2.5.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa</artifactId>
<version>2.5.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa.jpql</artifactId>
<version>2.5.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
<version>2.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa.modelgen.processor</artifactId>
<version>2.5.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>8.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.json</groupId>
<artifactId>javax.json-api</artifactId>
<version>1.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.json.bind</groupId>
<artifactId>javax.json.bind-api</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.16</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.13</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>CreatixxPersistence</finalName>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.0.0</version>
</plugin>
<!-- see http://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_war_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20.1</version>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.0</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
</plugins>
</pluginManagement>
</build>
This is the structure of the app:
Here is the structure of the application
I seriously need help! Please why is that the app stops running when i generate the webservices or sessions? How can i remedy this? Thanks in advance
Payara server is not yet fully compatible with JDK 11. You still need a JDK 8 version.
I finally solved the problem by switching to NetBeans 8.2 and changing the default #XmlTransient annotation on certain fields of the entity classes to #JsonbTransient
(this avoids stackoverflow error, if you intend to use JSON instead of XML). By default, when you generate entity classes from the database, certain fields get annotated with #XmlTransient. I switched netbeans because apparently NetBeans IDE 9.0 is not stable. I hope this helps someone. Thanks to everyone for you help!

Unable to start plugin: Unable to resolve 167.0: missing requirement [167.0] osgi.wiring.package; (osgi.wiring.package=com.atlassian.inject)

I'm using the latest version of the atlassian SDK to develop a plugin for JIRA. I've already written a large portion of my code, and have added a handful of dependencies that I required to the pom.xml file of my project (see below).
Unfortunately, upon running atlas-run to start my local JIRA environment, it fails to load my plugin due the following error:
'com.COMPANY.COMPANY-worklog-plugin' - 'COMPANY-worklog-plugin' failed to load.
[INFO] [talledLocalContainer] Cannot start plugin: com.COMPANY.COMPANY-worklog-plugin
[INFO] [talledLocalContainer] Unresolved constraint in bundle com.COMPANY.COMPANY-plugin [167]: Unable to resolve 167.0: missing requirement [167.0] osgi.wiring.package; (osgi.wiring.package=com.atlassian.inject)
[INFO] [talledLocalContainer]
[INFO] [talledLocalContainer]It was loaded from C:\Project\COMPANY-worklog-plugin\target\jira\home\plugins\installed-plugins\COMPANY-worklog-plugin-1.0.0-SNAPSHOT.jar
I've been plagued with the same kinds of errors for a few days now, including the following: (which I managed to fix by adding the dependency to my POM):
[INFO] [talledLocalContainer]Unresolved constraint in bundle com.maxxton.worklog-plugin [167]: Unable to resolve 167.0: missing requirement [167.0] osgi.wiring.package; (osgi.wiring.package=bsh)
I've tried the following things:
Re-generating my plugin with the Atlassian Framework, which worked until I re-added my dependencies
Removing and re-adding my dependencies to see where the error lays. Couldn't manage to find out if there's a faulty dependency or not.
Changing the scopes of my external dependencies (provided-> compile and back, test where necessary.)
Use atlas-mvn clean nearly every time before running my atlas-run command.
Activating my plugin within jira (timeout error)
Researched this question before posting. I'm especially lost because it appears to be a stock Atlassian package that's causing the problem.
My POM is as followed:
<?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.maxxton</groupId>
<artifactId>maxxton-worklog-plugin</artifactId>
<version>1.0.0-SNAPSHOT</version>
<organization>
<name>Example Company</name>
<url>http://www.example.com/</url>
</organization>
<name>maxxton-worklog-plugin</name>
<description>This is the com.maxxton:maxxton-worklog-plugin plugin for Atlassian JIRA.</description>
<packaging>atlassian-plugin</packaging>
<dependencies>
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-api</artifactId>
<version>${jira.version}</version>
</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>–>-->
<!--<scope>compile</scope>-->
<!--</dependency>-->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
<scope>test</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>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</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>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.beanshell</groupId>
<artifactId>bsh</artifactId>
<version>2.0b4</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.6</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpasyncclient</artifactId>
<version>4.0.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.3.6</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20140107</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.mashape.unirest</groupId>
<artifactId>unirest-java</artifactId>
<version>1.4.9</version>
<scope>compile</scope>
</dependency>
<!-- WIRED TEST RUNNER DEPENDENCIES -->
<dependency>
<groupId>com.atlassian.plugins</groupId>
<artifactId>atlassian-plugins-osgi-testrunner</artifactId>
<version>${plugin.testrunner.version}</version>
<scope>test</scope>
</dependency>
<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>
<scope>compile</scope>
</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>
<!-- Uncomment to install TestKit backdoor in JIRA. -->
<!--
<pluginArtifacts>
<pluginArtifact>
<groupId>com.atlassian.jira.tests</groupId>
<artifactId>jira-testkit-plugin</artifactId>
<version>${testkit.version}</version>
</pluginArtifact>
</pluginArtifacts>
-->
<enableQuickReload>true</enableQuickReload>
<enableFastdev>false</enableFastdev>
<!-- See here for an explanation of default instructions: -->
<!-- https://developer.atlassian.com/docs/advanced-topics/configuration-of-instructions-in-atlassian-plugins
-->
<instructions>
<Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
<!-- Add package to export here -->
<Export-Package>
com.maxxton.api,
</Export-Package>
<!-- Add package import here -->
<Import-Package>
org.springframework.osgi.*;resolution:="optional",
org.eclipse.gemini.blueprint.*;resolution:="optional",
*
</Import-Package>
<!-- Ensure plugin is spring powered -->
<Spring-Context>*</Spring-Context>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
<version>${atlassian.spring.scanner.version}</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>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins> </build>
<properties>
<jira.version>7.2.4</jira.version>
<amps.version>6.2.6</amps.version>
<plugin.testrunner.version>1.2.3</plugin.testrunner.version>
<atlassian.spring.scanner.version>1.2.13</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>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target> </properties>
</project>
Thank you.
Looks like I found a way to fix it, though I'm unsure if it's a good fix. It has something to do with importing certain packages; I'm unsure of the logic behind it, but it seemed to have gotten rid of any and all of the bundle errors, causing my plugin to load perfectly when starting my local environment.
For those curious, I changed my from:
<Import-Package>
org.springframework.osgi.*;resolution:="optional",
org.eclipse.gemini.blueprint.*;resolution:="optional",
*
</Import-Package>
To
<Import-Package>
org.springframework.osgi.*;resolution:="optional",
org.eclipse.gemini.blueprint.*;resolution:="optional",
*;version="0";resolution:=optional
</Import-Package>

Primefaces 3.3, POM, tomcat 7.0.39 and Jboss as EAP 5.1

I'm working with primefaces 3.3 and JSF 2.0. And the structure of the pom below, when I generate a war, run (work) only on tomcat 7.0.39. I would like to know what I need to change the pom for the war also run in the JBoss EAP 5.1.
Error:19:19:53,125 SEVERE [config] Critical error during deployment:
com.sun.faces.config.ConfigurationException: Factory 'javax.faces.context.ExternalContextFactory' was not configured properly. at com.sun.faces.config.processor.FactoryConfigProcessor.verifyFactoriesExist(FactoryConfigProcessor.java:305) at
O war generated below does not work in the JBoss EAP 5.1
<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.mkyong.core</groupId>
<artifactId>OtimizacaoProcessoInterno</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>OtimizacaoProcessoInterno</name>
<url>http://maven.apache.org</url>
<dependencies>
<!-- PrimeFaces -->
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>3.3</version>
</dependency>
<!-- JSF -->
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1.11</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.1.11</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
</dependency>
<!-- EL -->
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>el-impl</artifactId>
<version>2.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<wtpversion>2.0</wtpversion>
</configuration>
</plugin>
</plugins>
</build>
You could package your maven module as ear. Thus change your packaging to
<packaging>ear</packaging>
If you want to customize your ear file, you can use the maven-ear-plugin.

Failed to instantiate SLF4J LoggerFactory on Spring 'mvc-basic' tutorial

I'm trying a Spring 3.x tutorial on Eclipse 3.7 with m2e and Maven Integration for WTP plugins installed.
I converted the above tutorial to Maven Project, but when i deploy the web application i get the following exception:
Failed to instantiate SLF4J LoggerFactory
Reported exception:
java.lang.NoClassDefFoundError: org/apache/log4j/Level
My pom.xml look like this:
<?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>org.springframework.samples</groupId>
<artifactId>mvc-basic</artifactId>
<name>mvc-basic</name>
<packaging>war</packaging>
<version>1.0.0-SNAPSHOT</version>
<properties>
<org.springframework.version>3.0.5.RELEASE</org.springframework.version>
<org.slf4j.version>1.6.1</org.slf4j.version>
</properties>
<dependencies>
<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${org.springframework.version}</version>
<exclusions>
<!-- Exclude Commons Logging in favor of SLF4j -->
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!-- Logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${org.slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${org.slf4j.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${org.slf4j.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
<scope>runtime</scope>
</dependency>
<!-- JSR 303 with Hibernate Validator -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.1.0.Final</version>
</dependency>
<!-- Joda Time -->
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>1.6.2</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time-jsptags</artifactId>
<version>1.0.2</version>
<scope>runtime</scope>
</dependency>
<!-- Servlet -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!-- Test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.7</version>
<scope>test</scope>
</dependency>
</dependencies>
<repositories>
<!-- For Hibernate Validator -->
<repository>
<id>org.jboss.repository.release</id>
<name>JBoss Maven Release Repository</name>
<url>https://repository.jboss.org/nexus/content/repositories/releases</url>
<snapshots><enabled>false</enabled></snapshots>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
<showWarnings>true</showWarnings>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<warName>mvc-basic</warName>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>install</id>
<phase>install</phase>
<goals>
<goal>sources</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
I also checked in 'Project Properties' -> 'Java Build Path' -> 'Libraries' but the only log4j jar that i found is the one under 'Maven Dependencies'
Seems like i'm messing with jars but i can't find a solution by myself.
Try to clean the project and server in eclipse. It looks like a refreshing problem.
If you use Maven (M2E) in Eclipse then it is correct that the libs are only in the "Maven Dependencies Section".
May you start with an Spring Source Tool Suite Template Project (that is maven based) and then you copy the code from the tutorial into this project.
If you use Tomcat, then Eclipse must copy the libs to workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp<VERSION>\wtpwebapps\<PROJECT>\WEB-INF\lib.
If the lib is not there, and eclipse does not copy it even if you refersh every thing. Then sometimes the last thing you can do is, Remove the project from the server (in the "Add and Remove..." Dialog) press Finish, and then add the project again.
Looks like some other library has dependency on SLF4J. Create a WAR file and check if SLF4J.jar is packaged in the war. If not, check your Appservers common lib directory. In case its loading it.
Check the Dependency graph of your pom.xml.
In case if you want to add SLF4J log4j API below is the dependency.
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.4</version>
</dependency>

Resources