Unable to instantiate driver SQLServerDriver in Wildfly 10 - java

I am having the following error:
15:02:34,434 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 33) WFLYCTL0013: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("jdbc-driver" => "sqlserver")
]) - failure description: "WFLYJCA0034: Unable to instantiate driver class \"com.microsoft.jdbc.sqlserver.SQLServerDriver\". See log (WARN) for more details"
The module.xml in $JBOSS_HOME\modules\com\microsoft\sqlserver\main:
<module xmlns="urn:jboss:module:1.1" name="com.microsoft.sqlserver" slot="main">
<resources>
<resource-root path="sqljdbc42.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
This is the content of sqljdbc42.jar
And the driver definition in standalone.xml
<driver name="sqlserver" module="com.microsoft.sqlserver">
<driver-class>com.microsoft.jdbc.sqlserver.SQLServerDriver</driver-class>
</driver>
Please help me find out what I'm not seeing
UPDATE:
For historic context: the "com.microsoft.jdbc.sqlserver" package is
from the old SQL Server 2000 JDBC driver, they changed it somewhere
around 2005 to "com.microsoft.sqlserver.jdbc" by Mark Rotteveel

From what i can see from the jar content the class package in your driver is wrong, try with
<driver name="sqlserver" module="com.microsoft.sqlserver">
<driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-class>
</driver>

Related

Apache Ignite datasource in WildFly

I am trying to setup Apache Ignite Cluster with WildFly 10.1.0, so I'm able to use JPA with Ignite. I have issues configuring the JDBC driver.
What I have done so far:
standalone-full.xml
<datasource jta="false" jndi-name="java:jboss/datasources/IgniteDS" pool-name="IgniteDS" enabled="true">
<connection-url>jdbc:ignite:thin://172.X.X.146,172.X.X.147,172.X.X.148</connection-url>
<driver>ignite</driver>
</datasource>
Later in the same file I set-up the driver
<driver name="ignite" module="org.ignite.jdbc">
<driver-class>org.apache.ignite.IgniteJdbcThinDriver</driver-class>
</driver>
Ignite Module
In {WILDFLY_HOME}/modules I created following structure
module.xml
<?xml version="1.0" ?>
<module xmlns="urn:jboss:module:1.1" name="org.ignite.jdbc">
<resources>
<resource-root path="ignite-core-2.6.0.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
Unfortunately I get following error in WildFly log when I start the server
11:43:31,253 ERROR [org.jboss.as.controller.management-operation]
(Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address:
([
("subsystem" => "datasources"),
("data-source" => "IgniteDS")
]) - failure description: {
"WFLYCTL0412: Required services that are not installed:" =>
["jboss.jdbc-driver.ignite"],
"WFLYCTL0180: Services with missing/unavailable dependencies" => [
"jboss.driver-demander.java:jboss/datasources/IgniteDS is missing [jboss.jdbc-driver.ignite]",
"org.wildfly.data-source.IgniteDS is missing [jboss.jdbc-driver.ignite]"
]
}
11:43:31,263 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address:
([
("subsystem" => "datasources"),
("data-source" => "IgniteDS")
]) - failure description: {
"WFLYCTL0412: Required services that are not installed:" => [
"jboss.jdbc-driver.ignite",
"jboss.jdbc-driver.ignite"
],
"WFLYCTL0180: Services with missing/unavailable dependencies" => [
"jboss.driver-demander.java:jboss/datasources/IgniteDS is missing [jboss.jdbc-driver.ignite]",
"org.wildfly.data-source.IgniteDS is missing [jboss.jdbc-driver.ignite]",
"org.wildfly.data-source.IgniteDS is missing [jboss.jdbc-driver.ignite]"
]
}
Your help is highly appreciated
Beware you have 2 kinds or drivers, the regular one (driver-class), or the XA one (xa-datasource):
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
<driver name="postgresql" module="org.postgresql">
<driver-class>org.postgresql.Driver</driver-class>
</driver>
I've sometimes seen conf where the driver class name is...repeated inside the datasource declaration (but do not ask me why ;-)):
<datasource jta="false" jndi-name="java:jboss/datasources/sqlDataSource" pool-name="sqlDataSource" enabled="true" use-ccm="false">
<connection-url>... </connection-url>
<driver-class>com.sybase.jdbc4.jdbc.SybDriver</driver-class>
<driver>sybase</driver>
Ultimately, give a try with jta="false" (on datasource level) in case it makes some differences (I doubt but)
May be not the root cause, but the namespace of your "module.xml" file is not correct (urn should be of version 1.3 for WF 10):
<module xmlns="urn:jboss:module:1.3" name="org.ignite.jdbc">
This may prevent the module from being loaded ?
The problem was in the folder structure I've used in {WILDFLY_HOME}/modules.
My path is org/ignite/main which means the name in module.xml should be changed from name="org.ignite.jdbc" to name="org.ignite"
Same change applies in driver tag in standalone-full.xml

Error during artifact deployment

I am trying to deploy an application in Wildfly 10 but I get the following error:
/usr/lib/jvm/jdk1.8.0_121/bin/java -classpath /opt/jetbrains/idea-IU-163.13906.18/lib/idea_rt.jar:/opt/jetbrains/idea-IU-163.13906.18/lib/util.jar -Dfile.encoding=UTF-8 com.intellij.rt.execution.CommandLineWrapper /tmp/classpath com.intellij.javaee.oss.process.JavaeeProcess 42364 com.intellij.javaee.oss.jboss.agent.JBoss71Agent
[2017-10-05 12:50:04,818] Artifact Gradle : com.solveralynx.wildrunner.api : skin.war: Server is not connected. Deploy is not available.
[2017-10-05 12:50:04,818] Artifact Gradle : com.solveralynx.wildrunner.api : drcs-development.war: Server is not connected. Deploy is not available.
Oct 05, 2017 12:50:04 PM org.xnio.Xnio <clinit>
INFO: XNIO version 3.4.0.Final
Oct 05, 2017 12:50:04 PM org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.4.0.Final
Oct 05, 2017 12:50:04 PM org.jboss.remoting3.EndpointImpl <clinit>
INFO: JBoss Remoting version 4.0.21.Final
[2017-10-05 12:50:05,133] Artifact Gradle : com.solveralynx.wildrunner.api : skin.war: Artifact is being deployed, please wait...
[2017-10-05 12:50:05,133] Artifact Gradle : com.solveralynx.wildrunner.api : drcs-development.war: Artifact is being deployed, please wait...
Connected to server
Connected to the target VM, address: 'localhost:44287', transport: 'socket'
[2017-10-05 12:50:08,064] Artifact Gradle : com.solveralynx.wildrunner.api : skin.war: Artifact is deployed successfully
[2017-10-05 12:50:08,064] Artifact Gradle : com.solveralynx.wildrunner.api : skin.war: Deploy took 2,931 milliseconds
[2017-10-05 12:50:15,349] Artifact Gradle : com.solveralynx.wildrunner.api : drcs-development.war: Error during artifact deployment. See server log for details.
[2017-10-05 12:50:15,350] Artifact Gradle : com.solveralynx.wildrunner.api : drcs-development.war: java.lang.Exception: {"WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"drcs-development.war\".POST_MODULE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"drcs-development.war\".POST_MODULE: WFLYSRV0153: Failed to process phase POST_MODULE of deployment \"drcs-development.war\"
Caused by: java.lang.NoClassDefFoundError: Failed to link com/solveralynx/wildrunner_api/drcs/business_impl/ejb/jobs/GBMeteringDataJobEJB (Module \"deployment.drcs-development.war:main\" from Service Module Loader): com/solveralynx/wildrunner_api/drcs/business_api/ejb/jobs/MeteringDataJobLocal"},"WFLYCTL0412: Required services that are not installed:" => ["jboss.deployment.unit.\"drcs-development.war\".POST_MODULE"],"WFLYCTL0180: Services with missing/unavailable dependencies" => undefined}
My wildfly deployment structure looks like this:
<jboss-deployment-structure>
<!-- Make sub deployments isolated by default, so they cannot see each others classes without a Class-Path entry -->
<ear-subdeployments-isolated>false</ear-subdeployments-isolated>
<!-- This corresponds to the top level deployment. For a war this is the war's module, for an ear -->
<!-- This is the top level ear module, which contains all the classes in the EAR's lib folder -->
<deployment>
<!-- Exclusions allow you to prevent the server from automatically adding some dependencies -->
<exclusions>
<!--<module name="com.google.guava" slot="main"/>-->
</exclusions>
<!-- This allows you to define additional dependencies, it is the same as using the Dependencies: manifest attribute -->
<dependencies>
<module name="javax.faces.api" slot="main" export="true"/>
<module name="com.sun.jsf-impl" slot="main" export="true"/>
<module name="com.google.gwt.user" slot="main" export="true"/>
<module name="com.google.gwt.servlet" slot="main" export="true"/>
<module name="org.dom4j" slot="main" export="true"/>
<module name="org.apache.xalan" slot="main"/>
</dependencies>
<!-- These add additional classes to the module. In this case it is the same as including the jar in the EAR's lib directory -->
<resources>
</resources>
</deployment>
<sub-deployment name="web.war">
<exclusions>
<module name="javax.faces.api" slot="1.2"/>
<module name="com.sun.jsf-impl" slot="1.2"/>
</exclusions>
<dependencies>
<module name="javax.faces.api" slot="main"/>
<module name="com.sun.jsf-impl" slot="main"/>
<module name="com.google.gwt.user" slot="main"/>
<module name="com.google.gwt.servlet" slot="main"/>
<module name="org.dom4j" slot="main"/>
<module name="org.jboss.xnio" slot="main"/>
</dependencies>
</sub-deployment>
<sub-deployment name="business-impl.jar">
<dependencies>
<module name="org.jboss.xnio" slot="main"/>
<module name="com.microsoft.sqlserver" slot="main"/>
</dependencies>
</sub-deployment>
</jboss-deployment-structure>
I don't know what causes this error to happen. I'm thinking that I have to change POST_MODULE phase into something different.
Thank you in advance.

Wildfly Deployment Fails at missing "jboss.deployment.unit"

Currently I try, for my first time, to use Wildfly with MongoDB and Hibernate OGM. When I deploy my Project to Wildfly, the following error occurs:
"{ \"WFLYCTL0080: Failed services\" => {\"jboss.deployment.unit.\\\"{MYAPP}.war\\\".STRUCTURE\" => \"org.jboss.msc.service.StartException in service jboss.deployment.unit.\\\"{MYAPP}.war\\\".STRUCTURE: WFLYSRV0153: Failed to process phase STRUCTURE of deployment \\\"{MYAPP}.war\\\"
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYSRV0168: Error loading jboss-deployment-structure.xml from {MYUSERDIR}/wildfly10/standalone/deployments/{MYAPP}.war/WEB-INF/jboss-deployment-structure.xml
Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[2,1]
Message: Unexpected element '{http://www.jboss.com/xml/ns/javaee}jboss-web'\"},
\"WFLYCTL0412: Required services that are not installed:\" => [\"jboss.deployment.unit.\\\"{MYAPP}.war\\\".STRUCTURE\"],
\"WFLYCTL0180: Services with missing/unavailable dependencies\" => undefined }"
My jboss-deployment-structure.xml looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="org.hibernate" slot="ogm" services="import" />
<module name="org.hibernate.ogm.mongodb" slot="main" services="import" />
</dependencies>
</deployment>
</jboss-deployment-structure>
This Jboss Document mentions to add Modules (which I did) to the Wildfly Folder and add an Entry to the Manifest.mf File which I created manually.
Does anybody have an idea, what to try next?
I would also appreciate a Recommendation for a good Tutorial.
Sidenotes:
NetBeans 8.2
Wildfly 10
MacOS
MongoDB on Ubuntu 16.04 VM
I googled a lot
The Tutorial I basically used

Fail loading driver (SQL Server, JBoss, Maven)

I'm trying to load JBoss Server with SQL Server configuration in standalone.xml and -ds.xml, and when I start the server it returns the following error:
15:21:38,092 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 27) JBAS014613: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("jdbc-driver" => "sqlserver")
]) - failure description: "JBAS010441: Failed to load module for driver [com.microsoft.sqlserver]"
JBAS014775: New missing/unsatisfied dependencies:
service jboss.jdbc-driver.sqlserver (missing) dependents: [service jboss.data-source.java:jboss/datasources/pontualpro-DS]
My pom.xml configuration:
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
</dependency>
My -ds.xml configuration:
<datasource jndi-name="java:jboss/datasources/pontualpro-DS" pool-name="pontualpro" enabled="true" use-java-context="true">
<connection-url>jdbc:sqlserver://127.0.0.1:667</connection-url>
<driver>sqlserver</driver>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
</datasource>
My standalone.xml configuration:
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
<driver name="sqlserver" module="com.microsoft.sqlserver">
<xa-datasource-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</xa-datasource-class>
</driver>
</drivers>
The sqljdbc jar file is already in repository file
.m2>repository>com>microsoft>sqlserver>sqljdbc4>4.0>sqljdbc4-4.0.jar
If someone can help me I will be greatfull.
Make sure that jar file is in server directory, usually it's something like
jboss/server/production/lib or similar path.
Jboss will not use jar from your build. It MUST be in it's lib path
I'm not familiar with the jboss application server but my guess would be that an SQL driver must be provided by the appication server. I think the sqljdbc4-4.0.jar must be added to the "libs" of your application server.
The driver class you gave is not correct. You should give the full name
com.microsoft.sqlserver
see the reference as an example here: https://docs.jboss.org/jbossas/docs/Installation_And_Getting_Started_Guide/5/html/Using_other_Databases.html#Using_other_Databases-Using_MySQL_as_the_Default_DataSource

What's the module name if deploy jdbc in Jboss AS 7 as web application

From this post start from Jboss AS7 the jdbc driver is able to deploy as regular application. However a question is, how other application is able to refer to this jdbc jar?
here is what I tried but it doesn't work
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
......
<deployment>
<dependencies>
<module name="ojdbc6.jar" />
</dependencies>
</deployment>
.....
</jboss-deployment-structure>
UPDATE
When I deploy ojdbc.jar there is a section of log from console:
10:56:20,416 INFO [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015876: Starting deployment of "ojdbc6.jar"
10:56:21,487 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-2) JBAS010403: Deploying JDBC-compliant driver class oracle.jdbc.OracleDriver (version 11.2)
10:56:21,489 INFO [org.jboss.as.osgi] (MSC service thread 1-7) JBAS011907: Register module: Module "deployment.ojdbc6.jar:main" from Service Module Loader
10:56:21,499 INFO [org.jboss.as.server] (HttpManagementService-threads - 6) JBAS018559: Deployed "ojdbc6.jar"
Per the log jdbc module is with name deployment.ojdbc6.jar:main, but after I update jboss-deployment-structure.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
......
<deployment>
<dependencies>
<module name="deployment.ojdbc6.jar:main" />
</dependencies>
</deployment>
.....
</jboss-deployment-structure>
it still does not work. with following message:
10:59:34,448 INFO [org.jboss.as.server] (HttpManagementService-threads - 7) JBAS015870: Deploy of deployment "MyApp.war" was rolled back with failure message {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.deployment.unit.\"MyApp.war.war\".POST_MODULE Missing[JBAS014861: <one or more transitive dependencies>]","jboss.module.service.\"deployment.MyApp.war.war\".main Missing[jboss.module.spec.service.\"deployment.ojdbc6.jar:main\".main]"]}
10:59:35,198 INFO [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015877: Stopped deployment MyApp.war.war in 749ms
You can reference the jars from other deployments in this way:
<module name="deployment.YourEarOrWar.YourJar.jar" />
Where deployment is the general prefix for a reference to your deployed apps.
However, for a lib like a jdbc-driver I recommend to put it in the module-folder of the JBoss
<module xmlns="urn:jboss:module:1.1" name="driver.ojdbc">
<resources>
<resource-root path="ojdbc6.jar"/>
</resources>
</module>
and reference it then
<module name="driver.ojdbc"/>
See also
https://community.jboss.org/thread/169894
and
http://www.mastertheboss.com/jboss-as-7/how-to-install-a-module-on-jboss-as-7

Categories

Resources