无法将mysql驱动程序添加到jboss [英] Can't add mysql driver to jboss
问题描述
好吧,这让我发疯.尤其是因为那里已经有许多类似的问题.但是没有答案适合我.
Ok this is driving me crazy. Especially because there are already many similar questions out there. But no answer works for me.
我在Windows 7机器上有jboss 7.1.1(通常从eclipse运行),并希望使用mysql.
I have jboss 7.1.1 on my windows 7 machine (running it from eclipse normally) and want to use mysql.
我做了以下事情:
1个创建的目录jboss-as-7.1.1.Final\modules\com\mysql\main
那里有2个文件:module.xml
和mysql-connector-java-5.1.26-bin.jar
(从mysql官方网站下载)
2 Files there: module.xml
and mysql-connector-java-5.1.26-bin.jar
(downloaded from official mysql site)
3 module.xml
的内容:
<?xml version="1.0" encoding="UTF-8"?>
<modulexmlns="urn:jboss:module:1.0" name="com.mysql">
<resourxces>
<resource-rootpath="mysql-connector-java-5.1.26-bin.jar"/>
</resources>
<dependencies>
<modulename="javax.api"/>
</dependencies>
</module>
来自jboss-as-7.1.1.Final\standalone\configuration\standalone.xml
的4个相关部分:
<datasource jndi-name="java:jboss/datasources/mysqlDS" pool-name="mysqlDS" enabled="true" jta="true" use-ccm="true" use-java-context="true">
<connection-url>jdbc:mysql://192.168.1.1:3306/eAuftrag</connection-url>
<driver>com.mysql</driver>
<security>
<user-name>root</user-name>
<password>fffff</password>
</security>
<timeout>
<idle-timeout-minutes>0</idle-timeout-minutes>
<query-timeout>600</query-timeout>
</timeout>
<statement>
<prepared-statement-cache-size>100</prepared-statement-cache-size>
<share-prepared-statements>true</share-prepared-statements>
</statement>
</datasource>
和:
<driver name="com.mysql" module="com.mysql" />
每次我启动jboss服务器时,都会看到以下消息:
Everytime I start the jboss server I see this message:
service jboss.jdbc-driver.com_mysql (missing) dependents: [service jboss.data-source.java:jboss/datasources/mysqlDS]
当我进入管理控制台并查看数据源时,mysqlDS在那里列出,但是当我单击它时我得到了错误(抱歉,无法在此处选择文本,因此图像如下):
And when I go to the managment-console and look at datasources, the mysqlDS is listed there, but when I click on it I get the error (sorry can't select the text there, so here comes the image):
推荐答案
因此,我可以再次向我的愚蠢致敬.
除了在module.xml
文件中有错别字外,我所做的一切都没错.
请注意,在上面的代码中,某些单词之间没有空格(")-不知何故它们迷路了.
但是更糟糕的是,显然这些模块文件没有被jboss验证,这就是为什么我从未意识到这一点.无论如何,这里是没有错别字的正确配置...
So once more I can pay tribute to my stupidity.
I did everything right except I had typos in my module.xml
file.
Notice that in the code above are no blanks (" ") between some words - somehow they got lost.
But what's even worse is that apparantly these module-files are not validated by jboss, that's why I never realized it. Anyway here's the correct config without the typos...
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="com.mysql">
<resources>
<resource-root path="mysql-connector-java-5.1.26-bin.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
</dependencies>
</module>
这篇关于无法将mysql驱动程序添加到jboss的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!