简体   繁体   English

在 maven 依赖项中添加 pubnub 后,Spring Boot 应用程序不启动

[英]Spring boot application does not start after adding pubnub in maven dependency

My Spring boot application does not start after i add pubnub in maven.在 maven 中添加 pubnub 后,我的 Spring Boot 应用程序无法启动。

Here is my pom.xml这是我的 pom.xml

    <?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>
    <version>0.0.1-SNAPSHOT</version>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.4.0.RELEASE</version>
        <relativePath />
    </parent>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <version>1.4.0.RELEASE</version>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>log4j-over-slf4j</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <!-- https://mvnrepository.com/artifact/com.pubnub/pubnub -->
        <dependency>
            <groupId>com.pubnub</groupId>
            <artifactId>pubnub</artifactId>
            <version>4.0.14</version>
        </dependency>
    </dependencies>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <start-class>com.XXX.Application</start-class>
        <java.version>1.8</java.version>
    </properties>

    <groupId>smartSense</groupId>
    <artifactId>XXX</artifactId>
    <name>XXX</name>
    <description>smartSense Construction ERP</description>
</project>

I got this exception while running spring boot jar我在运行 spring boot jar 时遇到了这个异常

Exception :例外 :

    Exception in thread "main" java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:58)
Caused by: java.lang.IllegalArgumentException: LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback or the competing implementation (class org.slf4j.helpers.NOPLoggerFactory loaded from jar:file:/home/nitin/projects/bitbucket/cerp/target/cerp-0.0.1-SNAPSHOT.jar!/BOOT-INF/lib/slf4j-api-1.7.21.jar!/). If you are using WebLogic you will need to add 'org.slf4j' to prefer-application-packages in WEB-INF/weblogic.xml Object of class [org.slf4j.helpers.NOPLoggerFactory] must be an instance of class ch.qos.logback.classic.LoggerContext
    at org.springframework.util.Assert.isInstanceOf(Assert.java:346)
    at org.springframework.boot.logging.logback.LogbackLoggingSystem.getLoggerContext(LogbackLoggingSystem.java:221)
    at org.springframework.boot.logging.logback.LogbackLoggingSystem.getLogger(LogbackLoggingSystem.java:213)
    at org.springframework.boot.logging.logback.LogbackLoggingSystem.beforeInitialize(LogbackLoggingSystem.java:98)
    at org.springframework.boot.logging.LoggingApplicationListener.onApplicationStartedEvent(LoggingApplicationListener.java:222)
    at org.springframework.boot.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:204)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:166)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:138)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:121)
    at org.springframework.boot.context.event.EventPublishingRunListener.started(EventPublishingRunListener.java:62)
    at org.springframework.boot.SpringApplicationRunListeners.started(SpringApplicationRunListeners.java:48)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1185)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1174)
    at com.cerp.Application.main(Application.java:89)
    ... 8 more

I building micro service for real time web application, I want to use pubnub for sending notification to web browser.我为实时 Web 应用程序构建微服务,我想使用 pubnub 向 Web 浏览器发送通知。 If i removed pubnub then it works fine.如果我删除了 pubnub 那么它就可以正常工作。 Can you please help to resolve this issue?你能帮忙解决这个问题吗?

it seems pubnub has a transitive dependency to:似乎 pubnub 有一个传递依赖:

<dependency>
  <groupId>org.slf4j</groupId>
  <artifactId>slf4j-nop</artifactId>
  <version>1.7.21</version>
  <scope>compile</scope>
</dependency>

if you add an exclusion to your pubnub dependency (see here ) it may already work.如果您将排除项添加到您的 pubnub 依赖项(请参阅此处),它可能已经有效。 But maybe this breaks the logging in pubnub :/ - but I would give it a try.但也许这会破坏 pubnub 中的日志记录:/ - 但我会尝试一下。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 具有jar依赖项的Spring Boot应用程序在Maven构建后无法运行 - Spring Boot application with a jar dependency does not run after maven build 添加日志记录后,为什么 Spring Boot 应用程序无法完全启动? - Why spring boot application does not start fully after adding logging? 添加 Jpa maven 依赖后无法运行 spring boot app - Cannot run spring boot app after adding Jpa maven dependency 添加 ssl 证书 spring 启动应用程序无法启动后 - After adding ssl certificate spring boot application fails to start Spring启动应用程序无法启动 - Spring boot application does not start 在 spring 启动应用程序中集成 Spring AOP 作为 maven 依赖项 - Integrate Spring AOP as a maven dependency in a spring boot application Spring 启动应用程序升级到 2.6.0 后由于循环依赖无法启动[无法解析的循环引用] - Spring boot application fails to start after upgrading to 2.6.0 due to circular dependency[ unresolvable circular reference] 升级到 Spring Boot 2 后应用程序无法启动 - Application fails to start after upgrading to Spring Boot 2 Spring Boot应用程序作为依赖项 - Spring boot application as dependency 来自Maven依赖项的Spring Boot RestController不起作用 - spring boot RestController from maven dependency does not work
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM