Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vaadin, Jetty, Spring Data, Maven - Exception

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>

like image 587
user66875 Avatar asked Sep 28 '22 00:09

user66875


1 Answers

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.

  1. 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 the demo.DemoApplication so it can properly discover the spring configuration and initialize the context.

  1. 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.
like image 167
Morfic Avatar answered Nov 15 '22 04:11

Morfic