I'm using Jboss EAP 7.1 now, recently I add the Oracle datasource to the server as the datasource I correctly configured before. But I got the error message:
Services with missing/unavailable dependencies" => [
"org.wildfly.data-source.CreditDS is missing [jboss.jdbc-driver.oracle11g]"
CreditDs is my JNDI name and oracle11g is the driver name. Here are my configuration:
<!-- standalone.xml -->
<datasource jndi-name="java:jboss/datasources/CreditDS" pool-name="CreditDS" enabled="true">
<connection-url>jdbc:oracle:thin:#***</connection-url>
<driver>oracle11g</driver>
…… …… ……
</datasource>
<drivers>
<driver name="oracle11g" module="com.oracle.ojdbc14">
<xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
</driver>
</drivers>
Here is the modules.xml in modules/com/oracle/ojdbc14/main
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.oracle.ojdbc14">
<resources>
<resource-root path="ojdbc14-10.2.0.4.0.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
What's wrong?
I guess your oracle module is not recognized correctly.
The procedure for adding oracle JDBC module is as follows:
1 create folder com/oracle/ojdbc14/10.2.0.4.0 withing JBOSS_HOME/modules directory
2 copy your oracle jar file to the folder and add a module.xml with the following contents
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.3" name="com.oracle.ojdbc14" slot="10.2.0.4.0">
<resources>
<resource-root path="ojdbc14-10.2.0.4.0.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
3 Create driver definition in standalone.xml
<driver name="oracle14" module="com.oracle.ojdbc14:10.2.0.4.0">
<xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
</driver>
Couple of things to note:
Do pay attention to correct version of JBoss modules XMLNS - you tagged your questions with EAP7 - so you should use xmlns 1.3.
Note the slot value in both modules.xml and driver definition. This could be any value, but it is a good practice to use the lib version.
After adding any modules into JBoss, you need to restart it completely(restart JVM).
Lastly, you should use an up-to-date version of Oracle JDBC driver as ojdbc14 are not supported anymore, so it should be like this:
Module.xml
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.3" name="com.oracle.ojdbc7" slot="12.1.0.2">
<resources>
<resource-root path="ojdbc7-12.1.0.2.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
Folder modules/com/oracle/ojdbc7/12.1.0.2
Driver:
<driver name="oracle7" module="com.oracle.ojdbc7:12.1.0.2">
<xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
</driver>
Related
I have a war file that contains, some jackson dependencies and then when I try to deploy it on jboss eap 7.3 server, war deployment fails
Due to, as different version of these jackson jar are included via global modules. That I cannot or remove from their.
So I create a jboss-deployment-structure.xml file and tried excluding specific jar's inside the global module's but it did not worked.
But I was successful in excluding the whole global modules that I don't want.
This is what I tried!!
<?xml version="1.0"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<deployment>
<exclusions>
<module name="fb_library" />
</exclusions>
</deployment>
</jboss-deployment-structure>
This above config works, but it excludes the whole global fb_library folder, But as I needed to exclude some specific jar so tried this and it gave error as wrong format for jboss-deployment-structure.xml
This gave error of wrong config as mentioned above
<?xml version="1.0"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<deployment>
<exclusions>
<resources>
<resource-root path="jackson-core-2.6.6.jar"/>
<resource-root path="jackson-annotations-2.6.0.jar"/>
<resource-root path="jackson-databind-2.6.6.jar"/>
<resource-root path="jackson-dataformat-cbor-2.6.6.jar"/>
</resources>
</exclusions>
</deployment>
</jboss-deployment-structure>
PS:- I have updated the question, as suggested by some members in chat, previously I was asking the wrong question. Apologies for that.
Again I tried this and not working
<?xml version="1.0"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<deployment>
<exclusions>
<module name="com.fasterxml.jackson.core" />
<module name="com.fasterxml.jackson.annotation" />
<module name="com.fasterxml.jackson.databind.module" />
<module name="com.fasterxml.jackson.jaxrs" />
<module name="com.fasterxml.jackson.jaxrs.json" />
<module name="com.fasterxml.jackson.module.jaxb" />
</exclusions>
</deployment>
</jboss-deployment-structure>
In jboss-deployment-structure, you are not allowed to add resources content (Jar files).
you need to specify the module name added by the dependency jar file itself here is an example :
here is a jackson jar that I want to exclude from jboss modules :
the module name is : com.fasterxml.jackson.core
and in the jboss-deployment-structure.xml it will be :
<?xml version="1.0"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<deployment>
<exclusions>
<module name="com.fasterxml.jackson.core" />
</exclusions>
</deployment>
</jboss-deployment-structure>
This answer solve my problems for com.fasterxml.jackson.dataformat.cbor
FYI
https://stackoverflow.com/a/37859612/14337508
This question is a spinoff of this one!
I now can configure my project to use a different version of Hibernate and my JBoss installation has a second slot named "5.1.1.Final" (located at ...\jboss-as-7.1.3.Final\modules\org\hibernate\5.1.10.Final) that has the following module.xml file:
<module xmlns="urn:jboss:module:1.1" name="org.hibernate:5.1.10.Final">
<resources>
<resource-root path="hibernate-core-5.1.10.Final.jar"/>
<resource-root path="hibernate-entitymanager-5.1.10.Final.jar"/>
<resource-root path="hibernate-infinispan-5.1.10.Final.jar"/>
<!-- Insert resources here -->
</resources>
<dependencies>
<module name="asm.asm"/>
<module name="javax.api"/>
<module name="javax.persistence.api"/>
<module name="javax.transaction.api"/>
<module name="javax.validation.api"/>
<module name="org.antlr"/>
<module name="org.apache.commons.collections"/>
<module name="org.dom4j"/>
<module name="org.infinispan" optional="true"/>
<module name="org.javassist"/>
<module name="org.jboss.as.jpa.hibernate" slot="4" optional="true"/>
<module name="org.jboss.logging"/>
<module name="org.hibernate.envers" services="import" optional="true"/>
<module name="org.hibernate.commons-annotations"/>
</dependencies>
</module>
However, when JBoss starts I receive the following error message: ParseError at [row,col]:[26,72] Message: Invalid/mismatched module name (expected org.hibernate:5.1.10.Final).
I can't understand why this message, since the required module name (org.hibernate:5.1.10.Final) is the exact name I specified at the file (name="org.hibernate:5.1.10.Final");
What am i missing?
The slot is a separate attribute. It should look like the following.
<module xmlns="urn:jboss:module:1.1" name="org.hibernate" slot="5.1.10.Final">
On a side note you may want to consider trying to upgrade to WildFly 11, current release is WildFly 11.0.0.Beta1. I'm not sure if Hibernate 5.1.x will work with JBoss AS 7.x. WildFly 10.1.0.Final uses Hibernate 5.0.10.Final.
I am currently migrating apps from JBoss 5.1 to JBoss 7.0 EAP server.
I have added a module to JBoss server named - org.springframework for spring dependency jars
<?xml version="1.0" ?>
<module xmlns="urn:jboss:module:1.1" name="org.springframework">
<resources>
<resource-root path="spring-core-3.0.5.RELEASE.jar"/>
<resource-root path="spring-context-3.0.5.RELEASE.jar"/>
<resource-root path="spring-beans-3.0.5.RELEASE.jar"/>
<resource-root path="spring-expression-3.0.5.RELEASE.jar"/>
<resource-root path="spring-web-3.0.5.RELEASE.jar"/>
<resource-root path="spring-aop-3.0.5.RELEASE.jar"/>
<resource-root path="spring-asm-3.0.5.RELEASE.jar"/>
<resource-root path="spring-jdbc-3.0.5.RELEASE.jar"/>
<resource-root path="spring-tx-3.0.5.RELEASE.jar"/>
<resource-root path="org.springframework.web.servlet-3.0.0.M3.jar"/>
<resource-root path="commons-logging-1.1.1.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.servlet.jsp.api"/>
<module name="javax.faces.api"/>
</dependencies>
</module>
I have defined the module dependency in jboss-deployment-structure.xml of the WAR
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="com.oracle" />
<module name="org.springframework" />
</dependencies>
</deployment>
</jboss-deployment-structure>
The war deployed to server also contains spring-context-3.0.5.RELEASE.jar in its WEB-INF/lib folder
So I think the required jar - spring-context-3.0.5.RELEASE.jar exists in class path. But still I am getting the below error :
04:33:30,496 INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] (default task-19) Loading XML bean definitions from class path resource [core_services.xml]
04:33:30,507 INFO [org.springframework.beans.factory.support.DefaultListableBeanFactory] (default task-19) Pre-instantiating singletons in org.springframework.beans.fact
ory.support.DefaultListableBeanFactory#9b765aa: defining beans [LogService,CacheService,PropertyService]; root of factory hierarchy
2017.02.09 04:33:30 ERROR CashViewsPortalServiceImpl(-2): org/springframework/context/support/ClassPathXmlApplicationContext
CallStack=java.lang.NoClassDefFoundError: org/springframework/context/support/ClassPathXmlApplicationContext
at com.karthik.common.service.Services.getService(Services.java:31)
at com.karthik.data.service.DataServices.getService(DataServices.java:18)
at com.karthik.portal.server.PortalServiceImpl.getInitializeInfo(PortalServiceImpl.java:83)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:561)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:265)
at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:305)
at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
1) Why do we need add module in Jboss 7 EAP server for class loading even though the jars are bundled in WEB-INF/lib folder of the war
deployed on server?
2) How to resolve the above error?
I think you have n't defined the spring dependencies perfectly. Below are the steps:
You can define Spring as a module
The following are steps to create a Spring module:
1.Download the desired version of Spring. For this example we are using Spring 3.1.1.
2.Create the directory: $JBOSS_HOME/modules/org/springframework/spring/main.
3.Copy the Spring libraries you downloaded to that directory.
4.Create module.xml with the following contents under that directory. Make sure these correspond to the libraries' names:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="org.springframework.spring">
<resources>
<resource-root path="org.springframework.aop-3.1.1.RELEASE.jar"/>
<resource-root path="org.springframework.asm-3.1.1.RELEASE.jar"/>
<resource-root path="org.springframework.aspects-3.1.1.RELEASE.jar"/>
<resource-root path="org.springframework.beans-3.1.1.RELEASE.jar"/>
<resource-root path="org.springframework.context-3.1.1.RELEASE.jar"/>
<resource-root path="org.springframework.context.support-3.1.1.RELEASE.jar"/>
<resource-root path="org.springframework.core-3.1.1.RELEASE.jar"/>
<resource-root path="org.springframework.expression-3.1.1.RELEASE.jar"/>
<resource-root path="org.springframework.instrument-3.1.1.RELEASE.jar"/>
<resource-root path="org.springframework.instrument.tomcat-3.1.1.RELEASE.jar"/>
<resource-root path="org.springframework.jdbc-3.1.1.RELEASE.jar"/>
<resource-root path="org.springframework.jms-3.1.1.RELEASE.jar"/>
<resource-root path="org.springframework.orm-3.1.1.RELEASE.jar"/>
<resource-root path="org.springframework.oxm-3.1.1.RELEASE.jar"/>
<resource-root path="org.springframework.test-3.1.1.RELEASE.jar"/>
<resource-root path="org.springframework.transaction-3.1.1.RELEASE.jar"/>
<resource-root path="org.springframework.web-3.1.1.RELEASE.jar"/>
<resource-root path="org.springframework.web.portlet-3.1.1.RELEASE.jar"/>
<resource-root path="org.springframework.web.servlet-3.1.1.RELEASE.jar"/>
<resource-root path="org.springframework.web.struts-3.1.1.RELEASE.jar"/>
</resources>
<dependencies>
<module name="org.apache.commons.logging"/>
<module name="javax.api" export="true"/>
<module name="org.jboss.vfs"/>
</dependencies>
</module>
Here is an absolute minimal module.xml (the different Spring version is irrelevant):
<?xml version="1.0"?>
<module xmlns="urn:jboss:module:1.1" name="org.springframework.spring">
<resources>
<resource-root path="spring-aop-3.2.3.RELEASE.jar"/>
<resource-root path="spring-beans-3.2.3.RELEASE.jar"/>
<resource-root path="spring-context-3.2.3.RELEASE.jar"/>
<resource-root path="spring-core-3.2.3.RELEASE.jar"/>
<resource-root path="spring-expression-3.2.3.RELEASE.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="org.apache.commons.logging"/>
</dependencies>
</module>
5.Put the following jboss-deployment-structure.xml in your application archive (WEB-INF/jboss-deployment-structure.xml for WAR or META-INF/jboss-deployment-structure.xml for EAR or EJB-jar) to use the above module:
If you're using JBoss EAP 6.1.x and greater or EAP 7, then use below:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="org.springframework.spring" export="true" meta-inf="export"/>
</dependencies>
</deployment>
</jboss-deployment-structure>
If JBoss EAP 6.0.x, then use below
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="org.springframework.spring" export="true">
<imports>
<include path="META-INF**"/>
<include path="org**"/>
</imports>
<exports>
<include path="META-INF**"/>
<include path="org**"/>
</exports>
</module>
</dependencies>
</deployment>
</jboss-deployment-structure>
Note: The meta-inf on the module in the jboss-deployment-structure.xml was added in JBoss EAP 6.1.0, which allows the files in the META-INF of a resource to be visible. Since this was not available in JBoss EAP 6.0.x, the section allows you to get access to the META-INF directory which is not visible by default.
Note: The Spring Framework module should not include resources such as servlet-api.jar, xml-apis.jar, jta-api.jar, and other APIs. These APIs are implemented by either the JDK or JBoss and trying to use a different version of the API will lead to classloading issues and other problems.
Note: The Spring module should include all of its non Java / JavaEE dependencies. The Spring module can depend on javax.api / javaee.api provided by JBoss and any public JBoss module, but for other dependencies Spring has such as aopalliance, they would need to be included as resources in the module or in another custom module.
I want to add log4j-extras jar in my jboss server but i don't know how to do this correctly.
I put apache-log4j-extras-1.2.17.jar into jboss_HOME/modules\org\apache\log4j\main (same location as log4j-1.2.16.jar) and my module.xml looks like :
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="org.apache.log4j">
<properties>
<property name="jboss.api" value="private"/>
</properties>
<resources>
<resource-root path="log4j-1.2.16.jar"/>
<!-- Insert resources here -->
<resource-root path="apache-log4j-extras-1.2.17.jar"/>
</resources>
<dependencies>
<module name="org.dom4j" optional="true"/>
<module name="javax.api"/>
<module name="org.jboss.logmanager"/>
<module name="org.jboss.modules"/>
</dependencies>
</module>
After start jboss, i have new files in the directory :
apache-log4j-extras-1.2.17.jar.index and log4j-1.2.16.jar.index
I have an application which use an external log4j.properties.
The configuration is ok but when i try to add "log4j.appender.test=org.apache.log4j.rolling.RollingFileAppender", i have the error message "log4j:ERROR Could not instantiate class [org.apache.log4j.rolling.RollingFileAppender]"
So i guess that the add of log4j-extras is not ok.
Can someone tell me the correct configuration to do in jboss ? (maybe the module.xml is not correct or i need to create an other directory in module ?)
Thanks a lot !
We have some DLL's which are related to Java,VB. In Joss 4.X , We used to place in bin directory under Application Server.
We migrated to JBOSS 7.1.1 and when I removed from bin directory and placed them in libraries folder under C:\jboss-as-7.1.1.Final\modules\com\correction\main\libraries .
I am getting this exception
java.lang.UnsatisfiedLinkError: no xxxJavaWrapper in java.library.path
java.library.path = C:\Program Files\Java\jdk1.6.0_24\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\apache-maven-3.0.4;C:\apache-maven-3.0.4\bin;C:\Python27;C:\Program Files\Java\jdk1.6.0_24;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
java.lang.UnsatisfiedLinkError: com.xxxJavaWrapperJNI.new_xxx()J
module.xml
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="com.correction">
<resources>
<resource-root path="xxx.jar"/>
<resource-root path="xyz.jar"/>
<resource-root path="libraries"/>
</resources>
<dependencies>
<system export="true">
<paths>
<path name="libraries"/>
</paths>
<exports>
<include-set>
<path name="libraries"/>
</include-set>
</exports>
</system>
</dependencies>
</module>
But I place the same dll's in bin folder, it is working fine.
I want to place them in module folder and set the path from there instead of bin so that I can have all the application related jar's, properties and dll files at one place for ease maintainance.
Also I want to know how to set the path of txt and properties files in jboss 7.1.1
Regards
Srini
Configure module.xml as below:
<module xmlns="urn:jboss:module:1.1" name="com.correction">
<resources>
<resource-root path="xxx.jar"/>
<resource-root path="xyz.jar"/>
<resource-root path="lib/win-x86_64"/>
</resources>
<dependencies>
<module name="sun.jdk"/>
</dependencies>
</module>
Put the DLLs into the directory lib/win-x86_64. Check the another dependencies of your project.
In WEB-INF of your application creating the file jboss-deployment-structure.xml and put the content below:
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="com.correction"/>
</dependencies>
</deployment>
</jboss-deployment-structure>
That's all.
Another Question: How can you make these properties files accessible to applications deployed on JBoss 7?
create a custom module where you put your properties files and put jboss-deployment-structure.xml to your application archive (WAR/EAR) to use that custom module.
Create the new module directory under $JBOSS_HOME/modules(using app/conf in this example)
mkdir -p $JBOSS_HOME/modules/app/conf/main/properties/
Put your properties files in $JBOSS_HOME/modules/app/conf/main/properties/
Create a module.xmlhere $JBOSS_HOME/modules/app/conf/main/module.xml
<module xmlns="urn:jboss:module:1.1" name="app.conf">
<resources>
<resource-root path="properties"/>
</resources>
</module>
put the following jboss-deployment-structure.xml in WEB-INF:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="app.conf" />
</dependencies>
</deployment>
</jboss-deployment-structure>
Then you can access your properties files using thecode below (example assumes you have a
example.propertiesfile in $JBOSS_HOME/modules/app/conf/main/properties/)
Thread.currentThread().getContextClassLoader().getResource("example.properties");
Ps: I used JBoss AS 7.1.2 ( JBoss EAP 6 )
Regards
Mauricio Magnani