wildfly - Application not reached - java

I'm woking on Java project. I use Maven, Wildfly and IntelliJ IDEA, running on Ubuntu 16.04. I've created a simple Hello-world application in Main class, using System.out.println() . I'm trying to deploy it on Wildfly server. What I'm doing is:
1. Run standalone.sh
2. Deploy project from it's folder.
Now, as far as I understand, I should see the result, if I type localhost:8080/'Project name'. But when I follow the link, i get Error 404.
Should I use any other tools?
Or how the application should be structered in order to be deployable on Wildfly server?
Here's my 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>SI</groupId>
<artifactId>Navrh</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.wildfly.bom</groupId>
<artifactId>wildfly-javaee7-with-tools</artifactId>
<version>10.1.0.Final</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.annotation</groupId>
<artifactId>jboss-annotations-api_1.2_spec</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.ejb</groupId>
<artifactId>jboss-ejb-api_3.2_spec</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.faces</groupId>
<artifactId>jboss-jsf-api_2.2_spec</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>1.0.2.Final</version>
</plugin>
</plugins>
</build>
</project>

Related

Getting compatible version issue when running spring boot application however in pom there is only version

Application is not starting however I only have added one version of resilience4j
<dependency>
<groupId>io.github.resilience4j</groupId>
<artifactId>resilience4j-spring-boot2</artifactId>
<version>1.3.1</version>
</dependency>
Here are the logs:
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
io.github.resilience4j.circuitbreaker.configure.CircuitBreakerConfiguration.createCircuitBreakerRegistry(CircuitBreakerConfiguration.java:141)
The following method did not exist:
io.github.resilience4j.circuitbreaker.CircuitBreakerRegistry.of(Ljava/util/Map;Lio/github/resilience4j/core/registry/RegistryEventConsumer;Lio/vavr/collection/Map;)Lio/github/resilience4j/circuitbreaker/CircuitBreakerRegistry;
The method's class, io.github.resilience4j.circuitbreaker.CircuitBreakerRegistry, is available from the following locations:
jar:file:/Users/Smit/.m2/repository/io/github/resilience4j/resilience4j-circuitbreaker/1.1.0/resilience4j-circuitbreaker-1.1.0.jar!/io/github/resilience4j/circuitbreaker/CircuitBreakerRegistry.class
It was loaded from the following location:
file:/Users/Smit/.m2/repository/io/github/resilience4j/resilience4j-circuitbreaker/1.1.0/resilience4j-circuitbreaker-1.1.0.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of io.github.resilience4j.circuitbreaker.CircuitBreakerRegistry
Process finished with exit code 1
Full 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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.foosball</groupId>
<artifactId>team</artifactId>
<version>0.0.3</version>
<name>team</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
<spring-cloud.version>Hoxton.SR1</spring-cloud.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.4.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.github.resilience4j</groupId>
<artifactId>resilience4j-spring-boot2</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.15.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.4</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>6.1.0.jre8</version>
</dependency>
<dependency>
<groupId>org.springframework.amqp</groupId>
<artifactId>spring-rabbit-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
<version>1.4.199</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.30</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-webapp-maven-plugin</artifactId>
<version>1.7.0</version>
<configuration>
<authentication>
<serverId>azure-auth</serverId>
</authentication>
<resourceGroup>maven-plugin</resourceGroup>
<appName>foosballteamserver</appName>
<region>westus</region>
<pricingTier>F1</pricingTier>
<javaVersion>1.8</javaVersion>
<deploymentType>ftp</deploymentType>
<stopAppDuringDeployment>true</stopAppDuringDeployment>
<resources>
<resource>
<directory>${project.basedir}/target</directory>
<targetPath>/</targetPath>
<includes>
<include>*.jar</include>
</includes>
</resource>
<resource>
<directory>${project.basedir}</directory>
<targetPath>/</targetPath>
<includes>
<include>web.config</include>
</includes>
</resource>
</resources>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.7</version>
<configuration>
<formats>
<format>html</format>
<format>xml</format>
</formats>
<check/>
</configuration>
</plugin>
</plugins>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project>
Based on other posts in Stackoverflow, suggested to run mvn dependency:tree | grep hibernate command, it showing the below output:
[INFO] | | \- org.hibernate.validator:hibernate-validator:jar:6.0.18.Final:compile
[INFO] | +- org.hibernate:hibernate-core:jar:5.4.8.Final:compile
[INFO] | | +- org.hibernate.common:hibernate-commons-annotations:jar:5.1.0.Final:compile
If you are using spring-cloud-dependencies then do not use resilience4j dependencies directly but instead you can use:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-circuitbreaker-resilience4j</artifactId>
</dependency>
https://docs.spring.io/spring-cloud-circuitbreaker/docs/current/reference/html/index.html#configuring-resilience4j-circuit-breakers
https://docs.spring.io/spring-cloud-circuitbreaker/docs/current/reference/html/index.html#bulkhead-properties-configuration
https://github.com/resilience4j/resilience4j
The Resilience4j dependencies coming from the spring-cloud-dependencies pom.
Suggestion from issue #864
Force resilience4j-circuitbreaker and resilience4j-timelimiter to version 1.3.1
Try to change:
<properties>
<java.version>1.8</java.version>
<spring-cloud.version>Hoxton.SR1</spring-cloud.version>
<resilience4j.version>1.3.1</resilience4j.version>
</properties>
...
<dependency>
<groupId>io.github.resilience4j</groupId>
<artifactId>resilience4j-spring-boot2</artifactId>
<version>${resilience4j.version}</version>
</dependency>
<dependency>
<groupId>io.github.resilience4j</groupId>
<artifactId>resilience4j-circuitbreaker</artifactId>
<version>${resilience4j.version}</version>
</dependency>
<dependency>
<groupId>io.github.resilience4j</groupId>
<artifactId>resilience4j-timelimiter</artifactId>
<version>${resilience4j.version}</version>
</dependency>

Cucumber and Spring boot integration has error

Spring boot and cucumber integration, when I do package this project become jar use mvn package command and produce advvic-1.0.jar. But, if I run this jar
java -jar target/advvic-1.0.jar
I get this error :
Caused by: cucumber.runtime.CucumberException: No backends were found. Please make sure you have a backend module on your CLASSPATH.
However, if I extract this jar, I found cucumber-java.jar on lib folder
this my pom :
<?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.advvic.cucumber.spring</groupId>
<artifactId>advvic</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<name>cucumber-spring-boot</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<spring-boot.version>1.4.1.RELEASE</spring-boot.version>
<cucumber.version>1.2.5</cucumber.version>
<selenium.version>3.0.1</selenium.version>
<htmlunit.version>2.13</htmlunit.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>${cucumber.version}</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-core</artifactId>
<version>${cucumber.version}</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-spring</artifactId>
<version>${cucumber.version}</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>${cucumber.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>20.0</version>
</dependency>
<!--Selenium server dependency is for version 3 and up -->
<!--https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-server -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>${selenium.version}</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>${selenium.version}</version>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>1.4.01</version>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.20.0-GA</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
<executions>
<execution>
<configuration>
<executable>true</executable>
<attach>true</attach>
</configuration>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<executable>true</executable>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
I had the exact same problem with a Spring Boot application that I wanted to use as a runner for Cucumber tests.
The problem is that Spring Boot repackages everything in its own way, thus making it hard for the default Cucumber ResourceLoaders to locate any cucumber.runtime.Backend classes as well as feature files and step definitions.
What I ended up doing was to implement a custom cucumber.runtime.io.ResourceLoader using Spring specific classes to search the classpath.
I got the idea for that at https://stackoverflow.com/a/17283721/3216618
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
String locationPattern = ... use path and suffix to
Resource[] resources = resolver.getResources(locationPattern);
Finally you need to create an Iterable from the found org.springframework.core.io.Resource[]
Maybe this can help you:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<requiresUnpack>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
</dependency>
</requiresUnpack>
</configuration>
</plugin>

I have added dependency in Pom.xml but Maven is not picking up, maven build gets fails

I need to use gson jar for saving a POJO file to java.For this I added its dependency in Pom.xml
I have this jar in my local m2 repository
But in import statement I am getting this error
I did update project and clean project but didn't resolved the issue.
I then added this jar through add external jar
With this the compilation error got resolved
But when I do Maven install and Maven build it gets failed, the error I am getting is:
It is giving error on import statement, for Gson.
Adding the updated pom.xml
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>
<parent>
<artifactId>parent</artifactId>
<groupId>configurator</groupId>
<version>0.0.1-SNAPSHOT</version>
<relativePath>../parent-pom/pom.xml</relativePath>
</parent>
<groupId>com.csc.fs.accel.browser</groupId>
<artifactId>com.csc.fs.accel.browser.dictionary.rest</artifactId>
<packaging>bundle</packaging>
<name>com.csc.fs.accel.browser.dictionary.rest Blueprint Bundle</name>
<description>com.csc.fs.accel.browser.dictionary.rest OSGi blueprint bundle project.</description>
<dependencies>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.csc.fs.accel.browser</groupId>
<artifactId>com.csc.fs.accel.browser.dictionary.service</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>javax.jcr</groupId>
<artifactId>jcr</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.birt.runtime</groupId>
<artifactId>org.eclipse.emf.common</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.birt.runtime</groupId>
<artifactId>org.eclipse.emf.ecore</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.birt.runtime</groupId>
<artifactId>org.eclipse.emf.ecore.xmi</artifactId>
</dependency>
<!-- <dependency>
<groupId>org.emfjson</groupId>
<artifactId>emfjson-jackson</artifactId>
<version>0.9.0</version>
</dependency> -->
<dependency>
<groupId>org.eclipselabs</groupId>
<artifactId>org.eclipselabs.emfjson</artifactId>
<version>0.8.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.csc.fs</groupId>
<artifactId>com.csc.fs.storage.service</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.csc.fs.pa</groupId>
<artifactId>com.csc.fs.pa.common.exception</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.csc.fs.pa</groupId>
<artifactId>com.csc.fs.pa.common.service</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.csc.fs.accel</groupId>
<artifactId>com.csc.fs.accel.etools.datadictionary.model</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.csc.fs.accel</groupId>
<artifactId>com.csc.fs.accel.etools.common.usability.api</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.csc.fs.accel</groupId>
<artifactId>com.csc.fs.accel.etools.common.model</artifactId>
<version>2.1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.xsd</groupId>
<artifactId>xsd</artifactId>
<version>2.2.3</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
</dependency>
<dependency>
<groupId>com.csc.fs.pa</groupId>
<artifactId>
com.csc.fs.pa.allowedValue.service
</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.7</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Version>${project.version}</Bundle-Version>
<Export-Package>com.csc.fs.accel.browser.dictionary.rest*;version=${project.version}</Export-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.csc.fs.accel</groupId>
<artifactId>
com.csc.fs.accel.etools.datadictionary.model
</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.csc.fs.accel</groupId>
<artifactId>com.csc.fs.accel.etools.common.usability.api</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.csc.fs.accel</groupId>
<artifactId>
com.csc.fs.accel.etools.common.model
</artifactId>
<version>2.1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.7</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
Can anyone please suggest what I am missing or how should i resolve this error
You got wrong dependency declared. It should be
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.7</version>
</dependency>
while your groupId is <groupId>com.google.code.gson.gson</groupId> - notice double .gson at the end.
UPDATE:
So as you have pasted your POM now we can see what is the problem.
You have given dependency (gson) in Dependency Managemet not in Dependencies. You have to include it in Dependencies as well. To understand what dependency management is, read mavens doc https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html

java.lang.ClassNotFoundException: org.glassfish.jersey.servlet.ServletContainer when deploying web project on WebLogic

I am trying to deploy my web application (in the form of an .ear file) on weblogic server, using the weblogic administration console. when I add my ear to the console, I get the following error -
java.lang.ClassNotFoundException: org.glassfish.jersey.servlet.ServletContainer
I have already tried quite a few things form the other threads that I could find. But somehow they dont seem to be helping.
Following is the pom.xml for my module -
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>ParentModule</groupId>
<artifactId>ParentModule</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>WARModule</artifactId>
<packaging>war</packaging>
<name>WARModule Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
<version>3.3.1</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-bundle</artifactId>
<version>1.19</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.19</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-core</artifactId>
<version>1.19</version>
</dependency>
</dependencies>
<build>
<finalName>WARModule</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<inherited>true</inherited>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey</groupId>
<artifactId>jersey-bom</artifactId>
<version>2.6</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>2.6.0</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>6.0</version> <!-- Put here the version of your Java EE app, in my case 7.0 -->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet</artifactId>
<version>2.6</version>
<!-- use the following artifactId if you don't need servlet 2.x compatibility -->
<!-- artifactId>jersey-container-servlet</artifactId -->
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-moxy</artifactId>
<version>2.3</version>
</dependency>
</dependencies>
</dependencyManagement>
Following are the dependencies that are added in my module -
And this is what the weblogic console looks like when I add my project and try to run it.
Any help on how to get rid of this is much appreciated, It's been a while since I'm stuck with this!
Also, this is what my WEB-INF/lib folder looks like -

Can't invoke getChildFragmentManager in Fragment

I am building android project with maven. But I found when I call getChildFragmentManager in v4.Fragment, it shows an error that this method is not found. I doubt that the support-v4 package is not newer enough because if I using ant to build my project everything works just fine.
However I can't get the newer support-v4 to be included into my project.
Here is my 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.meishixing</groupid>
<artifactid>crazysight</artifactid>
<version>1.0.0-snapshot</version>
<packaging>apk</packaging>
<name>crazysight</name>
<properties>
<project.build.sourceencoding>utf-8</project.build.sourceencoding>
<fest-assert.version>1.0.4</fest-assert.version>
<junit.version>4.10</junit.version>
<robolectric.version>2.0</robolectric.version>
<intellij.annotations.version>12.0</intellij.annotations.version>
</properties>
<dependencies>
<dependency>
<groupid>com.google.android</groupid>
<artifactid>android</artifactid>
<version>4.1.1.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupid>com.viewpagerindicator</groupid>
<artifactid>library</artifactid>
<version>2.4.1</version>
<type>apklib</type>
</dependency>
<dependency>
<groupid>com.tjerkw</groupid>
<artifactid>slideexpandablelistview-library</artifactid>
<version>1.1.0-snapshot</version>
<type>apklib</type>
</dependency>
<dependency>
<groupid>com.meishixing</groupid>
<artifactid>android-async-http</artifactid>
<version>1.4.2</version>
<type>jar</type>
</dependency>
<dependency>
<groupid>com.meishixing</groupid>
<artifactid>baidu-locationp</artifactid>
<version>3.3</version>
<type>jar</type>
</dependency>
<dependency>
<groupid>com.google.code.gson</groupid>
<artifactid>gson</artifactid>
<version>2.2.4</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupid>org.apache.commons</groupid>
<artifactid>commons-lang3</artifactid>
<version>3.1</version>
</dependency>
<dependency>
<groupid>com.github.chrisbanes.pulltorefresh</groupid>
<artifactid>library</artifactid>
<version>2.1.1</version>
<type>apklib</type>
</dependency>
<dependency>
<groupid>com.novoda.imageloader</groupid>
<artifactid>imageloader-core</artifactid>
<version>1.5.8</version>
</dependency>
</dependencies>
<build>
<finalname>${project.artifactid}</finalname>
<sourcedirectory>src</sourcedirectory>
<plugins>
<plugin>
<groupid>com.jayway.maven.plugins.android.generation2</groupid>
<artifactid>android-maven-plugin</artifactid>
<version>3.6.2-snapshot</version>
<configuration>
<sdk>
<platform>17</platform>
</sdk>
<manifest>
<debuggable>true</debuggable>
</manifest>
</configuration>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
</project>
I've been stumped by this for hours (which is why I also added a bounty), but here's how I finally resolved it.
First of all, check your project's classpath dependancies using
mvn dependency:build-classpath
I could immediately see the problem in the output:
<home>/.m2\repository\android\extras\android-support\v4\android-support-v4.jar
<home>/.m2\repository\android\platforms\android\android-18\android-android-18.jar
<home>/.m2\repository\com\actionbarsherlock\actionbarsherlock\4.4.0\actionbarsherlock-4.4.0.apklib
<home>/.m2\repository\com\google\android\support-v4\r7\support-v4-r7.jar
<... more jars>
There are two support jars included, and the support-v4-r7.jar overrides my newer android-support-v4.jar.
The older one was being loaded by ActionBarSherlock in my project (in your project the culprit might be any of the apklib dependencies), so I excluded it in my project pom:
<dependency>
<groupId>com.actionbarsherlock</groupId>
<artifactId>actionbarsherlock</artifactId>
<version>4.4.0</version>
<type>apklib</type>
<exclusions>
<exclusion>
<groupId>com.google.android</groupId>
<artifactId>support-v4</artifactId>
</exclusion>
</exclusions>
</dependency>
Hopefully this helps someone.

Categories

Resources