1

I am following the documentation here for creating datasources in JBoss EAP 7.1

JBoss 7.1 doc

but it fails at the driver creation stage. I am just running a standalone application

I have seen the answers here

Answer 1

and here

Answer 2

but they don't help, at least after reading them I still don't know what the issue is. First I have added a module for oracle jdbc file adding an xml definition and jar file to module/com/oracle/jdbc/main - this works. I then try to add the driver using the cli and get an error. My command is

/subsystem=datasource/jdbc-driver=oracle:add(driver-name=oracle,driver-module-name=com.oracle.jdbc,driver-class-name=oracle.jdbc.driver.OracleDriver)

The error is

Failed to get the list of the operation properties: "WFLYCTL0030: No resource definition is registered for address [ ("subsystem" => "datasource"), ("jdbc-driver" => "oracle")

I also tried using the admin gui and get the following response

`Internal Server Error
{
    "outcome" => "failed",
    "failure-description" => {
        "WFLYCTL0412: Required services that are not installed:" => ["jboss.jdbc-driver.oracle"],
        "WFLYCTL0180: Services with missing/unavailable dependencies" => [
            "jboss.driver-demander.java:/jdbc/access is missing [jboss.jdbc-driver.oracle]",
            "org.wildfly.data-source.jdbc/access is missing [jboss.jdbc-driver.oracle]"
        ]
    },
    "rolled-back" => true
} `

I don't want to edit xml directly so would want to get one of these two approaches working. Any help appreciated!

Edit: Adding module xml

<module xmlns="urn:jboss:module:1.5" name="com.oracle.jdbc">
    <resources>
        <resource-root path="ojdbc6.jar"/>
    </resources>
    <dependencies>
        <module name="javax.api"/>
        <module name="javax.transaction.api"/>
    </dependencies>
</module>
user260495
  • 117
  • 2
  • 13
  • Where do you see the error? Could you also show your module.xml? – James R. Perkins Aug 31 '18 at 21:58
  • The error is in the jboss log. I start jboss with the standalone.bat file and the logs then go to standard out on that terminal. I added my module xmlfile to the initial question, the module loads ok though – user260495 Sep 03 '18 at 07:12
  • That module configuration looks correct. It looks like the driver can't be found though. Is the `oracle.jdbc.driver.OracleDriver` in the JAR? – James R. Perkins Sep 03 '18 at 23:47
  • Yes. Opened the jar with zip7. I have ojdbc6.jar\oracle\jdbc\driver\OracleDriver.class. So looks like it is there. Also tried using ojdbc7.jar but same result. – user260495 Sep 04 '18 at 07:42

1 Answers1

1

Try creating the module via CLI directly,module.xml is different from what should be created.

[JBOSS_bin]$ ./jboss-cli.sh 
You are disconnected at the moment. Type 'connect' to connect to the server or 'help' for the list of supported commands.
[disconnected /] module add --name=com.oracle --resources=/home/jdbc_test/ojdbc6-11.2.0.3.jar  --dependencies=javax.api,javax.transaction.api
[disconnected /] connect
[standalone@localhost:9990 /] /subsystem=datasources/jdbc-driver=oracle:add(driver-name=oracle,driver-module-name=com.oracle)
    {"outcome" => "success"}
[standalone@localhost:9990 /]
meskobalazs
  • 15,741
  • 2
  • 40
  • 63
Sweta Patra
  • 341
  • 1
  • 4
  • Get same error. I successfully added the module using the cli like you showed and then tried to register the datasource via cli, the error I get is `/subsystem=datasource/jdbc-driver=oracle:add(driver-name=oracle,driver-module-name=com.oracle,driver-class-name=oracle.jdbc.driver.OracleDriver)` Failed to get the list of the operation properties: "WFLYCTL0030: No resource definition is registered for address [ ("subsystem" => "datasource"), ("jdbc-driver" => "oracle") ]" – user260495 Sep 12 '18 at 15:07
  • Replace your module.xml with below data as it is: And add oracle driver it will definitely work – Sweta Patra Sep 17 '18 at 06:26
  • Copied your xml, only difference now is the version of the jar. I now have I then type the folloing in the cli `/subsystem=datasource/jdbc-driver=oracle:add(driver-name=oracle,driver-module-name=com.oracle.jdbc,driver-class-name=oracle.jdbc.driver.OracleDriver)` and get the same error – user260495 Sep 17 '18 at 11:21
  • I understand that you replaced the xml content,but did you create the proper folder structure?Did you try adding the module via CLI? – Sweta Patra Sep 18 '18 at 06:32
  • The module is in modules/com/oracle/main. As detailed in my response I can add the module mannually or via CLI, that works. When I try to add the datasource via CLI it fails, I get the same error that I have shown in my initial post. Thanks. – user260495 Sep 18 '18 at 08:26
  • Try creating the module via CLI and then add driver manually in xml .Does that work?Add the driver name and driver-module-name in the driver section in xml and check. – Sweta Patra Sep 18 '18 at 09:47
  • That worked. I manually added the line to my standalone.xml I could then add the Oracle datasource. Any idea what could have went wrong when using the CLI to add the driver? – user260495 Sep 21 '18 at 14:45
  • I think the driver-class name parameter was causing the issue. – Sweta Patra Sep 24 '18 at 03:52
  • Do you know why? – user260495 Sep 24 '18 at 14:17
  • I can't say for sure,but it is not required to add the class-name parameter explicitly,there might be some issue with the class's compatibility – Sweta Patra Sep 25 '18 at 11:50
  • Don't mean to be a stickler but the question was about getting it working without editing xml which I am still unable to do and can't find any reason on how to do it. I am grateful for your help to get around the problem but still doesn't answer the core of the question. Thanks – user260495 Sep 26 '18 at 09:33
  • I am unable to reproduce the issue you are facing,thus unable to resolve it for you,please try the updated answer once more and let me know – Sweta Patra Sep 28 '18 at 05:12