77388

IllegalAccessError: tried to access class …LoggingSystemProperties from class …LoggingApplicationLis

Question:

I am trying to use a spring boot jar I made as a library for another spring boot app I am making.

<strong>Library pom:</strong>

<?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.mygroup</groupId> <artifactId>mylib</artifactId> <version>0.0.1</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>2.0.0.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</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> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project>

<strong>App pom:</strong>

<?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.mygroup</groupId> <artifactId>myapp</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>demoapp</name> <description>Demo project for Spring Boot</description> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.0.0.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>com.mygroup</groupId> <artifactId>mylib</artifactId> <version>0.0.1</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-rest</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> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project>

<strong>The error:</strong>

SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/C:/Users/myuser/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/C:/Users/myuser/.m2/repository/org/atteo/evo-inflector/1.2.2/evo-inflector-1.2.2.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder] 15:38:32.640 [main] DEBUG org.springframework.boot.devtools.settings.DevToolsSettings - Included patterns for restart : [] 15:38:32.640 [main] DEBUG org.springframework.boot.devtools.settings.DevToolsSettings - Excluded patterns for restart : [/spring-boot-starter/target/classes/, /spring-boot-autoconfigure/target/classes/, /spring-boot-starter-[\w-]+/, /spring-boot/target/classes/, /spring-boot-actuator/target/classes/, /spring-boot-devtools/target/classes/, /spring-boot-starter/target/classes/, /spring-boot-autoconfigure/target/classes/, /spring-boot-starter-[\w-]+/, /spring-boot/target/classes/, /spring-boot-actuator/target/classes/, /spring-boot-devtools/target/classes/] 15:38:32.640 [main] DEBUG org.springframework.boot.devtools.restart.ChangeableUrls - Matching URLs for reloading : [file:/C:/Users/myuser/workspace/myapp/target/classes/, file:/C:/Users/myuser/workspace/myapp/target/classes/, file:/C:/Users/myuser/workspace/myapp/target/test-classes/] 2018-03-06 15:38:32.832 ERROR 104508 --- [ restartedMain] o.s.boot.SpringApplication : Application startup failed java.lang.IllegalAccessError: tried to access class org.springframework.boot.logging.LoggingSystemProperties from class org.springframework.boot.context.logging.LoggingApplicationListener at org.springframework.boot.context.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:231) ~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE] at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:200) ~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE] at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:173) ~[spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE] at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) ~[evo-inflector-1.2.2.jar:na] at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) ~[evo-inflector-1.2.2.jar:na] at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) ~[evo-inflector-1.2.2.jar:na] at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:122) ~[evo-inflector-1.2.2.jar:na] at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:74) ~[evo-inflector-1.2.2.jar:na] at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54) ~[evo-inflector-1.2.2.jar:na] at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:325) [evo-inflector-1.2.2.jar:na] at org.springframework.boot.SpringApplication.run(SpringApplication.java:296) [evo-inflector-1.2.2.jar:na] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118) [evo-inflector-1.2.2.jar:na] at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107) [evo-inflector-1.2.2.jar:na] at com.mygroup.myapp.DemoApplication.main(DemoApplication.java:10) [classes/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_161] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_161] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_161] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_161] at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [evo-inflector-1.2.2.jar:na]

I realize I can exclude one of the bindings but I have two issues. I don't know which dependencies are using "logback-classic" and "evo-inflector" and even if I did, I want to be able to include my library into other apps of mine without any extra configuration.

Is there a way to solve this so that my library can be included without any extra configuration?

Answer1:

Seems to be fixed simply by deleting ch/qos/logback and org/atteo/evo-inflector out of my maven repository and letting them re-download.

Recommend

  • Null results when reading a resource
  • Arquillian integration test code coverage issue with Jacoco
  • How to properly hot deploy/redeploy war on Tomcat with maven-tomcat7-plugin?
  • Encoding issue of Euro sign
  • extract-text-webpack-plugin - extracting scss results in no mapping in main.css.map
  • Webpack bundle client specific components
  • to set MutationObserver, How to inject javascript before page-loading using Selenium
  • Cannot go directly to dynamic route with react-router and webpack-dev-server
  • How to force Composer to download a local package?
  • RabbitMQ java client stops consuming messages
  • How to load Q library with Require.js?
  • MAVEN : Run Multiple Maven Project using Maven Test
  • How do you create a Fuseki SPARQL server using the Apache Jena Java API?
  • Unzip archive in .Net CORE 1.0
  • runtime error when linking ffmpeg libraries in qt creator
  • TFS - how do I sum child task hours to parent
  • jquery validation - waiting for remote check to complete
  • apply a javascript function to draggable copy
  • Ruby on Rails App deployed to heroku showing “We're sorry, but something went wrong”
  • Detecting null parameter in preprocessor macro
  • C# program and C++ DLL compiled for 32-bit system crash on 64-bit system
  • Silverlight DependencyProperty.SetCurrentValue Equivalent
  • Unable to install Git-core+svn by MacPorts
  • How do I exclude a dependency in provided scope when running in Maven test scope?
  • Is it possible to access block's scope in method?
  • Reading JSON from a file using C++ REST SDK (Casablanca)
  • Control modification in presentation layer
  • FB SDK and cURL: Unknown SSL protocol error in connection to graph.facebook.com:443
  • Display issues when we change from one jquery mobile page to another in firefox
  • Deselecting radio buttons while keeping the View Model in synch
  • RectangularRangeIndicator format like triangular using dojo
  • Cross-Platform Protobuf Serialization
  • JSON with duplicate key names losing information when parsed
  • jQuery tmpl and DataLink beta
  • Jquery - Jquery Wysiwyg return html as a string
  • Is there a mandatory requirement to switch app.yaml?
  • How to format a variable of double type
  • coudnt use logback because of log4j
  • JaxB to read class hierarchy
  • UserPrincipal.Current returns apppool on IIS