我有以下数据源,我们使用的是oracle jdbc驱动程序,ojdbc6.jar:
<?xml version="1.0" encoding="UTF-8"?>
<datasources xmlns="http://www.jboss.org/ironjacamar/schema">
<datasource jndi-name="java:jboss/datasources/hubAdminDS" enabled="true"
use-java-context="true" pool-name="hubAdmin" jta="false">
<connection-url>jdbc:oracle:thin:@10.0.153.177:1521:XE</connection-url>
<driver>ojdbc6.jar</driver>
<pool>
<min-pool-size>5</min-pool-size>
<max-pool-size>10</max-pool-size>
<prefill>true</prefill>
</pool>
<security>
<user-name>HUBDBLOCAL</user-name>
<password>HUBDBLOCAL</password>
</security>
</datasource>
<datasource jndi-name="java:jboss/datasources/TASK_DB" enabled="true"
use-java-context="true" pool-name="TASK_DB" spy="true" use-ccm="true">
<connection-url>jdbc:oracle:thin:@10.0.153.177:1521:XE</connection-url>
<driver>ojdbc6.jar</driver>
<pool>
<min-pool-size>10</min-pool-size>
<max-pool-size>20</max-pool-size>
<prefill>true</prefill>
</pool>
<security>
<user-name>HUBDBLOCAL</user-name>
<password>HUBDBLOCAL</password>
</security>
</datasource>
<datasource jndi-name="java:jboss/datasources/SAFE" enabled="true"
use-java-context="true" pool-name="SAFE" jta="false">
<connection-url>jdbc:oracle:thin:@10.0.153.177:1521:XE</connection-url>
<driver>ojdbc6.jar</driver>
<pool>
<min-pool-size>3</min-pool-size>
<max-pool-size>4</max-pool-size>
<prefill>true</prefill>
</pool>
<security>
<user-name>HUBDBLOCAL</user-name>
<password>HUBDBLOCAL</password>
</security>
</datasource>
<datasource jndi-name="java:jboss/datasources/JDBC_DB" enabled="true"
use-java-context="false" pool-name="JDBC_DB" jta="false">
<connection-url>jdbc:oracle:thin:@10.0.153.177:1521:XE</connection-url>
<driver>ojdbc6.jar</driver>
<pool>
<min-pool-size>5</min-pool-size>
<max-pool-size>10</max-pool-size>
<prefill>true</prefill>
</pool>
<security>
<user-name>HUBDBLOCAL</user-name>
<password>HUBDBLOCAL</password>
</security>
</datasource>
<datasource jndi-name="java:jboss/datasources/MAIL_SENDER_DB"
enabled="true" use-java-context="true" pool-name="MAIL_SENDER_DB"
jta="false">
<connection-url>jdbc:oracle:thin:@10.0.153.177:1521:XE</connection-url>
<driver>ojdbc6.jar</driver>
<pool>
<min-pool-size>3</min-pool-size>
<max-pool-size>4</max-pool-size>
<prefill>true</prefill>
</pool>
<security>
<user-name>HUBDBLOCAL</user-name>
<password>HUBDBLOCAL</password>
</security>
</datasource>
<datasource jndi-name="java:jboss/datasources/HELPDESK" enabled="true"
use-java-context="true" pool-name="HELPDESK" jta="false">
<connection-url>jdbc:oracle:thin:@10.0.153.177:1521:XE</connection-url>
<driver>ojdbc6.jar</driver>
<pool>
<min-pool-size>10</min-pool-size>
<max-pool-size>20</max-pool-size>
<prefill>true</prefill>
</pool>
<security>
<user-name>HUBDBLOCAL</user-name>
<password>HUBDBLOCAL</password>
</security>
</datasource>
</datasources>
部署应用程序时,出现以下错误:
15:44:40,915 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 2)
JBAS014774: Service status report
JBAS014775: New missing/unsatisfied dependencies:
service jboss.naming.context.java.jboss.datasources.JDBC_DB (missing) dependents: [service jboss.naming.context.java.module.bpm.bpm.env."com.hds.hub.api.processes.impl.UserServicesEJB".dataSource, service jboss.naming.context.java.module.bpm.bpm.env."com.hds.hub.iArchive.impl.FileArchiveServiceEJB".dataSource]
service jboss.naming.context.java.jboss.datasources.MAIL_SENDER_DB (missing) dependents: [service jboss.naming.context.java.module.bpm.bpm.env.jdbc.MAIL_SENDER_DB]
service jboss.naming.context.java.jboss.datasources.TASK_DB (missing) dependents: [service jboss.naming.context.java.module.bpm.bpm.env.jdbc.TASK_DB, service jboss.persistenceunit."bpm.war#org.jbpm.persistence.jpa"]
service jboss.naming.context.java.jboss.datasources.hubAdminDS (missing) dependents: [service jboss.naming.context.java.module.bpm.bpm.env.jdbc.HUB_ADMIN_DB]
15:44:40,921 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.bpm.bpm.env.\"com.hds.hub.iArchive.impl.FileArchiveServiceEJB\".dataSourcejboss.naming.context.java.jboss.datasources.JDBC_DBMissing[jboss.naming.context.java.module.bpm.bpm.env.\"com.hds.hub.iArchive.impl.FileArchiveServiceEJB\".dataSourcejboss.naming.context.java.jboss.datasources.JDBC_DB]","jboss.naming.context.java.module.bpm.bpm.env.jdbc.HUB_ADMIN_DBjboss.naming.context.java.jboss.datasources.hubAdminDSMissing[jboss.naming.context.java.module.bpm.bpm.env.jdbc.HUB_ADMIN_DBjboss.naming.context.java.jboss.datasources.hubAdminDS]","jboss.naming.context.java.module.bpm.bpm.env.jdbc.TASK_DBjboss.naming.context.java.jboss.datasources.TASK_DBMissing[jboss.naming.context.java.module.bpm.bpm.env.jdbc.TASK_DBjboss.naming.context.java.jboss.datasources.TASK_DB]","jboss.naming.context.java.module.bpm.bpm.env.\"com.hds.hub.api.processes.impl.UserServicesEJB\".dataSourcejboss.naming.context.java.jboss.datasources.JDBC_DBMissing[jboss.naming.context.java.module.bpm.bpm.env.\"com.hds.hub.api.processes.impl.UserServicesEJB\".dataSourcejboss.naming.context.java.jboss.datasources.JDBC_DB]","jboss.naming.context.java.module.bpm.bpm.env.jdbc.MAIL_SENDER_DBjboss.naming.context.java.jboss.datasources.MAIL_SENDER_DBMissing[jboss.naming.context.java.module.bpm.bpm.env.jdbc.MAIL_SENDER_DBjboss.naming.context.java.jboss.datasources.MAIL_SENDER_DB]","jboss.persistenceunit.\"bpm.war#org.jbpm.persistence.jpa\"jboss.naming.context.java.jboss.datasources.TASK_DBMissing[jboss.persistenceunit.\"bpm.war#org.jbpm.persistence.jpa\"jboss.naming.context.java.jboss.datasources.TASK_DB]"]}}}
JDBC_DB,MAIL_SENDER,TASK_DB和hubAdminDS在数据源中定义
当我连接到远程服务器时没有错误,但是当我连接到本地服务器时,我有上述错误。
任何人都可以解释,为什么我会犯错误?我怎么纠正它?
答案 0 :(得分:0)
看起来您的数据源(“java:jboss / datasources / JDBC_DB”)未在JBoss服务器中正确部署,请按照以下步骤完成此操作:
安装JDBC驱动程序作为核心模块:
1.在$ JBOSS_HOME / modules下创建一个目录。在这个例子中:“$ JBOSS_HOME / modules / com / oracle / jdbc / main”。
2.在此目录中放置JDBC驱动程序jar(ojdbc6.jar)
3.创建模块配置文件module.xml:
<module xmlns="urn:jboss:module:1.1" name="com.oracle.jdbc">
<resources>
<resource-root path="ojdbc6.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
请注意,jdbc驱动程序jar必须包含指定jdbc驱动程序的META-INF / services / java.sql.Driver文本文件,否则用于加载驱动程序的Java服务提供程序机制将不起作用。从主要/普通供应商开始,只有Informix没有开箱即用的功能。
4.在standalone.xml或domain.xml中配置数据源设置。
您现在可以编辑独立( - )。xml或域( - )。xml以配置引用此模块的数据源:
<subsystem ...>
<datasources>
<datasource jndi-name="java:jboss/datasources/OracleDS" pool-name="OracleDS" enabled="true" use-java-context="true">
<connection-url>jdbc:oracle:thin:@myhostname:1521:oracle</connection-url>
<driver>oracle</driver>
<pool>
<min-pool-size>10</min-pool-size>
<max-pool-size>20</max-pool-size>
<prefill>true</prefill>
</pool>
<security>
<user-name>myuser</user-name>
<password>mypass</password>
</security>
<validation>
<validate-on-match>true</validate-on-match>
<valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker"></valid-connection-checker>
<stale-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker"></stale-connection-checker>
<exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter"></exception-sorter>
</validation>
</datasource>
<drivers>
<driver name="oracle" module="com.oracle.jdbc">
<xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
</subsystem>
或xa-datasource:
<subsystem ...>
<datasources>
<xa-datasource jndi-name="java:/XAOracleDS" pool-name="XAOracleDS">
<driver>oracle</driver>
<xa-datasource-property name="URL">jdbc:oracle:thin:@myhostname:1521:oracle</xa-datasource-property>
<security>
<user-name>admin</user-name>
<password>admin</password>
</security>
<xa-pool>
<is-same-rm-override>false</is-same-rm-override>
<no-tx-separate-pools />
</xa-pool>
<validation>
<validate-on-match>true</validate-on-match>
<valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleValidConnectionChecker"></valid-connection-checker>
<stale-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleStaleConnectionChecker"></stale-connection-checker>
<exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.oracle.OracleExceptionSorter"></exception-sorter>
</validation>
</xa-datasource>
<drivers>
<driver name="oracle" module="com.oracle">
<xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
</subsystem>
将DB-Driver设置为模块后,服务器日志如下所示:
12:10:47,381 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) JBAS010400: Bound data source [java:jboss/datasources/OracleDS]
....
答案 1 :(得分:0)
我需要允许多个连接到我的数据库,这受到以下命令的限制:
sqlplus / as sysdba
ALTER SYSTEM SET PROCESSES= 300 SCOPE=SPFILE;
SHUT IMMEDIATE;
STARTUP;