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
Related
I'm running a WildFly10 Application Server. Now I noticed that as I changed the default encoding in the standalone.xml configuration file to utf-8, the change got erased as the server was rebooted.
Then I read up that I should use a CLI script. Now, how can I do that? What form of CLI script would add the attribute default-encoding="UTF-8" to the undertow subsystem as follows:
Here's the unmodified part of standalone.xml:
<subsystem xmlns="urn:jboss:domain:undertow:3.0">
<buffer-cache name="default"/>
<server name="default-server">
<http-listener name="default" socket-binding="http" redirect-socket="http"/>
<host name="default-host" alias="localhost">
<location name="/" handler="welcome-content"/>
<filter-ref name="server-header"/>
<filter-ref name="x-powered-by-header"/>
</host>
</server>
<servlet-container name="default">
<jsp-config/>
<websockets/>
</servlet-container>
<handlers>
<file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
</handlers>
<filters>
<response-header name="server-header" header-name="Server" header-value="WildFly/10"/>
<response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow/1"/>
</filters>
</subsystem>
And here it is modified, as I'd like it to be and remain in the standalone.xml:
<subsystem xmlns="urn:jboss:domain:undertow:3.0">
<buffer-cache name="default"/>
<server name="default-server">
<http-listener name="default" socket-binding="http" redirect-socket="https"/>
<host name="default-host" alias="localhost">
<location name="/" handler="welcome-content"/>
<filter-ref name="server-header"/>
<filter-ref name="x-powered-by-header"/>
</host>
</server>
<servlet-container name="default" default-encoding="UTF-8">
<jsp-config/>
<websockets/>
</servlet-container>
<handlers>
<file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
</handlers>
<filters>
<response-header name="server-header" header-name="Server" header-value="WildFly/10"/>
<response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow/1"/>
</filters>
</subsystem>
So the only thing changed here is the added default-encoding="utf-8" attribute in the <servlet-container> tag. How can I add it via a CLI script? Thank you.
run write-attribute operation on servlet-container resource
/subsystem=undertow/servlet-container=default:write-attribute(name="default-encoding", value="utf-8")
I am running my java project on wildfly-8.2.0.Final, and i want to enable G-zip compression for the web content (js, css ,jsp etc), how to achieve it.
I got it done, we need to change the standalone.xml like this
search for and then make the changes as below
<subsystem xmlns="urn:jboss:domain:undertow:1.2">
<buffer-cache name="default"/>
<server name="default-server">
<http-listener name="default" socket-binding="http"/>
<host name="default-host" alias="localhost">
<location name="/" handler="welcome-content"/>
**<filter-ref name="gzipFilter" predicate="regex[pattern='(?:application/javascript|text/css|text/html)(;.*)?', value=%{o,Content-Type}, full-match=true]"/>**
<filter-ref name="server-header"/>
<filter-ref name="x-powered-by-header"/>
</host>
</server>
<servlet-container name="default">
<jsp-config/>
<websockets/>
</servlet-container>
<handlers>
<file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
</handlers>
<filters>
<response-header name="server-header" header-name="Server" header-value="WildFly/8"/>
<response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow/1"/>
**<gzip name="gzipFilter"/>**
</filters>
</subsystem>
(text in bold are the changes)
My web app is getting a data source from JNDI with:
javax.naming.InitialContext ctx = new javax.naming.InitialContext();
javax.sql.DataSource ds = (javax.sql.DataSource)
ctx.lookup("java:comp/env/jdbc/db");
In the app's WEB-INF/web.xml, I have:
<resource-ref>
<description>DataSource</description>
<res-ref-name>jdbc/db</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
In the app's WEB-INF/ibm-web-bnd.xml, I have:
<web-bnd
xmlns="http://websphere.ibm.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-web-bnd_1_0.xsd"
version="1.0">
<virtual-host name="default_host"/>
<resource-ref name="jdbc/db" binding-name="jdbc/db"/>
</web-bnd>
In WebSphere Liberty Profile's server.xml, I have (keeping on the relevant parts):
<server description="new server">
<featureManager>
<feature>jsp-2.2</feature>
<feature>jdbc-4.0</feature>
</featureManager>
<library id="oracle-lib">
<fileset dir="lib" includes="ojdbc5_g.jar"/>
</library>
<dataSource jndiName="jdbc/db" jdbcDriverRef="oracle-driver" type="javax.sql.DataSource">
<jdbcDriver libraryRef="oracle-lib" id="oracle-driver"/>
<connectionManager numConnectionsPerThreadLocal="10" id="ConnectionManager" minPoolSize="1"/>
<properties user="user" password="password"
url="jdbc:oracle:thin:#//db-server:1521/db"/>
</dataSource>
</server>
When the app attempts to get the datasource from JNDI, it fails with the following error:
CWNEN0030E: The #Resource factory encountered a problem getting
the object instance jdbc/oracle binding object. The exception message was:
failed to resolve jdbc/oracle to javax.sql.DataSource:
javax.naming.NameNotFoundException:
Intermediate context does not exist: jdbc/oracle
What I am missing here?
WebSphere server.xml
<server>
<featureManager>
<feature>jndi-1.0</feature>
<feature>jdbc-4.1</feature>
</featureManager>
<httpEndpoint id="defaultHttpEndpoint"
host="localhost"
httpPort="9080"
httpsPort="9443" />
<library id="oracle-lib">
<fileset dir="lib" includes="ojdbc6_g.jar"/>
</library>
<dataSource jndiName="jdbc/oracle">
<jdbcDriver libraryRef="oracle-lib"/>
<properties.oracle user="orbeon" password="password"
url="jdbc:oracle:thin:#//localhost:1521/orbeon"/>
</dataSource>
<application name="orbeon" location="war/orbeon" type="war">
<classloader commonLibraryRef="oracle-lib"/>
</application>
</server>
WEB-INF/ibm-web-bnd.xml
<web-bnd version="1.0"
xmlns="http://websphere.ibm.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-web-bnd_1_0.xsd">
<virtual-host name="default_host"/>
<resource-ref name="jdbc/oracle" binding-name="jdbc/oracle"/>
</web-bnd>
WEB-INF/web.xml
<resource-ref>
<res-ref-name>jdbc/oracle</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
Resource injection (instead of web.xml + ibm-web-bnd.xml):
#Resource(lookup = "jdbc/oracle")
DataSource ds;
we use DB2 on Liberty 8.5.5 and we have in server.xml
<dataSource id="db2" isolationLevel="TRANSACTION_READ_COMMITTED" jndiName="jdbc/db2" type="javax.sql.DataSource">
<jdbcDriver>
<library>
<fileset dir="/usr/lib/java/ibm-db2-universal-driver" includes="db2jcc4.jar, db2jcc_license_cisuz.jar, db2jcc_license_cu.jar"/>
</library>
</jdbcDriver>
<properties.db2.jcc databaseName="DB2T" portNumber="21020" serverName="db2t.lvm.de"/>
<containerAuthData password="{xor}KzspMC04" user="tdvorg"/>
</dataSource>
Maybe helps that.
Robert
In my case, the solution below works fine for me.
I created a "Generic project" in Eclipse called "Resources". Inside this project I created a file dataSource.xml with following content:
<server>
<dataSource id="ccm" jndiName="jdbc/ccm" type="javax.sql.DataSource">
<jdbcDriver id="oracle-driver" libraryRef="oracle-lib"/>
<connectionManager id="ConnectionManager" minPoolSize="1" numConnectionsPerThreadLocal="10"/>
<properties.oracle password="password" url="jdbc:oracle:thin:#128.1.30.150:1521:ccmdes" user="ccm"/>
</dataSource>
<library id="oracle-lib">
<fileset dir="C:\Oracle\product\10.1.0\Client_1\jdbc\lib" includes="ojdbc14_g.jar"/>
</library>
<jdbcDriver id="oracle" libraryRef="oracle-lib"/>
</server>
And I drag and drop this file for server configuration in Eclipse or create the line in server.xml:
<include location="${shared.config.dir}/dataSource.xml"/>
The file server.xml was like this:
<server description="new server">
<!-- Enable features -->
<featureManager>
<feature>jsp-2.3</feature>
<feature>adminCenter-1.0</feature>
<feature>jdbc-4.1</feature>
<feature>jndi-1.0</feature>
<feature>servlet-3.1</feature>
</featureManager>
<httpEndpoint host="localhost" httpPort="9080" httpsPort="9443" id="defaultHttpEndpoint"/>
<applicationMonitor updateTrigger="mbean"/>
<!-- Define your admin user name and password -->
<quickStartSecurity userName="admin" userPassword="password"/>
<!-- Define a keystore for the HTTPS port -->
<keyStore id="defaultKeyStore" password="Liberty"/>
<!-- Allows remote file access for config changes -->
<remoteFileAccess>
<writeDir>${server.config.dir}</writeDir>
</remoteFileAccess>
<!-- <applicationMonitor updateTrigger="mbean"/> -->
<webApplication id="TestPage" location="TestPage.war" name="TestPage"/>
<webApplication id="MonitoriaAtendimento" location="MonitoriaAtendimento.war" name="MonitoriaAtendimento"/>
<include location="${shared.config.dir}/dataSource.xml"/>
</server>
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
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.