Wildfly: Error getting reflective information for class

杀马特。学长 韩版系。学妹 提交于 2020-02-06 07:44:34

问题


I am dealing with two Eclipse Project. The former includes some Session Beans that I manage to deploy on Wildfly Servr. The Latter includes a Servlet I need to inject and use the bean.

This is the structure of the projects containing the session bean. Projects is the session bean I want to use as Session Facade to interact with the Project JPA entity.

This is the servlet Injecting the Session bean. ProjectsLocal is its Local interface.

@EJB
private ProjectsLocal projects;

/**
 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
 */
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // TODO Auto-generated method stub
    projects.createProject("TestProject");
    String res = projects.getAllProjects();
    System.out.println(res);
    request.getRequestDispatcher("/projects.jsp").forward(request,response);
}

This is the web.xml

<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
   <ejb-local-ref>
    <ejb-ref-name>Projects</ejb-ref-name>
    <ejb-ref-type>Session</ejb-ref-type>
    <local-home>entities.ProjectsLocal</local-home>
    <local>myBeans.BeanA</local>
  </ejb-local-ref>

  <security-constraint>
    <web-resource-collection>
      <web-resource-name>administrator</web-resource-name>
      <url-pattern>/twp/Login/*</url-pattern>
      <http-method>POST</http-method>
      <http-method>GET</http-method>
      <http-method>PUT</http-method>
      <http-method>DELETE</http-method>
    </web-resource-collection>
    <auth-constraint>
      <role-name>ADMINISTRATOR</role-name>
    </auth-constraint>
  </security-constraint>
  <login-config>
    <auth-method>FORM</auth-method>
    <realm-name>school</realm-name>
    <form-login-config>
      <form-login-page>/login.xhtml</form-login-page>
      <form-error-page>/error.xhtml</form-error-page>
    </form-login-config>
  </login-config>
  <security-role>
    <role-name>ADMINISTRATOR</role-name>
  </security-role>
  <security-role>
    <role-name>USER</role-name>
  </security-role>
</web-app>

I get his error when deploying the web appliction: Error getting reflective information for class servlet.Projects


回答1:


With Reference to this article. The Class loading in JBoss AS7+ is considerably different to previous versions of JBoss AS.
Class loading is based on the JBoss Modules project. Instead of the more familiar hierarchical class loading environment, AS7's class loading is based on modules that have to define explicit dependencies on other modules.

Ear deployments are multi-module deployments. This means that not all classes inside an ear will necessarily have access to all other classes in the ear, unless explicit dependencies have been defined. By default the EAR/lib directory is a single module, and every WAR or EJB jar deployment is also a separate module.

Refer to the jboss-deployment-structure.xml in the article for an ear deployment.



来源:https://stackoverflow.com/questions/46986796/wildfly-error-getting-reflective-information-for-class

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!