简体   繁体   English

weblogic ADF中的固定/非理性java.lang.ClassNotFoundException,JAR中的类

[英]Stubborn/irrational java.lang.ClassNotFoundException in weblogic ADF, class in JAR

I'm new to ADF/JDeveloper and am struggling with the typical 'class not found' - hopefully there's a trick to this? 我是ADF / JDeveloper的新手,并且正在与典型的“未找到的课程”挣扎 - 希望有一个技巧吗?

Using: JDeveloper 12c and the integrated web logic server. 使用:JDeveloper 12c和集成的Web逻辑服务器。

Situation: A Servlet is registered in web.xml, but the class is in a JAR 情况:Servlet在web.xml中注册,但该类在JAR中

<servlet>
    <description>..</description>
    <servlet-name>ABCHandlerServlet</servlet-name>
    <servlet-class>com.mine.ControlServlet</servlet-class>
    <init-param>
    <param-name>licenseKey</param-name>
    <param-value>123</param-value>
    </init-param>
</servlet>
...
<servlet-mapping>
    <servlet-name>ABCHandlerServlet</servlet-name>
    <url-pattern>/servlet/GaugeServlet/*</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>ABCHandlerServlet</servlet-name>
    <url-pattern>/mapproxy/*</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>resources</servlet-name>
    <url-pattern>/bi/*</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>ABCHandlerServlet</servlet-name>
    <url-pattern>*.ABC</url-pattern>
</servlet-mapping>  

com.mine.ControlServlet, which it reports at deployment cannot be found, is in a JAR file. 无法找到部署时报告的com.mine.ControlServlet位于JAR文件中。

The JAR file is under JAR文件位于

ViewController/Application Sources/META-INF/lib/myjar.jar ViewController / Application Sources / META-INF / lib / myjar.jar

I've triple checked that the class is inside that JAR. 我已经三次检查该类是否在JAR中。

I've also tried adding that JAR to the project classpath, although that doesn't seem necessary (didn't make a difference anyway). 我也尝试将JAR添加到项目类路径中,尽管这似乎没有必要(无论如何都没有任何区别)。

FWIW the JAR/Servlet has been used many times in a non ADF environment, so I doubt that the problem is within the JAR. FWIW JAR / Servlet已在非ADF环境中多次使用,因此我怀疑问题是否在JAR中。

Removing the JAR from Project Properties->Libraries and Classpath and then readding it fixed the problem. 从项目属性 - >库和类路径中删除JAR,然后读取它修复了问题。

Time, wasted. 浪费时间。

Thanks though to florinmarcus, 1up. 谢谢florinmarcus,1up。

The library might not be packaged in your WAR. 该库可能未包装在WAR中。 Adding the library to ViewControler libraries is half of the story. 将库添加到ViewControler库只是故事的一半。 You may want to check if your WAR deployment profile packages the library too: 您可能还想检查WAR部署配置文件是否也包含库:

Right-Click on ViewController -> Project Properties -> Deployment -> Select the existing Web module in the right -> Edit (icon) -> WEB-INF/lib -> Contributors -> Make sure the library is is checked as part of the deployment. 右键单击ViewController - >项目属性 - >部署 - >选择右侧的现有Web模块 - >编辑(图标) - > WEB-INF / lib - >贡献者 - >确保库已被选中作为部署。

You can double-check the WAR contents by Right-Click View Controller > Project Properties -> Select the Web Module -> Deploy to WAR. 您可以通过右键单击View Controller> Project Properties - >选择Web模块 - > Deploy to WAR来仔细检查WAR内容。

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

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