Xav*_*ier 1 apache-commons-logging quarkus
在本机模式下运行休息服务时,我得到一个类 org.apache.commons.logging.impl.LogFactoryImpl not found 异常。它在 openjdk 模式下运行良好。
我已经写了一个小的服务休息来解决这个问题。
服务休息:
package org.acme.rest.json;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import io.quarkus.deployment.builditem.substrate.ReflectiveClassBuildItem;
import io.quarkus.deployment.annotations.BuildStep;
@Path("/logs")
public class LogResource {
private Log log = LogFactory.getLog(LogResource.class);
@GET
@Produces(MediaType.TEXT_PLAIN)
public String hello() {
log.info("jello");
return "hello";
}
}
Run Code Online (Sandbox Code Playgroud)
调用此文件时,我得到
xception handling request 04cf25a8-aafb-4b2a-978e-47a24009b22d-1 to /logs: org.jboss.resteasy.spi.UnhandledException: org.apache.commons.logging.LogConfigurationException: java.lang.ClassNotFoundException: org.apache.commons.logging.impl.LogFactoryImpl (Caused by java.lang.ClassNotFoundException: org.apache.commons.logging.impl.LogFactoryImpl)
Run Code Online (Sandbox Code Playgroud)
按照您的建议,我使用以下配置运行它: pom.xml
<build>
<plugins>
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<version>${quarkus.version}</version>
<executions>
<execution>
<goals>
<goal>native-image</goal>
</goals>
<configuration>
<enableHttpUrlHandler>true</enableHttpUrlHandler>
<additionalBuildArgs>-H:ReflectionConfigurationFiles=/home/dev/repo/quarkus-mailbox-native//src/main/resources/reflectconfig.json,-H:DynamicProxyConfigurationFiles=/home/dev/repo/quarkus-mailbox-native/src/main/resources/dynamicproxy.json</additionalBuildArgs>
</configuration>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
反射.json
[
{
"name" : "org.apache.commons.logging.impl.LogFactoryImpl",
"allDeclaredConstructors" : true,
"allPublicConstructors" : true,
"allDeclaredMethods" : true,
"allPublicMethods" : true,
"allDeclaredClasses" : true,
"allPublicClasses" : true
},
{
"name" : "java.lang.String",
"allDeclaredConstructors" : true,
"allPublicConstructors" : true,
"allDeclaredMethods" : true,
"allPublicMethods" : true,
"allDeclaredClasses" : true,
"allPublicClasses" : true
},
{
"name" : "org.apache.commons.logging.LogFactory",
"allDeclaredConstructors" : true,
"allPublicConstructors" : true,
"allDeclaredMethods" : true,
"allPublicMethods" : true,
"allDeclaredClasses" : true,
"allPublicClasses" : true
},
{
"name" : "org.apache.commons.logging.impl.SimpleLog",
"allDeclaredConstructors" : true,
"allPublicConstructors" : true,
"allDeclaredMethods" : true,
"allPublicMethods" : true,
"allDeclaredClasses" : true,
"allPublicClasses" : true
}
]
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助。
X。
| 归档时间: |
|
| 查看次数: |
1611 次 |
| 最近记录: |