[英]Vaadin, Jetty, Spring Data, Maven - Exception
I'm trying to integrate Spring Data within our Vaadin project. 我正在尝试将Spring Data集成到我们的Vaadin项目中。 So I tried running the following sample code which uses the same technologies: 所以我尝试运行以下使用相同技术的示例代码:
https://github.com/henrikerola/vaadin-spring-boot-todo https://github.com/henrikerola/vaadin-spring-boot-todo
The only thing I changed is that I added jetty as we need to use it for our project. 我唯一改变的是我添加了jetty,因为我们需要将它用于我们的项目。
Unfortunately, after jetty:run
I'm getting the following exception: 不幸的是,在jetty:run
之后jetty:run
我得到以下异常:
Exception in thread "main" java.util.ServiceConfigurationError: org.apache.juli.logging.Log: Provider org.eclipse.jetty.apache.jsp.JuliLog not a subtype
My pom.xml looks like this: 我的pom.xml看起来像这样:
<?xml version="1.0" encoding="UTF-8"?>...
<modelVersion>4.0.0</modelVersion>
<groupId>org.test</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<start-class>demo.DemoApplication</start-class>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-spring-boot-starter</artifactId>
<version>1.0.0.beta2</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-bom</artifactId>
<version>7.4.2</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>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.2.10.v20150310</version>
</plugin>
</plugins>
</build>
I haven't had the chance to dig up the actual reason for this, but I suspect a classpath issue between jetty & tomcat which is preferred by spring-boot. 我没有机会挖掘出这个的实际原因,但我怀疑jetty和tomcat之间的类路径问题是spring-boot首选的。
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
Also, instead of running mvn jetty-run
you'd probably want to run the demo.DemoApplication
so it can properly discover the spring configuration and initialize the context. 此外,您可能希望运行demo.DemoApplication
而不是运行mvn jetty-run
,以便正确发现spring配置并初始化上下文。
For what it's worth after two years: The error message tells you that org.eclipse.jetty.apache.jsp.JuliLog
is not a subclass/implementation of org.apache.juli.logging.Log
. 两年后它的价值:错误消息告诉你org.eclipse.jetty.apache.jsp.JuliLog
不是org.apache.juli.logging.Log
的子类/实现。
This happens if there are multiple jars containing the same class ( org.apache.juli.logging.Log
in this case I suppose) and multiple classloaders providing the same class (that are regarded as different in instance-of
and isAssignableFrom-checks
). 如果有多个包含相同类的jar(在这种情况下我认为是org.apache.juli.logging.Log
),并且多个类加载器提供相同的类(在instance-of
和isAssignableFrom-checks
中被视为不同),则会发生这种情况。
Check the jars that were downloaded for the occurrence of org.apache.juli.logging.Log.class
and see where they are coming from. 检查为org.apache.juli.logging.Log.class
的发生而下载的jar,并查看它们的来源。 After adjusting that in your pom, you should be able to get rid off the error. 在你的pom中调整它之后,你应该能够摆脱错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.