1

I have a web project to run at a wildfly server which need an external jar . I put the jar in the deployment folder and add jboss-deployment-structure.xml with below code and it works.

<dependencies>
            <module name="deployment.sapjco3.jar" export="true" /> 
        </dependencies>

But if I removed the xml and jar and put the jar in a folder, then add the folder to PATH environment variable and jar to classpath environment variable,run Jboss again and it didn't work.
In log I saw below info.

java.awt.printerjob = sun.awt.windows.WPrinterJob
    java.class.path = D:\BPM\wildfly-11.0.0.Final\jboss-modules.jar
    java.class.version = 52.0
    java.endorsed.dirs = D:\BPM\java-1.8.0-openjdk-1.8.0.181-1.b13.redhat.windows.x86_64\jre\lib\endorsed
    java.ext.dirs = D:\BPM\java-1.8.0-openjdk-1.8.0.181-1.b13.redhat.windows.x86_64\jre\lib\ext;C:\Windows\Sun\Java\lib\ext
    java.home = D:\BPM\java-1.8.0-openjdk-1.8.0.181-1.b13.redhat.windows.x86_64\jre
    java.io.tmpdir = C:\Users\ADMINI~1\AppData\Local\Temp\2\
    java.library.path = D:\BPM\java-1.8.0-openjdk-1.8.0.181-1.b13.redhat.windows.x86_64\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\ojdkbuild\java-1.8.0-openjdk-1.8.0.201-1\bin;D:\BPM\sapjco30;.
    java.net.preferIPv4Stack = true

Is it mean Jboss find the folder but not the jar class? Then how to configure the project to use it? Thanks.

kk luo
  • 549
  • 1
  • 9
  • 22
  • 1
    Have you looked at the class loading documentation? https://docs.wildfly.org/19.1/Developer_Guide.html#Class_Loading_in_WildFly – James R. Perkins May 12 '20 at 18:55
  • @James R. Perkins I checked it and a little bit confused. I guess I need to add the jar to the global modules but it didn't explain how to do it. – kk luo May 13 '20 at 00:53
  • 1
    You'd first need to install the library as a module. Then you'd either add it to the global modules or you'd add it as a dependency in your `jboss-deployment-structure.xml`. – James R. Perkins May 13 '20 at 16:32
  • @James R. Perkins Thx. Can you tell me how to add it to global modules? I added it to the module folder and create module.xml for it. According to the guide I need to add global_modules tag to standalone/domain.xml. But there is a standalone.xml and a domain.xml. Do I need to add both? My wildfly is 11, I don't know is it compatiable with this option. – kk luo May 13 '20 at 22:53
  • 1
    You only need to add it to the type of server you're running. If you're running in standalone mode use the standalone.xml. If you're running in domain mode you'd use the domain.xml. – James R. Perkins May 13 '20 at 23:32

0 Answers0