I'm doing my first maven spring Rest project which includes an embedded tomcat service and some MongoDb queries. I'm very new to both Maven and Spring, and can't seem to understand this error.
Exception in thread "main" java.lang.IllegalAccessError: tried to access method org.springframework.core.io.support.SpringFactoriesLoader.loadFactoryNames(Ljava/lang/Class;Ljava/lang/ClassLoader;)Ljava/util/List; from class org.springframework.boot.SpringApplication
at org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:260)
at org.springframework.boot.SpringApplication.initialize(SpringApplication.java:226)
at org.springframework.boot.SpringApplication.<init>(SpringApplication.java:200)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:920)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:909)
at com.cave.spring.firstSpring.Application.main(Application.java:12)
This is the exception I'm getting. I'm trying to start an embedded tomcat service, but I keep getting errors. I think there are some incompatabilities in 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>org.springframework</groupId>
<artifactId>gs-rest-service</artifactId>
<version>0.1.0</version>
<packaging>jar</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.0.0.RC1</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.2.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>3.2.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.2.5.RELEASE</version>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>2.11.0</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb</artifactId>
<version>1.3.3.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>3.1.2.RELEASE</version>
</dependency>
</dependencies>
<properties>
<start-class>com.cave.spring.firstSpring.Application</start-class>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<configuration>
<url>http://127.0.0.1:8080/manager</url>
<server>TomcatServer</server>
<path>/firstSpring</path>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-snapshots</id>
<url>http://repo.spring.io/libs-snapshot</url>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<url>http://repo.spring.io/libs-snapshot</url>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</project>
Try to remove the <version> attributes, for the dependencies that are defined in the spring boot parent pom (like you did for spring-boot-starter-web).
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>2.11.0</version>
<!-- i dont know if this is defined in the parent pom -->
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb</artifactId>
<version>1.3.3.RELEASE</version>
<!-- i dont know if this is defined in the parent pom -->
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
</dependency>
</dependencies>
I eventually managed to get this resolved. I think there was some dependency issues. I stripped down the pom and imported the dependencies anew
Related
I´m trying to create an application that integrates primefaces with spring boot following these tutorials:
https://medium.com/#tsepomaleka/integrating-spring-boot-with-java-server-faces-using-joinfaces-297e64f6a28f
https://codenotfound.com/jsf-primefaces-example.html
And i added the joinfaces as the tutorial suggests:
This 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 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.3.0.M3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.dataprev.election</groupId>
<artifactId>election</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>election</name>
<description>Demo System Election</description>
<properties>
<java.version>13</java.version>
<joinfaces.version>4.1.5</joinfaces.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.joinfaces</groupId>
<artifactId>jsf-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.joinfaces</groupId>
<artifactId>joinfaces-dependencies</artifactId>
<version>${joinfaces.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</pluginRepository>
</pluginRepositories>
</project>
And i created the webapp/WEB-INF folder structure:
As you can see on the image the webapp folder doesn't look like that is recognized by intellij.
Other problem is that the xmlns:p="http://primefaces.org/ui"
url taglib is not being recognized as you can see on the image.
So when i run on the browser: http://localhost:8080/eleicao.xhtml
The browser returns me an error:
There was an unexpected error (type=Not Found, status=404).
/eleicao.xhtml Not Found in ExternalContext as a Resource
So how can i resolve this? So that i can run primefaces pages.
You are missing a bunch of depenedencies here is my pom for PrimeFaces, MyFaces for JSF, OmniFaces, and Undertow as the servlet engine
<!-- JoinFaces -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
</dependency>
<dependency>
<groupId>org.joinfaces</groupId>
<artifactId>primefaces-spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.joinfaces</groupId>
<artifactId>tomcat-spring-boot-starter</artifactId>
</exclusion>
<exclusion>
<groupId>org.joinfaces</groupId>
<artifactId>mojarra-spring-boot-starter</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.joinfaces</groupId>
<artifactId>omnifaces3-spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.joinfaces</groupId>
<artifactId>tomcat-spring-boot-starter</artifactId>
</exclusion>
<exclusion>
<groupId>org.joinfaces</groupId>
<artifactId>mojarra-spring-boot-starter</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.joinfaces</groupId>
<artifactId>undertow-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.joinfaces</groupId>
<artifactId>myfaces-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.joinfaces</groupId>
<artifactId>rewrite-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.joinfaces</groupId>
<artifactId>weld-spring-boot-starter</artifactId>
</dependency>
I am using some external/custom libraries in spring boot(1.5.13.RELEASE) maven application. I uploaded custom jars to our local artifactory server and added them as dependencies in pom.xml. When i run the Spring boot Application main class from Eclipse(Oxygen), everything is running fine. When i packaged the application and run it outside of eclipse (like commandline) using java -jar "jar filename", I am getting ClassNotFoundException. i verified the packaged jar file and i could see the custom jar i am using inside \BOOT-INF\lib directory but still getting ClassNotFoundException. I am using few other custom jars but only having issue with one particular jar. Can somebody help me resolving this issue?.
Exception:
Caused by: java.lang.RuntimeException: Unable to resolve class com.ciq.pubsub.tr
ansport.esb.EsbTransport in assembly CapitalIQ.PubSub.Transport.ESB.jar: com.ciq
.pubsub.transport.esb.EsbTransport
at com.ciq.pubsub.transport.TransportFactory.createTransport(TransportFa
ctory.java:71) ~[CapitalIQPubSubTransport-4.1.jar!/:na]
at com.spgmi.pipeline.implV2.HermesObjSetProvider.<init>(HermesObjSetPro
vider.java:56) ~[SPGMIPipeline-4.4.jar!/:4.4]
at com.spgmi.pipeline.implV2.DeliveryContextManager.get(DeliveryContextM
anager.java:92) ~[SPGMIPipeline-4.4.jar!/:4.4]
at com.spgmi.pipeline.implV2.DeliveryContextManager.ResolveContext(Deliv
eryContextManager.java:74) ~[SPGMIPipeline-4.4.jar!/:4.4]
at com.spgmi.pipeline.implV2.ContentPipeline.getDeliveryContext(ContentP
ipeline.java:260) ~[SPGMIPipeline-4.4.jar!/:4.4]
... 58 common frames omitted
Caused by: java.lang.ClassNotFoundException: com.ciq.pubsub.transport.esb.EsbTra
nsport
at java.net.URLClassLoader.findClass(Unknown Source) ~[na:1.8.0_121]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_121]
at java.net.FactoryURLClassLoader.loadClass(Unknown Source) ~[na:1.8.0_1
21]
at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_121]
at com.ciq.pubsub.transport.TransportFactory.createTransport(TransportFa
ctory.java:67) ~[CapitalIQPubSubTransport-4.1.jar!/:na]
... 62 common frames omitted
Below is 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>gcc-news-publishing-service</groupId>
<artifactId>gcc-news-publishing-service</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>gcc-news-publishing-service</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.13.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.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-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>CapitalIQ.PubSub.Interfaces</groupId>
<artifactId>CapitalIQPubSubInterfaces</artifactId>
<version>3.1.2</version>
</dependency>
<dependency>
<groupId>CapitalIQ.PubSub.Java.Config.Dynamic</groupId>
<artifactId>CapitalIQPubSubJavaConfigDynamic</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>CapitalIQ.PubSub.Java.Config.Factory</groupId>
<artifactId>CapitalIQPubSubJavaConfigFactory</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>CapitalIQ.PubSub.Java.Config.Interfaces</groupId>
<artifactId>CapitalIQPubSubJavaConfigInterfaces</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>CapitalIQ.PubSub.Java.Config.Internal</groupId>
<artifactId>CapitalIQPubSubJavaConfigInternal</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>CapitalIQ.PubSub.Java.Config</groupId>
<artifactId>CapitalIQPubSubJavaConfig</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>CapitalIQ.PubSub.Java.ConfigServiceStub</groupId>
<artifactId>CapitalIQPubSubJavaConfigServiceStub</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>CapitalIQ.PubSub.Transport.ESB</groupId>
<artifactId>CapitalIQPubSubTransportESB</artifactId>
<version>4.0</version>
</dependency>
<dependency>
<groupId>CapitalIQ.PubSub.Transport.Informatica</groupId>
<artifactId>CapitalIQPubSubTransportInformatica</artifactId>
<version>3.1.2</version>
</dependency>
<dependency>
<groupId>CapitalIQ.PubSub.Transport</groupId>
<artifactId>CapitalIQPubSubTransport</artifactId>
<version>4.1</version>
</dependency>
<dependency>
<groupId>SPGMIPipelineInterfaces</groupId>
<artifactId>SPGMIPipelineInterfaces</artifactId>
<version>4.4</version>
</dependency>
<dependency>
<groupId>cSPGMIPipelineConfiguration</groupId>
<artifactId>SPGMIPipelineConfiguration</artifactId>
<version>4.4</version>
</dependency>
<dependency>
<groupId>SPGMIPipelineObjectSets</groupId>
<artifactId>SPGMIPipelineObjectSets</artifactId>
<version>4.4</version>
</dependency>
<dependency>
<groupId>SPGMIPipeline</groupId>
<artifactId>SPGMIPipeline</artifactId>
<version>4.4</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>2.25.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-server</artifactId>
<version>2.25.1</version>
</dependency>
<dependency>
<groupId>persistence-api</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.osgi.core</groupId>
<artifactId>org.osgi.core</artifactId>
<version>4.2.0</version>
</dependency>
<dependency>
<groupId>org.glassfish.hk2</groupId>
<artifactId>osgi-resource-locator</artifactId>
<version>1.0.1</version>
</dependency>
<!-- <dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-jaxb</artifactId>
<version>1.0</version>
</dependency>
-->
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet</artifactId>
<version>2.25.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet-core</artifactId>
<version>2.25.1</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2.7</version>
</dependency>
<dependency>
<groupId>org.glassfish.hk2.external</groupId>
<artifactId>javax.inject</artifactId>
<version>2.5.0-b32</version>
</dependency>
<dependency>
<groupId>sonic_Client</groupId>
<artifactId>sonic_Client</artifactId>
<version>8.5.1</version>
</dependency>
<dependency>
<groupId>sonic_Client_ext</groupId>
<artifactId>sonic_Client_ext</artifactId>
<version>8.5.1</version>
</dependency>
<dependency>
<groupId>sonic_Crypto</groupId>
<artifactId>sonic_Crypto</artifactId>
<version>8.5.1</version>
</dependency>
<dependency>
<groupId>sonic_mgmt_client</groupId>
<artifactId>sonic_mgmt_client</artifactId>
<version>8.5.1</version>
</dependency>
<dependency>
<groupId>UMS_6.8_jdk1.5.0_12</groupId>
<artifactId>UMS_6.8_jdk1.5.0_12</artifactId>
<version>1.5.0_12</version>
</dependency>
<dependency>
<groupId>UMSPDM_6.8_jdk1.5.0_12</groupId>
<artifactId>UMSPDM_6.8_jdk1.5.0_12</artifactId>
<version>1.5.0_12</version>
</dependency>
<dependency>
<groupId>UMSSDM_6.8_jdk1.5.0_12</groupId>
<artifactId>UMSSDM_6.8_jdk1.5.0_12</artifactId>
<version>1.5.0_12</version>
</dependency>
<dependency>
<groupId>wsdl4j</groupId>
<artifactId>wsdl4j</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>registry</groupId>
<artifactId>registry</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>18.0</version>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>jersey-multipart</artifactId>
<version>1.9.1</version>
</dependency>
<dependency>
<groupId>axis</groupId>
<artifactId>axis</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>saaj</groupId>
<artifactId>saaj</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>jaxrpc</groupId>
<artifactId>jaxrpc</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>commons-discovery</groupId>
<artifactId>commons-discovery</artifactId>
<version>0.2</version>
</dependency>
<dependency>
<groupId>openmdx-kernel</groupId>
<artifactId>openmdx-kernel</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>org.glassfish.hk2.external</groupId>
<artifactId>aopalliance-repackaged</artifactId>
<version>2.5.0-b32</version>
</dependency>
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>1.5.5</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>artifactory</id>
<name>S and P artifactory server</name>
<url>http://nj09mhf5479.mhf.mhc:8081/artifactory/repo</url>
</repository>
<repository>
<id>artifactory-snapshot</id>
<name>S and P artifactory server</name>
<url>http://nj09mhf5479.mhf.mhc:8081/artifactory/repo</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<url>http://nj09mhf5479.mhf.mhc:8081/artifactory/repo</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<distributionManagement>
<repository>
<name>central</name>
<url>http://nj09mhf5479.mhf.mhc:8081/artifactory/repo</url>
<id>central</id>
</repository>
<snapshotRepository>
<id>central-snap</id>
<name>central-snap</name>
<url>http://nj09mhf5479.mhf.mhc:8081/artifactory/repo</url>
</snapshotRepository>
</distributionManagement>
</project>
Try with mvn install:install-file.
Here's a example from: http://www.mkyong.com/maven/how-to-include-library-manully-into-maven-local-repository/
mvn install:install-file -Dfile=c:\kaptcha-{version}.jar -DgroupId=com.google.code
-DartifactId=kaptcha -Dversion={version} -Dpackaging=jar
I am getting following warning when I try to config following property in my spring boot application.
'eureka.client.register-with-eureka' is an unknown property.
Following is my pom.xml file:-
<?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>org.springframework</groupId>
<artifactId>demo
</artifactId>
<version>0.1.0</version>
<packaging>war</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.0.RC1</version>
</parent>
<properties>
<java.version>1.8</java.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-security</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-eureka -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-eureka</artifactId>
<version>1.0.0.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-hystrix -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-hystrix</artifactId>
<version>1.0.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth2</artifactId>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path-assert</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>Dalston.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-releases</id>
<url>https://repo.spring.io/libs-release</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-plugin-releases</id>
<url>https://repo.spring.io/plugins-release</url>
</pluginRepository>
</pluginRepositories>
</project>
please help me out to find which jar I am missing such that it is not getting in application properties file.
thanks in advance.
Could you try using: spring-boot-starter-parent with 1.5.x.RELEASE since you are using Spring Cloud Dalston.RELEASE ?
I'm trying to change the version of Spring Data MongoDB to 1.6.M1, but the problem still the same.
How the fix the import of:
import org.springframework.data.mongodb.core.index.TextIndexed;
and
import org.springframework.data.mongodb.core.query.TextCriteria;
This is the pom.xml, what do I need to change?
<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.sab</groupId>
<artifactId>sampleApp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>Sample App</name>
<description>Sample App</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Spring Framework -->
<spring.version>3.2.0.RELEASE</spring.version>
<spring.security.core.version>3.1.3.RELEASE</spring.security.core.version>
<!-- Mongo DB driver & Spring Data MongoDB -->
<spring.data.mongodb.version>1.1.1.RELEASE</spring.data.mongodb.version>
<mongodb.driver.version>2.10.1</mongodb.driver.version>
<!-- Java Servlet -->
<javax.servlet-api.version>3.0.1</javax.servlet-api.version>
<javax.jstl-taglibs.version>1.2</javax.jstl-taglibs.version>
<!-- Miscellaneous Dependencies -->
<jackson.version>2.1.1</jackson.version>
<log4j.version>1.2.14</log4j.version>
<!-- Plugins -->
<maven.compiler.plugin.version>2.3.2</maven.compiler.plugin.version>
<maven.war.plugin.version>2.1.1</maven.war.plugin.version>
</properties>
<dependencies>
<!-- Spring Core -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- Logger -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- Javax Servlet. This needs to be included for runtime only! -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>${javax.servlet-api.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>${javax.jstl-taglibs.version}</version>
</dependency>
<!-- Jackson JSON processor -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb</artifactId>
<version>1.6.0.BUILD-SNAPSHOT</version>
</dependency>
<!-- Spring Data MongoDB -->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb</artifactId>
<version>${spring.data.mongodb.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- MongoDB Java Driver -->
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>${mongodb.driver.version}</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<!-- Spring Security -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>${spring.security.core.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>${spring.security.core.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>${spring.security.core.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
<version>${spring.security.core.version}</version>
</dependency>
<!-- Jsoup -->
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.8.1</version>
</dependency>
</dependencies>
<build>
<finalName>sampleqa</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.plugin.version}</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${maven.war.plugin.version}</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<!-- For main Spring releases -->
<repository>
<id>org.springframework.maven.release</id>
<name>Spring Maven Release Repository</name>
<url>http://maven.springframework.org/release</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<!-- For Java Releases -->
<repository>
<id>java.net2</id>
<name>Repository hosting the jee6 artifacts</name>
<url>http://download.java.net/maven/2</url>
</repository>
<repository>
<id>jboss</id>
<name>JBoss repository</name>
<url>https://repository.jboss.org/nexus/content/repositories/releases</url>
</repository>
</repositories>
</project>
If I am not wrong your compiler is giving error on this line
import org.springframework.data.mongodb.core.index.TextIndexed;
However this class is present in following path
\spring-data-mongodb-1.6.0.RELEASE.jar.zip\org\springframework\data\mongodb\core\index
To get rid of this issue check in your classpath this jar spring-data-mongodb-1.6.0.XXXX is present or not.
If its present unzip the same and check that class is there or not.
If class is there then check that any other jar there in your classpath with same name and having different version if it is just delete it from classpath and check the compilation issue.
Its better to have clean deployment sometime old jar dont remove from classpath due to out side access issue can cause the problem.
I am new to spring. I made pom.xml and am getting the error below in the pom.xml file:
cvc-complex-type.2.4.a: Invalid content was found starting with element 'repositories'. One of '{"http://maven.apache.org/POM/4.0.0":dependency}' is expected.
My code for pom.xml is below:
<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>packagename</groupId>
<artifactId>projectname</artifactId>
<packaging>war</packaging>
<version>1.0</version>
<name>Project Name</name>
<url>http://maven.apache.org</url>
<properties>
<org.springframework.version>3.2.1.RELEASE</org.springframework.version>
<org.spring.security.version>3.1.2.RELEASE</org.spring.security.version>
<org.slf4j.version>1.6.1</org.slf4j.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.1.5.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.2.0.Final</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.9</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.moxy</artifactId>
<version>2.5.0</version>
</dependency>
<!--- ADDED FOR TESTING-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test-mvc</artifactId>
<version>1.0.0.M1</version>
<scope>test</scope>
</dependency>
<repositories>
<repository>
<id>org.springframework.maven.milestone</id>
<name>Spring Maven Milestone Repository</name>
<url>http://maven.springframework.org/milestone</url>
</repository>
</repositories>
<!--- ADDED FOR TESTING END-->
</dependencies>
<build>
<finalName>projectname</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.0.4.v20130625</version>
</plugin>
</plugins>
</build>
</project>
You're using <repositories> inside <dependencies>, it should be next to eachother.
Move these lines about 7 positions up:
<!--- ADDED FOR TESTING END-->
</dependencies>
instead of packaging you should use type
<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>packagename</groupId>
<artifactId>projectname</artifactId>
<type>war</type>
<version>1.0</version>