简体   繁体   English

JBoss EAP 6.1+上的JDBC模块

[英]JDBC module on JBoss EAP 6.1+

I'm trying to connecto to an mysql database in my JSF aplication, but when i run ti on my server (I'm using JBoss EAP 6.1+) i get the following error: 我正在尝试在JSF应用程序中连接到mysql数据库,但是当我在服务器上运行ti时(我正在使用JBoss EAP 6.1+),出现以下错误:

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver from [Module "deployment.e-r.war:main" from Service Module Loader]

I know that i have to add mysql connector to the server (I have downloaded mysql-connector-java-5.1.28-bin) an added it as an external JAR to my project, only to find out I must add it to the JBoss server. 我知道我必须将mysql连接器添加到服务器(我已经下载了mysql-connector-java-5.1.28-bin)并将其作为外部JAR添加到我的项目中,才发现我必须将其添加到JBoss服务器。 All the tutorials i have found are for an AS 7 server and don't seem to work for me. 我发现的所有教程都是针对AS 7服务器的,似乎对我不起作用。 Could I please get step by step instructions on how to add mysql-connector-java-5.1.28-bin to JBoss 6.1+ 我可以逐步说明如何将mysql-connector-java-5.1.28-bin添加到JBoss 6.1+

Thanks 谢谢

(A) Deploy the mysql driver jar from your JBoss console: (A)从JBoss控制台部署mysql驱动程序jar:
1) Browse the console page localhost:9990/console. 1)浏览控制台页面localhost:9990 / console。
[your port can be different based on your configuration] [您的端口可以根据您的配置而有所不同]
2) Deploy the driver jar, and enable deployment. 2)部署驱动程序jar,并启用部署。

(B) If this doesn't work for you, then alternately you have to manually add the jar to your JBOSS_HOME/modules/ directory. (B)如果这对您不起作用,那么您必须将jar手动添加到JBOSS_HOME/modules/目录。 It will be: 这将是:

1) create directory under the modules directory as com/mysql/jdbc/main . 1)在modules目录下创建目录com/mysql/jdbc/main
2) place the driver jar inside the newly created directory. 2)将驱动程序jar放置在新创建的目录中。
3) also, create a file module.xml that will contains things like below: 3)另外,创建一个文件module.xml,其中将包含如下内容:

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="com.mysql.jdbc">
  <resources>
     <resource-root path="YOUR_mysql-connector-xxx_NAME.jar"/>
  </resources>
  <dependencies>
     <module name="javax.api"/>
  </dependencies>
</module>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM