简体   繁体   English

错误:将Java设置为Windows服务时,没有类Def找到错误

[英]Error: No class Def found error while setting up Java as a Windows Service

Following is the error log I'm getting: 以下是我得到的错误日志: 在此处输入图片说明

I'm using 我正在使用

wrapper-windows-x86-32-3.5.25-pro wrapper-windows-x86-32-3.5.25-pro

in order to make my already developed application in Spring-boot. 为了使我已经开发的应用程序在Spring-boot中运行。 I wanted to execute this application as a windows service but I'm not. 我想将此应用程序作为Windows服务执行,但不是。

This problem is specific to Tanukisoftware as I'm unable to configure it. 此问题特定于Tanukisoftware,因为我无法对其进行配置。

PFB the configuration I'm using for setting up the class path here: PFB我用于在此处设置类路径的配置:

wrapper.java.classpath.1=../lib/wrappertest.jar
wrapper.java.classpath.2=../lib/wrapper.jar
wrapper.java.classpath.3=../lib/slf4j-api-1.7.5
wrapper.java.classpath.4=../lib/myApp.jar

even if myApp.jar contains the slf4j classpath already and its running already. 即使myApp.jar已经包含slf4j类路径并且已经在运行。 I think this is library specific problem and its not finding up the classpath even if I explicitly set it like did above. 我认为这是特定于库的问题,即使我像上面那样明确设置,也无法找到类路径。

Can you please let me know how it can be solved? 您能告诉我如何解决吗?

Did you try building a fat jar of your application ? 您是否尝试构建应用程序的胖子? You can add following lines to your Spring Boot project's pom.xml to repackage jar file: 您可以在Spring Boot项目的pom.xml添加以下行以重新打包jar文件:

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

Besides, your following property line seems invalid: 此外,您的以下属性行似乎无效:

wrapper.java.classpath.3=../lib/slf4j-api-1.7.5

Is it pointing a jar file actually ? 它实际上指向一个jar文件吗?

slf4j-api-1.7.5 should have a .jar extension. SLF4J-API-1.7.5应该有一个.jar扩展名。 That is possibly confusing things. 那可能使事情变得混乱。

另外,即使只是调试步骤,也请尝试使用Apache ProcRun运行Windows服务,以查看结果是否有所不同。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM