java.lang.RuntimeException : RESTEASY003325: Failed to construct public api

标签 java resteasy wildfly-10

我已经调试这个错误好几天了,但找不到原因。

    ERROR [io.undertow.request] (default task-4) UT005023: Exception handling request to /fortuneClaim/USER/v1/request: java.lang.RuntimeException: RESTEASY003325: Failed to construct public com.ph.tlc.fic.api.ApiApplication()
    at org.jboss.resteasy.core.ConstructorInjectorImpl.construct(ConstructorInjectorImpl.java:162)
    at org.jboss.resteasy.spi.ResteasyProviderFactory.createProviderInstance(ResteasyProviderFactory.java:2209)
    at org.jboss.resteasy.spi.ResteasyDeployment.createApplication(ResteasyDeployment.java:299)
    at org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:240)
    at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.init(ServletContainerDispatcher.java:113)
    at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.init(HttpServletDispatcher.java:36)
    at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:117)
    at org.wildfly.extension.undertow.security.RunAsLifecycleInterceptor.init(RunAsLifecycleInterceptor.java:78)
    at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:103)
    at io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:231)
    at io.undertow.servlet.core.ManagedServlet.getServlet(ManagedServlet.java:170)
    at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:84)
    at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
    at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
    at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
    at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
    at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
    at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
    at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
    at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
    at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:284)
    at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:263)
    at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
    at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:174)
    at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)
    at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:793)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
      Caused by: java.lang.NoClassDefFoundError: org/omg/IOP/TransactionService
    at com.ph.tlc.fic.controller.UserController.<clinit>(UserController.java:29)
    at com.ph.tlc.fic.api.ApiApplication.<init>(ApiApplication.java:24)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.jboss.resteasy.core.ConstructorInjectorImpl.construct(ConstructorInjectorImpl.java:150)
    ... 37 more
      Caused by: java.lang.ClassNotFoundException: org.omg.IOP.TransactionService from [Module "deployment.FortuneClaim.war:main" from Service Module Loader]
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:198)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)
    ... 44 more

这是 ApiApplication.java

public class ApiApplication extends Application{

    private Set<Object> singletons = new HashSet<Object>();

    public ApiApplication(){
        singletons.add(new UserController());
        singletons.add(new TransactionController());
    }

    @Override
    public Set<Object> getSingletons(){
        return singletons;
    }

    }

和我的 web.xml

       <?xml version="1.0" encoding="UTF-8"?>
       <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"     xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:web="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"   id="WebApp_ID" version="2.4">
      <display-name>FortuneClaim</display-name>
       <context-param>
        <param-name>resteasy.async.job.service.base.path</param-name>
        <param-value>/asynch/jobs</param-value>
       </context-param>
     <servlet>
       <servlet-name>resteasy-servlet</servlet-name>
       <servlet-    class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-     class>
        <init-param>
          <param-name>javax.ws.rs.Application</param-name>
           <param-value>com.ph.tlc.fic.api.ApiApplication</param-value>
        </init-param>
      </servlet>
      <servlet-mapping>
      <servlet-name>resteasy-servlet</servlet-name>
       <url-pattern>/*</url-pattern>
     </servlet-mapping>
    </web-app>

我使用的是 Wildfly 10。

最佳答案

我也遇到了同样的问题。

它帮助我将休息服务类(class)的范围更改为公共(public)

class TestRestService extends Application

public class TestRestService extends Application

关于java.lang.RuntimeException : RESTEASY003325: Failed to construct public api,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42577993/

相关文章:

java - Wildfly 10.1 消耗所有内核

java - 我如何取消部署 WildFly 中的所有工件?

java - 模拟注解方法时的 NPE

java - 创建包含收件人、主题、正文和附件的电子邮件

java - mvn 包后缺少 resteasy 提供程序

java - jpa2 使用 guice 重用 entityManager

java - Springboot Wildfly 10 部署错误 jdk.unsupported module not found

java - 如何在第 1 天后停止执行方法。时间?

java - 使所有数组元素相等的最小递增-其他操作数

web-services - 在 RESTEasy JAX-RS 中注入(inject)自定义响应 header