I want to create a maven jersey spring integrated project. When I am trying to add
com.sun.jersey.contribs:jersey-spring:jar:1.9.1
jar my project is not compiling, without this jar, its working fine.
Here is my pom.xml
<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.jwt.rest</groupId>
<artifactId>myapp</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>RESTfullApp 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>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.17</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-servlet</artifactId>
<version>1.17</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
<version>1.17</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.3.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.3.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>4.3.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>4.3.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.3.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>4.3.2.RELEASE</version>
</dependency>
<dependency>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>jersey-spring</artifactId>
<version>1.9.1</version>
</dependency>
</dependencies>
<build>
<finalName>myapp</finalName>
</build>
</project>
Stacktrace
[WARNING] POM for 'com.sun.jersey:jersey-server:pom:1.9.1:compile' is invalid.
Its dependencies (if any) will NOT be available to the current build.
[ERROR] An error occurred during dependency resolution of the following artifact:
org.springframework:spring-core:null
Caused by: Unable to get dependency information: Unable to read local copy of metadata: Cannot read metadata from '/home/innoeye/repo2/org/springframework/spring-core/maven-metadata-glassfish-repository.xml': end tag name </body> must match start tag name <hr> from line 5 (position: TEXT seen ...</center>\r\n</body>... #6:8)
org.springframework:spring-core:jar:null
from the specified remote repositories:
central (http://repo1.maven.org/maven2),
m2.java.net (http://download.java.net/maven/2),
jvnet-nexus-snapshots (https://maven.java.net/content/repositories/snapshots),
glassfish-repository (http://maven.glassfish.org/content/groups/glassfish),
repository.jboss.org (http://repository.jboss.org/nexus/content/groups/public/)
Path to dependency:
1) com.jwt.rest:myapp:war:1.0-SNAPSHOT
2) com.sun.jersey.contribs:jersey-spring:jar:1.9.1
Related
I trying to make a wewbservice using maven-springboot. Below are the dependencies I am using in my 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>
<groupId>org.springframework</groupId>
<artifactId>SpringService</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>SpringService Maven Webapp</name>
<url>http://www.example.com</url>
<properties>
<springframework.version>4.3.0.RELEASE</springframework.version>
<jackson.library>2.7.5</jackson.library>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${springframework.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.library}</version>
</dependency>
</dependencies>
However, I am getting an error Missing artifact org.springframework:spring-core:jar:4.3.0.RELEASE for spring-web, spring-core, and spring-webmvc. Kindly, suggest a solution.
Deleting folder
/Users/username/.m2/repository/org/springframework
followed by running maven install has worked for me.
So, I am currently working on a project that uses Maven.
I added a spring-context dependency, on the latest version, and made sure to exclude any older spring references from other dependencies.
Seems like the code is getting an older reference still (even though it does not have a source attached anymore due to the old version of spring being excluded).
This issue is happening only on my local machine, as other people from the project downloaded the exact same code and didn't get this strage bean reference error.
Here's the pom.xml (I've erased internal project names)
I have tried running mvn clean install, checking dependencies with dependency:tree and nothing solves this problem.
<?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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<groupId>---</groupId>
<artifactId>project</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Project</name>
-<build>
<sourceDirectory>src</sourceDirectory>
-<plugins>
-<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
-<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
-<dependencies>
<!-- dependencies -->
-<dependency>
<groupId>---</groupId>
<artifactId>model</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
-<dependency>
<groupId>---</groupId>
<artifactId>general.dao</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
-<dependency>
<groupId>---</groupId>
<artifactId>ExternalJavaConfig</artifactId>
<version>1.0.9-RELEASE</version>
-<exclusions>
-<exclusion>
groupId>org.springframework</groupId>
<artifactId>spring</artifactId>
</exclusion>
</exclusions>
</dependency>
-<dependency>
<groupId>---</groupId>
<artifactId>db</artifactId>
<version>0.0.2-SNAPSHOT</version>
</dependency>
-<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
-<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>5.2.6.RELEASE</version>
</dependency>
-<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>5.2.6.RELEASE</version>
</dependency>
-<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>5.2.6.RELEASE</version>
</dependency>
-<dependency>
<groupId>---</groupId>
<artifactId>---</artifactId>
<version>0.0.3-SNAPSHOT</version>
</dependency>
<!-- External dependencies -->
-<dependency>
<groupId>commons-dbutils</groupId>
<artifactId>commons-dbutils</artifactId>
<version>1.6</version>
</dependency>
-<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
-<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.9.3</version>
</dependency>
-<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
<version>2.2.7.RELEASE</version>
</dependency>
-<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>2.2.7.RELEASE</version>
</dependency>
-<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa</artifactId>
<version>2.7.1</version>
</dependency>
-<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.9.1</version>
</dependency>
<!-- External dependencies in internal repo-->
-<dependency>
<groupId>com.ibm.db2</groupId>
<artifactId>db2jcc4</artifactId>
<version>11.1.0.0</version>
</dependency>
-<dependency>
<groupId>---</groupId>
<artifactId>---</artifactId>
<version>5.0.0.34</version>
</dependency>
-<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-instrument</artifactId>
<version>5.2.6.RELEASE</version>
</dependency>
-<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>5.2.6.RELEASE</version>
</dependency>
</dependencies>
</project>```
If the problem only appears on your computer, delete the local repository (usually in your user directory under .m2/repository) and try again.
Somehow the code has been conflicting with other dependencies. After I have downloaded only those specific ones, it stopped conflicting.
I am trying to create Spring 4 MVC maven based project into Eclipse Neon.
The problem is that when I am trying to add dependency into pom.xml, I am getting error:
Missing artifact spring-web:org.springframework:jar:4.3.1.RELEASE
Here is my pom.xml:
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jdk.version>1.8</jdk.version>
<spring.version>4.3.1.RELEASE</spring.version>
<jstl.version>1.2</jstl.version>
<servlet.version>3.1.0</servlet.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>${jstl.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>${servlet.version}</version>
<scope>provided</scope>
</dependency>
<!-- Spring Dependencies -->
<dependency>
<artifactId>org.springframework</artifactId>
<groupId>spring-webmvc</groupId>
<version>${spring.version}</version>
</dependency>
<dependency>
<artifactId>org.springframework</artifactId>
<groupId>spring-context</groupId>
<version>${spring.version}</version>
</dependency>
<dependency>
<artifactId>org.springframework</artifactId>
<groupId>spring-aop</groupId>
<version>${spring.version}</version>
</dependency>
<dependency>
<artifactId>org.springframework</artifactId>
<groupId>spring-web</groupId>
<version>${spring.version}</version>
</dependency>
</dependencies>
When I look into .m2 directory, I was having all the dependencies downloaded. I am not getting then why is it happening ? Help me.
Aren't those maven xml strophes wrong? You reversed the artifact and groupId key values. Shouldn't they look like:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.3.1.RELEASE</version>
</dependency>
I am trying to use OSGi using Spring Dynamic Modules. Below is my pom.xml for that. I have added all the dependency related to OSGi framework I guess but still somehow, I am always getting the below exception-
BundleActivator cannot be resolved to a type
ServiceRegistration cannot be resolved to a type
Below is my pom.xml 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>
<groupId>com.spring.osgi.example</groupId>
<artifactId>HelloWorldService</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>HelloWorldService</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.osgi</groupId>
<artifactId>spring-osgi-core</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>org.springframework.osgi</groupId>
<artifactId>spring-osgi-extender</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.2.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>3.2.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>3.2.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.2.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.osgi</groupId>
<artifactId>spring-osgi-io</artifactId>
<version>1.2.1</version>
</dependency>
</dependencies>
</project>
Is there anything I am missing in my pom.xml file. I am using Eclipse Juno.
Below is the image of my project-
Put the org.osgi:org.osgi.core with scope provided into your pom.xml. Choose a version from here http://search.maven.org/#search|gav|1|g%3A%22org.osgi%22%20AND%20a%3A%22org.osgi.core%22.
I have create a Dynamic Web Project with Maven Dependency Enabled. Now when I am running the application in my JBoss AS7 server in built in Eclipse the jar's from the Maven Dependency does not copied in the lib of the WAR file and for that reason I am getting ClassNotFoundException.
How can I solve this problem?
Edit:
pom.xml:
<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>EMSApplication</groupId>
<artifactId>EMSApplication</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<repositories>
<repository>
<id>googlecode</id>
<url>http://jqwicket.googlecode.com/svn/m2-repo/releases/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-core</artifactId>
<version>1.5.3</version>
</dependency>
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-spring</artifactId>
<version>1.5.3</version>
</dependency>
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-extensions</artifactId>
<version>1.5.3</version>
</dependency>
<dependency>
<groupId>org.apache.wicket</groupId>
<artifactId>wicket-datetime</artifactId>
<version>1.5.3</version>
</dependency>
<dependency>
<groupId>com.google.code.jqwicket</groupId>
<artifactId>jqwicket</artifactId>
<version>0.8</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>3.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>1.8.0.10</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.2.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.4.2</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.14</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>3.1.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.1.1.Final</version>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.2.2</version>
</dependency>
</dependencies>
</project>
If you like to use Maven you have to follow the conventions of Maven which is the folder structure and you shouldn't try to go around cause you will loose that combat.
My suggestion is to first get your Maven build working and then import it into your IDE and continue working there after the build on command works fine.