2

UPDATE: This unanswered question on jboss forums, is another way of describing my exact problem: https://developer.jboss.org/thread/199888

Original post:I am trying to make integrated authentication work on web applications deployed to JBoss 7.x. I have successfully made one work, by copying sqljdbc_auth.dll into either Windows/System32, or {java location}/jre/bin. However, if two or more applications are running, I will get an error saying that Native Library sqljdbc_auth.dll already loaded in another classloader

I know why this error is happening, and this question and answer has a Tomcat solution. But I can't make it work in JBoss. Actually, putting the dll inside the jboss/bin folder gives the exact same error as before:

Failed to load the sqljdbc_auth.dll cause : 
Native Library C:\Jboss-eap-7.0\bin\sqljdbc_auth.dll already loaded in another classloader

How do I configure JBoss, and/or place the sqljdbc_auth.dll?

My deployments are not located under any module, or named server instance. I think it's simply called standalone

I have tried this approach as well, but I can not figure out where to put the jar file, in the JBoss directories. I tried deploying it as a deployment like the web applications, and I tried copying it into the lib folder, under standalone. No success.

EDIT:

I am trying to implement a global module, as per the answer posted, but get following error now:

14:00:25,333 ERROR [stderr] (ServerService Thread Pool -- 121)
java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver from 
[Module "deployment.MyWebapp.war:main" from Service Module Loader]
TylerH
  • 20,799
  • 66
  • 75
  • 101
jumps4fun
  • 3,994
  • 10
  • 50
  • 96

1 Answers1

2

I assume you must have created a module for sql jdbc driver something like this.

<module xmlns="urn:jboss:module:1.3" name="com.microsoft.sqlserver">
  <resources>
    <resource-root path="sqljdbc.jar"/>
  </resources>
  <dependencies>
    <module name="javax.api"/>
    <module name="javax.transaction.api"/>
  </dependencies>
</module>

And added this module as dependency to each of your deployed application.

I would suggest to declare this module as global module by editing the standalone.xml file like this ..

<subsystem xmlns="urn:jboss:domain:ee:4.0">
            <global-modules>
                <module name="com.microsoft.sqlserver" slot="main"/>
                 .
                 .
            </global-modules>
.
.
</subsystem>

And remove the dependency to this module from your individual applications.

vsoni
  • 2,828
  • 9
  • 13
  • I know nothing about modules. Could you add which xml file you are refering to in the first code example? I have not added any modules whatsoever. The sqljdbc was first implemented inside the war-files, and later just defined as scope=provided in my project pom.xml (maven). – jumps4fun Dec 20 '17 at 11:50
  • The module definition may be either in `jboss-deployment-structure.xml` or in a separate `module.xml` file in `\modules\com\microsoft\sqlserver\main`. – vsoni Dec 20 '17 at 12:22
  • @KjetilNordin - The directory structure under \modules\ folder may vary depending on the name of module. – vsoni Dec 20 '17 at 12:30
  • I tried to implement it under the modules folder, and it's own module.xml. There is no cigar yet, but a whole lot of new error messages I need to sort through. It might take a while, but I'll get back soon. Anyways, thanks for this answer. I feel like it put me on the right track to solve my problem, so I'm optimistic. – jumps4fun Dec 20 '17 at 12:54
  • I get a ClassNotFoundException (see updated question for details) – jumps4fun Dec 20 '17 at 13:02
  • Ok, I made it work. I read a bit more about modules, but found that the reason I couldn't get it to work right away, was some typos I made. Your solution works perfectly. Thank you very much! – jumps4fun Dec 20 '17 at 14:22