I've configured JBOSS datasource with a new module:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="com.oracle.jdbc">
<resources>
<resource-root path="ojdbc6.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
</dependencies>
</module>
in the folder %JBOSS_HOME%\modules\com\oracle\jdbc\main
I put in the "main" folder also the driver itself: ojdbc6.jar
Then i configure a datasource with driver:
<datasource jndi-name="java:/jdbc/MyPool" pool-name="MyPool" enabled="true" jta="true" use-java-context="true" use-ccm="true">
<connection-url>jdbc:oracle:thin:#my.server.com:1521:mydbname</connection-url>
<driver>oracle</driver>
<security>
<user-name>myusername</user-name>
<password>mypassword</password>
</security>
</datasource>
<drivers>
<driver name="oracle" module="com.oracle.jdbc"><xa-datasource-class>oracle.jdbc.OracleDriver</xa-datasource-class></driver>
</drivers>
When I start the application server i receive the error:
New missing/unsatisfied dependencies:
service jboss.jdbc-driver.oracle (missing)
The configuration seems to be good to the documentation, may be there is problem with the version of JBOSS or Oracle Driver?
Thanks
Related
I have two EAR (ear01-0.0.1-SNAPSHOT.ear, ear02-0.0.1-SNAPSHOT.ear) applications and both of them are useing a common library (common-0.0.1-SNAPSHOT.jar). I decided to move out that common part and add it as module to a Wildfly 14 but even with a deployment descritor I get exception during the EAR deployment:
java.lang.NoClassDefFoundError: Failed to link ki/wildfly_deps/ejbs01/EchoBean01
I used this CLI to add the new module:
module add --name=ki.wildfly_deps.common --resources=common-0.0.1-SNAPSHOT.jar
and the JAR now is in
$JBOSS_HOME/modules/ki/wildfly_deps/common/main
1. QUESTION
This JAR shouldn't be in folder
$JBOSS_HOME/modules/system/layers/base/ki/wildfly_deps/common/main
beside the other modules?
After adding the module, the module.xml look like this:
<?xml version='1.0' encoding='UTF-8'?>
<module xmlns="urn:jboss:module:1.1" name="ki.wildfly_deps.common">
<resources>
<resource-root path="common-0.0.1-SNAPSHOT.jar"/>
</resources>
</module>
The jboss-deployment-structure.xml from each EAR declares a dependency on the above common library:
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<deployment>
<dependencies>
<module name="ki.wildfly_deps.common" />
</dependencies>
</deployment>
2. QUESTION
Should I specify the package what must be imported from the common module?
<jboss-deployment-structure
xmlns="urn:jboss:deployment-structure:1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<deployment>
<dependencies>
<module name="ki.wildfly_deps.common" //>
<imports>
<include path="META-INF**" />
<include path="ki.wildfly_deps.common**" />
</imports>
</module>
</dependencies>
</deployment>
I'm trying to install neo4j-jdbc-driver-3.3.1 as a module on Wildfly 11. I created the folders org/neo4j/driver/main and added the module.xml file as following:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.5" name="org.neo4j.driver">
<resources>
<resource-root path="neo4j-jdbc-driver-3.3.1.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
<module name="sun.jdk"/>
</dependencies>
</module>
I added the jar neo4j-jdbc-driver-3.3.1.jar in the same directory, but the module does not get deployed.
If I add the jar on the deployments folder it works, but I need the driver as a module.
Ia m using jboss 6eap .when i try to configure datasource for oracle DB i getting the below exception
JBAS014775: New missing/unsatisfied dependencies:
service jboss.jdbc-driver.oracle_jdbc_driver_OracleDriver (missing)
dependents: [service jboss.data-source.java:jboss/datasources/DefaultDS,
service jboss.driver-demander.java:jboss/datasources/DefaultDS]
config:
<module xmlns="urn:jboss:module:1.0" name="com.oracle.ojdbc6">
<resources>
<resource-root path="ojdbc6.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
Here is my standalone.xml
<datasources>
<datasource enabled="true" jndi-name="java:jboss/datasources/ExampleDS"
pool-name="ExampleDS" use-java-context="true">
<connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
<driver>h2</driver>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
</datasource>
<datasource enabled="true" jndi-name="java:jboss/datasources/DefaultDS" jta="true"
pool-name="DefaultDS_pool" use-ccm="true" use-java-context="true">
<connection-url>jdbc:oracle:thin:#10.236.190.54:1521</connection-url>
<driver>oracle.jdbc.driver.OracleDriver</driver>
<pool>
<prefill>false</prefill>
<use-strict-min>false</use-strict-min>
<flush-strategy>FailingConnectionOnly</flush-strategy>
</pool>
<security>
<user-name>*</user-name>
<password>*</password>
</security>
</datasource>
<drivers>
<driver module="com.h2database.h2" name="h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
<driver module="com.oracle.ojdbc6" name="ojdbc6">
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
I tried out even stackoverflow .it seems to be everything is fine.
I think following things need to be checked on your side.
Copy your downloaded jar to following defined location or create a dir structure if not present.
JBOSS_HOME/modules/com/mysql/main
You can find a very good tutorial here : How to
I have a maven web application in which I am using logback and JBoss EAP 6.1 as server. The problem is that when I deploy it on server, my logback.xml is ignored and logback's default configuration is used which prints on console instead of my log file. Logging works fine if I deploy my application on tomcat.
I have put logback.xml in src/main/resources.
Found similar question at - Logging Configuration in Logback + SL4J + JBoss EAP 6.0
and
Logback and Jboss 7 - don't work together?
but no use...
Forgot to share the solution earlier..here it is -
We need to add following lines in jboss-deployment-structure.xml
<exclusions>
<module name="org.apache.commons.logging" />
<module name="org.slf4j" />
<module name="org.slf4j.ext" />
<module name="org.slf4j.impl" />
<module name="org.apache.log4j" />
</exclusions>
So the entire file looks like -
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<!-- Exclusions allow you to prevent the server from automatically adding
some dependencies -->
<exclusions>
<module name="org.apache.commons.logging" />
<module name="org.slf4j" />
<module name="org.slf4j.ext" />
<module name="org.slf4j.impl" />
<module name="org.apache.log4j" />
</exclusions>
</deployment>
</jboss-deployment-structure>
If you have a maven project, you can put this file at -
<project>/webapp/META-INF/jboss-deployment-structure.xml
Now logging will work fine.
First, thanks to #popeye
Climbing on to what #popeye has well defined, here are my 2 cents
Location of 'jboss-deployment-structure.xml' : src/main/webapp/WEB-INF/jboss-deployment-structure.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<!-- Hey Server please don't add these dependencies. I don't need them.
I have mine in my application dependencies -->
<exclusions>
<module name="org.apache.commons.logging" />
<module name="org.slf4j" />
<module name="org.slf4j.ext" />
<module name="org.slf4j.impl" />
<module name="org.apache.log4j" />
</exclusions>
<dependencies>
<module name="com.oracle" />
<module name="org.jboss.ironjacamar.jdbcadapters" slot="main" />
</dependencies>
</deployment>
</jboss-deployment-structure>
Now, logback.xml is in action. yo!
why is this needed - <module name="com.oracle" /> ?
This is the name of module of driver you mentioned in JBOSS standalone.xml
<subsystem xmlns="urn:jboss:domain:datasources:1.1">
<datasources>
<datasource><!-- your configurations --></datasource>
<drivers>
<driver name="ojdbc6-11.2.0.4" module="com.oracle">
<xa-datasource-class>oracle.jdbc.OracleDriver</xa-datasource-class>
</driver>
</drivers>
</datasources>
</subsystem>
Note that this is for JBOSS server to Database communication.
[Even if you have ojdbc6-11.2.0.4.jar in your project/lib you need this configuration ]
How did you come up with this name 'com.oracle'? Is that a standard ?
No . This is the struture of folder I created on server
Look at this SO post here - Xmlparserv2 error while application deployed in jboss, Installing Oracle ojdbc module in JBoss for Java web application 'How to create a Oracle module in JBOSS'
Also note not to confuse this one with the dependency that you might add in your project pom.xml.
ie: this one
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.4</version>
<scope>provided</scope> <!-- to exclude from WEB-INF/lib -->
</dependency>
The above project dependency is needed for you to write the Java code, get it compiled,
and also during runtime, for your code to communicate to the driver.
why is this needed - <module name="org.jboss.ironjacamar.jdbcadapters" slot="main" /> ?
Otherwise you might get an error to get a jndi datasource set on JBoss in your Spring application.
So that's a dependency. Don't forget to add the jar as well in your pom.xml
<dependency>
<groupId>org.jboss.ironjacamar</groupId>
<artifactId>ironjacamar-jdbc</artifactId>
</dependency>
I am new to JBOSS and m stuck at basic deployment of app in JBOSS 7.1.1
I have created a webapp with persistent.xml as
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0"
xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="mydummy-jpa" transaction-type="RESOURCE_LOCAL">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<jta-data-source>java:jboss/datasources/mydummyexample</jta-data-source>
<class>com.nsn.caobusiness.selfcare.entity.DummyTable</class>
<properties>
<property name="jboss.as.jpa.providerModule" value="org.jboss.as.jpa.openjpa" />
<property name="openjpa.Log" value="DefaultLevel=WARN,SQL=TRACE" />
<property name="openjpa.jdbc.DBDictionary" value="mysql(UseClobs=true)"/>
</properties>
</persistence-unit>
</persistence>
Datasource in my standalone.xml looks like :
<datasource jndi-name="java:jboss/datasources/mydummyexample" pool-name="mydummyexample" enabled="true" use-java-context="true" use-ccm="true" jta="true">
<connection-url>jdbc:mysql://localhost:3306/worldonstreet</connection-url>
<driver>mysql</driver>
<security>
<user-name>root</user-name>
<password></password>
</security>
<statement>
<prepared-statement-cache-size>100</prepared-statement-cache-size>
<share-prepared-statements/>
</statement>
</datasource>
When i deploy the application, i get following exception :
23:48:06,656 INFO [org.jboss.as.jpa] (MSC service thread 1-5) JBAS011401: Read persistence.xml for mydummy-jpa
23:48:08,000 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC00001: Failed to start service jboss.deployment.unit."SpringDatabaseTransaction.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."SpringDatabaseTransaction.war".INSTALL: Failed to process phase INSTALL of deployment "SpringDatabaseTransaction.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_26]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_26]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_26]
**Caused by: javax.persistence.PersistenceException: JBAS011466:
PersistenceProvider
'org.apache.openjpa.persistence.PersistenceProviderImpl' not found**
at org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.lookupProvider(PersistenceUnitDeploymentProcessor.java:555)
at org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.deployPersistenceUnit(PersistenceUnitDeploymentProcessor.java:295)
at org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.addPuService(PersistenceUnitDeploymentProcessor.java:258)
at org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.handleWarDeployment(PersistenceUnitDeploymentProcessor.java:194)
at org.jboss.as.jpa.processor.PersistenceUnitDeploymentProcessor.deploy(PersistenceUnitDeploymentProcessor.java:118)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
I am stuck from entire day at this. Would appreciate any help from this forum.
Regards,
Legolas
I downloaded Apache Openjpa, extracted the jars, created a module in jboss under \JBOSS_HOME>\modules\org\apache\openjpa and changed my property in persistent.xml to
<property name="jboss.as.jpa.providerModule" value="org.apache.openjpa" />
module.xml looks like :
<module xmlns="urn:jboss:module:1.1" name="org.apache.openjpa">
<resources>
<resource-root path="openjpa-2.2.0.jar"/>
<resource-root path="serp-1.13.1.jar"/>
</resources>
<dependencies>
<module name="javax.persistence.api"/>
<module name="javax.transaction.api"/>
<module name="javax.validation.api"/>
<module name="org.apache.commons.lang"/>
<module name="org.apache.commons.collections"/>
<module name="org.apache.log4j"/>
</dependencies>
</module>
it finally worked. :)
Thanks #lurscher for ur comments. It motivated me to carry on.