Vaadin,Jetty,Spring Data,Maven-例外 [英] Vaadin, Jetty, Spring Data, Maven - Exception
问题描述
我正在尝试将Spring Data集成到我们的Vaadin项目中.因此,我尝试运行以下使用相同技术的示例代码:
https://github.com/henrikerola/vaadin-spring-boot-todo >
我唯一更改的是我添加了码头,因为我们需要在项目中使用它.
不幸的是,在jetty:run
之后,我得到了以下异常:
Exception in thread "main" java.util.ServiceConfigurationError:
org.apache.juli.logging.Log: Provider org.eclipse.jetty.apache.jsp.JuliLog not a subtype
我的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>
我还没有机会找出造成这种情况的实际原因,但是我怀疑码头与码头之间存在类路径问题. spring-boot首选的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>
此外,您可能不想运行
mvn jetty-run
,而是希望运行demo.DemoApplication
,以便它可以正确发现spring配置并初始化上下文.- 如果计划避免使用spring-boot,请删除父定义以及其他启动依赖项和插件.另外,请记住手动设置应用程序以在starup上初始化spring上下文.
I'm trying to integrate Spring Data within our Vaadin project. So I tried running the following sample code which uses the same technologies:
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.
Unfortunately, after
jetty:run
I'm getting the following exception: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:
<?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.
- Anyhow, if you plan on further using spring-boot which is probably easiest, the spring-boot documentation offers an example of replacing tomcat with jetty, and it's simple as adding the following to your pom:
<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 thedemo.DemoApplication
so it can properly discover the spring configuration and initialize the context.- If you plan on avoiding spring-boot, then remove the parent definition as well as the other boot dependencies and plugins. Also, remember to manually setup the application to initialize the spring context on starup.
这篇关于Vaadin,Jetty,Spring Data,Maven-例外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!