.dll already loaded in another classloader?

前端 未结 4 784
庸人自扰
庸人自扰 2020-11-27 07:23

I have a webapp running under Tomcat 3.2.1 that needs to make JNI calls in order to access data and methods in legacy C++ code. A servlet is loaded on startup of the webapp

相关标签:
4条回答
  • 2020-11-27 07:59

    You can't load the same native library twice.

    Put the class in a jar file under <tomcat>/lib/, it will be shared over all wars.

    0 讨论(0)
  • 2020-11-27 08:03

    I had this problem and I solved it:

    Problem:

    The problem is due to some configurations of your application server which cause to create more than one war or ear files and consequently it creates more than one deployed files. These deployed files attempt to have a concurrent access to your native library which loaded in a static block.

    Solution:

    1. Stop your Application Server and close the IDEA
    2. Finish all java processes from task manager
    3. Go to this address of your App Server: jboss-eap-6.4.0\standalone\configuration and open standalone.xml file
    4. In the standalone.xml , delete all the deployments tag (Don't worry, when you rerun the application server, it inserts this tag
    5. Go to this address of your App Server: jboss-eap-6.4.0\standalone\deployments and delete all deployed files and war files. (You can backup your war files)
    6. Open IntelliJ Idea and go to: Edit Configuration JBOSS -> Deployment tab
    7. Delete current deployment and add a new one that should be exploded
    0 讨论(0)
  • 2020-11-27 08:09

    Copy the DLLs to temporary files in a temporary directory before loading them. Delete the files when you are done. This way you can ensure that the same DLL is not loaded twice.

    0 讨论(0)
  • 2020-11-27 08:17

    See the section I'm encountering classloader problems when using JNI under Tomcat on the Tomcat HowTo wiki (http://wiki.apache.org/tomcat/HowTo)

    0 讨论(0)
提交回复
热议问题