Using the following dependency entry in my pom:
<dependencies>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-core</artifactId>
<version>${dropwizard.version}</version>
</dependency>
</dependencies>
Using an older dropwizard version works fine:
<properties>
<dropwizard.version>2.0.9</dropwizard.version>
</properties>
But using the most up to date version as listed on mvnrepository:
<dropwizard.version>2.1.2</dropwizard.version>
gives the following error:
Dependency 'io.dropwizard:dropwizard-core:2.1.2' not found
Additionally, using the recommended version in dropwizard's tutorial page does not work either:
<dropwizard.version>2.1.3-SNAPSHOT</dropwizard.version>
I have the following to pull snapshots in my pom:
<repositories>
<repository>
<id>nexus</id>
<name>nexus-snapshot</name>
<url>http://localhost:8081/repository/maven-snapshots/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</repository>
</repositories>
Update:
By deleting io/dropwizard from my ~/.m2/repository directory and invalidating caches & restarting, I was able to load dropwizard version 2.1.2. I am still unable to determine how to properly load the SNAPSHOT version. I don't know what repository settings to add to my pom file in order to correctly link to that dependency.
I'm trying to use Azure Monitor OpenTelemetry Exporter client library for Java to export all traces/spans from Spring Cloud Sleuth to Azure Monitor. This integration seems to only work with the newest version of Spring Cloud Sleuth after the recent dependency version updates.
However instead of using azureMonitorExporter.export(spanData) manually, I would like to export all traces/spans automatically for the whole application by just adding a configuration for Azure exporter. This could then easily be added to a new project.
I don't have much experience using Spring/Sleuth/OpenTelemetry, but AzureMonitorExporter implements SpanExporter, so I thought one option could be to create a configuration class that contains the following.
#Bean
public SpanExporter exporter() {
return new AzureMonitorExporterBuilder()
.instrumentationKey("{KEY}")
.buildExporter();
};
And then it could be used in the main class using:
#Autowired
SpanExporter exporter;
However I'm not sure if this is the right way or how to continue from here to actually get the exporter to start exporting traces/spans automatically to Azure monitor.
My pom.xml looks 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 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.4.2-SNAPSHOT</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>trace-demo-5-updated</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>trace-demo-5-updated</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>11</java.version>
<spring-cloud.version>2020.0.0-SNAPSHOT</spring-cloud.version>
</properties>
<dependencies>
<!-- Sleuth with Brave tracer implementation -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-sleuth</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>opentelemetry-exporters-azuremonitor</artifactId>
<version>1.0.0-beta.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web-services</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-sleuth-otel</artifactId>
<version>3.0.0-M6</version>
</dependency>
</dependencies>
<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>
<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>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
</pluginRepository>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
Update (2020-01-26):
With today's release of Spring Cloud Sleuth OTel (spring-cloud-sleuth-otel:1.0.0-M3) and The OTel upgrade in the Azure SDK, your original issue should disappear.
Original Answer
(TL;DR: last paragraph)
The Sleuth 3.0 Migration Guide can help you out a lot here. Sleuth supports two tracing systems Brave (default) and OpenTelemetry (incubator).
In order to use OpenTelemetry, you need to remove Brave (just exclude spring-cloud-sleuth-brave) and add OpenTelemetry (spring-cloud-sleuth-otel-autoconfigure with spring-cloud-sleuth-otel-dependencies). See the docs I linked.
After you do this, your SpanExporter should be used, here's a pom.xml I created based on yours. Btw, adding a sample project (e.g.: in a GitHub repo) could help a lot for everyone who is trying to help so that they don't need to create one themselves.
Unfortunately, this still won't work, you will still face with this exception at startup:
Caused by: java.lang.ClassNotFoundException: io.opentelemetry.common.AttributeValue
This is because opentelemetry-exporters-azuremonitor:1.0.0-beta.1 depends on OpenTelemetry 0.8.0 while the latest spring-cloud-sleuth-otel (1.0.0-M2, we released it today) is using the latest OpenTelemetry (0.13.1). Also, OpenTelemetry introduced breaking changes between minor versions, e.g.: the AttributeValue class was removed in OpenTelemetry 0.9.1.
Sleuth supports OpenTelemetry since Sleuth 3.0.0-M5, The OpenTelemetry version was 0.10 back then so there is no Sleuth version available that would support an OpenTelemetry version as old as opentelemetry-exporters-azuremonitor:1.0.0-beta.1 needs.
So the solution would be fixing your pom.xml and opentelemetry-exporters-azuremonitor supporting the latest OpenTelemetry.
Below is my pom.xml file. On the very first line, I am getting an error of
Error parsing lifecycle processing instructions.
I need help finding what caused the error.
<?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.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>First</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.4.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>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>
This issue was driving me insane, I've finally managed to solve it by deleting the whole maven repository located in:
Windows: c:\Users\<username>\.m2\
After that I just updated the project (Alt+F5 in Eclipse). Issue gone!
Maybe a clash of different versions of Maven (I use several different versions of Eclipse + m2e plugins).
There is some dependency got corrupted into .m2 folder.
You need to delete that dependency from .m2 folder.
If you are not able to find which one is corrupted then delete all
the dependency which are declared into pom.xml file.
It is due to an older version of m2e-wtp integration plugin. To resolve the issue, in Eclipse(Neon) you can go to Help --> Install New Software.. --> Enter http://download.eclipse.org/m2e-wtp/milestones/neon/1.3/ in the Work with box and press enter. Tick all the checkboxes, install the plugins and restart the IDE. It should work. Similarly, for other versions, you might refer the following link https://www.eclipse.org/m2e-wtp/ and try the latest/previous builds depending on your Eclipse version.
Take a look at eclipse web
http://marketplace.eclipse.org/content/maven-integration-eclipse-wtp
The m2eclipse-wtp project has moved to the Eclipse Foundation. The m2eclipse-wtp plugin is now deprecated in favor of the newer m2e-wtp
Automatic installation from the marketplace has been suspended. m2eclipse-wtp 0.15.3 can be manually installed from http://download.jboss.org/jbosstools/updates/m2eclipse-wtp/
You need to first uninstall all m2e-wtp plugins in Eclipse, then install them from jboss url
No need to clean .m2 folder, I fixed this issue by adding corresponding maven to eclipse
Inspite of adding the new path and making changes to the user settings the error "Error parsing lifecycle processing instructions" persists. I restarted the server. Is there any other change required?
This same problem happened to me.
I'm using the new Eclipse Neon. Maybe it's an issue related to the Maven version included in this new release.
I have solved it by using Gradle instead of Maven.
Note: you can try to use Maven with the previous version of Eclipse.
Try this, it might be helpful.
<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.demo</groupId>
<artifactId>test1</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</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>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>HelloWorld</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>${java-version}</source>
<target>${java-version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.4</version>
<configuration>
<warSourceDirectory>src/main/webapp</warSourceDirectory>
<warName>SpringWebExample</warName>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
In my case the same issue was due to different version of maven. One which I installed manualy and other one which came Embedded with STS.
I resolved this issue using below steps:
1. Deleted .M2 folder (c:\Users\.m2)
Downloaded exact version of maven which is embedded with STS and configured same in env. variables and path variable.
STS Embedded maven- Image
Updated projects (Right click on project -> Maven -> Update Project...)
It took some time in update step as all dependencies downloaded again in .M2 folder. Finally issue is resolved.
I suffered the same problem in several projects of my workspace, the ones who belonged to the same parent. I have just one Maven version installed, and my local .m2 repository is working fine for a bunch of other maven projects in my wokspace.
In my case, the cause was a simple XML syntax error in the parent pom. I fixed it, refreshed the affected maven projects, and it went OK.
Before I made modifications to the .xml I made a copy in the same folder. After making my mods I began having issues.
Moving the backup out of the .m2 folder resolved the issue for me.
I want to use dependency from the Cloudera Maven repository:
Extract from my pom.xml:
<repositories>
<repository>
<id>cloudera</id>
<url>https://repository.cloudera.com/cloudera/cloudera-repos/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.10</artifactId>
<version>0.9.0-cdh4.6.0</version>
</dependency>
It depends on parent "spark-parent" that referenced to parent with SNAPSHOT version.
Extract from spark-parent pom.xml (https://repository.cloudera.com/artifactory/cloudera-repos/org/apache/spark/spark-parent/0.9.0-cdh4.6.0/):
<parent>
<groupId>com.cloudera.cdh</groupId>
<artifactId>cdh-root</artifactId>
<version>4.6.0-SNAPSHOT</version>
</parent>
<groupId>org.apache.spark</groupId>
<artifactId>spark-parent</artifactId>
<version>0.9.0-cdh4.6.0</version>
When I run simple "mvn clean package" I have the error that this SNAPSHOT artifact cannot be found.
What is the simplest way to solve this? A solution must be a change in pom.xml or in the build command.
Thanks.
The Cloudera Maven repository doesn't have the artifact com.cloudera.cdh:cdh-root:pom:4.6.0-SNAPSHOT, therefore you won't be able to build your project using it.
However, you can use the Spring cache of this repository: http://repo.spring.io/cloudera-cache. It contains the missing artifacts. You will also have to enable snapshot dependencies inside your repository:
<repositories>
<repository>
<id>cloudera-cache</id>
<url>http://repo.spring.io/cloudera-cache/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
Am trying to add a dependency sauce-connect-plugin in to pom.xml file
<groupId>com.saucelabs.maven.plugin</groupId>
<artifactId>sauce-connect-plugin</artifactId>
<version>2.1.18</version>
</dependency>
But building the pom file am getting
Missing artifact com.saucelabs:sauce-connect:jar:3.1.32
Also i mentioned the repository
<repositories>
<repository>
<id>saucelabs-repository</id>
<url>https://repository-saucelabs.forge.cloudbees.com/release</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
in this url http://repository-saucelabs.forge.cloudbees.com/release/com/saucelabs/sauce-connect/3.1.32/
sauce-connect:jar:3.1.32 is present
Then why Missing artifact error is showing??
What wrong with me.
When i directly add following in tho the pom file and added the repository am getting the same error
<dependency>
<groupId>com.saucelabs</groupId>
<artifactId>sauce-connect</artifactId>
<version>3.1.32</version>
</dependency>
You have used mismatched versions:
sauce-connect-plugin presents in:
http://repository-saucelabs.forge.cloudbees.com/release/com/saucelabs/sauce-connect-plugin/
which have only versions of 1.0.11, 1.0.12, 1.0.13 and 1.0.14.
But you have tried to download 2.1.18
What you mentioned with the URL http://repository-saucelabs.forge.cloudbees.com/release/com/saucelabs/sauce-connect/3.1.32/ will not represent for sauce-connect-plugin. It will represent for only sauce-connect
So you should try with following dependency:
<dependency>
<groupId>com.saucelabs.maven.plugin</groupId>
<artifactId>sauce-connect-plugin</artifactId>
<version>1.0.11</version><!-- 1.0.11, 1.0.12, 1.0.13 or 1.0.14 -->
</dependency>
If you need exactly the version of 2.1.18, then you need to upload the artifact in the location http://repository-saucelabs.forge.cloudbees.com and try.
Here you can find someone who is also using this, try to compare your pom https://github.com/saucelabs/sauce-java/blob/master/sauce-connect-plugin/pom.xml