jboss 6 remote jms bridge configuration not working - java

I have to push messages from one jobss server and consume from another jboss server. For that I used jms bridge.
Added jms bridge configuration under </hornetq-server> tag in
standalone-full.xml and also referred dependencies via module.
<jms-bridge name="simpleBridge" module="org.jboss.messaging">
<source>
<connection-factory name="ConnectionFactory"/>
<destination name="java:/simpleSOurceQ"/>
</source>
<target>
<connection-factory name="RemoteConnectionFactory"/>
<destination name="/queue/simpleTargetQ"/>
<context>
<property key="java.naming.factory.initial" value="org.jboss.naming.remote.client.InitialContextFactory"/>
<property key="java.naming.provider.url" value="remote://TARGET_URL:5445"/>
</context>
</target>
<quality-of-service>DUPLICATES_OK</quality-of-service>
<failure-retry-interval>500</failure-retry-interval>
<max-retries>1</max-retries>
<max-batch-size>500</max-batch-size>
<max-batch-time>500</max-batch-time>
<add-messageID-in-header>true</add-messageID-in-header>
</jms-bridge>
Deployment time, getting below ERROR in jboss,
ERROR LOG :
ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS014612: Operation ("add") failed - address: ([
("subsystem" => "messaging"),
("jms-bridge" => "simpleBridge")
]) - failure description: {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.messaging.jms-bridge.simpleBridge is missing [jboss.naming.context.java.simpleSourceQ]"]}
How to resolve this?
or Is there anyway to achieve this?

The bridge's source is defined as:
<source>
<connection-factory name="ConnectionFactory"/>
<destination name="java:/simpleSOurceQ"/>
</source>
However, according to a comment your jms-queue is defined as:
<jms-queue name="simpleSourceQ">
<entry name="jms/queue/simpleSourceQ"/>
<entry name="java:jboss/exported/jms/queue/simpleSourceQ"/>
<durable>true</durable>
</jms-queue>
As you can see, the destination name from the source doesn't match any of the entry elements from the jms-queue therefore the bridge dependencies are not met. The bridge's source should reference a valid JNDI entry of the jms-queue.

Related

From jboss/java1.6 to wildfly20/java1.8

sorry for long post
i have a web application made in java 1.6.0, jsf, richfaces3.3.3 and hibernate 3 ( DB oracle )
hibernate mapping made through *.hbm.xml files, and datasource configured on hibernate-service.xml
<?xml version="1.0" encoding="UTF-8"?>
<server>
<mbean code="org.jboss.hibernate.jmx.Hibernate"
name="jboss.har:service=HibernateFlowManager">
<!-- Datasource settings -->
<attribute name="SessionFactoryName">java:/hibernate/HibernateFlowManagerFactory</attribute>
<attribute name="DatasourceName">java:OracleDS</attribute>
<attribute name="Dialect">org.hibernate.dialect.Oracle9iDialect</attribute>
<!-- Second-level caching -->
<attribute name="SecondLevelCacheEnabled">false</attribute>
<attribute name="QueryCacheEnabled">false</attribute>
<attribute name="ReflectionOptimizationEnabled">true</attribute>
<!-- Batching -->
<attribute name="JdbcBatchSize">50</attribute>
<!-- Logging -->
<attribute name="ShowSqlEnabled">false</attribute>
</mbean>
</server>
i have an HibernateUtils class with sessionFactory
sessionFactory = (SessionFactory)new InitialContext().lookup("java:/hibernate/HibernateFlowManagerFactory");
all packed in app.ear and deployed into jboss 4.2.3.GA
the goal is use the app with java 1.8.0 and use wildfly 20
i installed wildfly 20 and configured a oracle datasource OracleDS and test is ok
i tried to deploy app.ear but i have the exception
20:26:18,094 ERROR [org.jboss.as.server] (management-handler-thread Caused by: java.lang.RuntimeException: WFLYSRV0177: Error getting reflective information for class myapp.appl.beans.MgrValidatorBean with ClassLoader ModuleClassLoader for Module \"deployment.app.ear.app.jar\" from Service Module Loader
Caused by: java.lang.NoClassDefFoundError: org/hibernate/Query
Caused by: java.lang.ClassNotFoundException: org.hibernate.Query from [Module \"deployment.app.ear.app.jar\" from Service Module Loader]",
"jboss.deployment.subunit.\"app.ear\".\"app.war\".POST_MODULE" => "WFLYSRV0153: Failed to process phase POST_MODULE of subdeployment \"app.war\" of deployment \"app.ear\"
Caused by: java.lang.NoClassDefFoundError: org/hibernate/Session
i don't want to change hibernate in the app so i builded app.ear and in META-INF folder i put file jboss-deployment-structure.xml like this
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<!-- Make sub deployments isolated by default, so they cannot see each others classes without a Class-Path entry -->
<ear-subdeployments-isolated>true</ear-subdeployments-isolated>
<!-- This corresponds to the top level deployment. For a war this is the war's module, for an ear -->
<!-- This is the top level ear module, which contains all the classes in the EAR's lib folder -->
<deployment>
<!-- exclude-subsystem prevents a subsystems deployment unit processors running on a deployment -->
<!-- which gives basically the same effect as removing the subsystem, but it only affects single deployment -->
<exclude-subsystems>
<subsystem name="org.hibernate" />
<subsystem name="org.hibernate.validator" />
</exclude-subsystems>
<!-- Exclusions allow you to prevent the server from automatically adding some dependencies -->
<exclusions>
<module name="org.hibernate" />
<module name="org.hibernate.validator" />
</exclusions>
</deployment>
</jboss-deployment-structure>
deploy and different exception
20:29:20,671 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 1) WFLYCTL0013: Operation ("deploy") failed - address: ({"deployment" => "app.ear"}) - failure description: {
"WFLYCTL0080: Failed services" => {
"jboss.deployment.subunit.\"app.ear\".\"app.jar\".POST_MODULE" => "WFLYSRV0153: Failed to process phase POST_MODULE of subdeployment \"app.jar\" of deployment \"app.ear\"
Caused by: java.lang.RuntimeException: WFLYSRV0177: Error getting reflective information for class myapp.appl.beans.MgrValidatorBean with ClassLoader ModuleClassLoader for Module \"deployment.app.ear.app.jar\" from Service Module Loader
Caused by: java.lang.NoClassDefFoundError: org/hibernate/Query
Caused by: java.lang.ClassNotFoundException: org.hibernate.Query from [Module \"deployment.app.ear.app.jar\" from Service Module Loader]",
what approach i can use to achieve my goal ?

wildfly / jboss-eap: How to name JMS resources to match EJB2 ejb-jar.xml

I currently migrate an EJB2 application to jboss-eap. The first phase tries to modify less source as possible.
The give ejb-jar.xml contains
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar id="ejb-jar_ID">
[...]
<session >
[...]
<resource-ref >
<res-ref-name>jms/customQueueFactory</res-ref-name>
<res-type>javax.jms.QueueConnectionFactory</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
<resource-env-ref >
<resource-env-ref-name>jms/customQueue</resource-env-ref-name>
<resource-env-ref-type>javax.jms.Queue</resource-env-ref-type>
</resource-env-ref>
</session>
I added following configuration to standalone-full.xml urn:jboss:domain:messaging-activemq:13.0:
<connection-factory name="customQueueFactory" entries="java:/jms/customQueueFactory" connectors="in-vm"/>
<jms-queue name="customQueue" entries="java:/jms/customQueue"/>
But when I start jboss the jms resources cannot get resolved:
02:26:30,651 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "app.ear")]) - failure description: {
"WFLYCTL0412: Required services that are not installed:" => [
"jboss.naming.context.java.jboss.resources.jms.customQueueFactory",
"jboss.naming.context.java.jboss.resources.jms.customQueue"
],
"WFLYCTL0180: Services with missing/unavailable dependencies" => [
"jboss.naming.context.java.comp.app.app-mdb.Sender.env.jms.customQueueFactory is missing [jboss.naming.context.java.jboss.resources.jms.customQueueFactory]",
"jboss.naming.context.java.comp.app.app-mdb.Sender.env.jms.customQueue is missing [jboss.naming.context.java.jboss.resources.jms.customQueue]"
]
}
Default lookup prefix for jboss-eap 7.4 is java:jboss/resources. So in order to get this to work the exported names need to be adjusted accordingly:
<connection-factory name="customQueueFactory" entries="java:jboss/resources/jms/customQueueFactory" connectors="in-vm"/>
<jms-queue name="customQueue" entries="java:jboss/resources/jms/customQueue"/>

How to rewrite a RewriteValve for Undertow / JBoss 7.2 EAP?

I'm migrating from JBoss 6.4.3 to JBoss 7.2 and saw a Valves are no longer supported warning during deployment. This came from a jboss-web.xml file with:
<valve>
<class-name>org.jboss.web.rewrite.RewriteValve</class-name>
</valve>
...and a corresponding rewrite.properties file:
RewriteCond %{HTTP:X-Forwarded-Proto} http
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
Could anyone advise how to rewrite this (no pun intended) for Undertow?
You can create a rewrite filter in the Undertow subsystem, and then reference it in the server host within the configuration file (standalone.xml or domain.xml - depending on the mode in which you start the application server).
I can think of two options, which might help you:
Using the JBoss Application Server Client (should be placed in path/to/jboss-7.2/bin/)
Creating the rewrite filter with the custom name redirect-http-to-https:
./jboss-cli.sh --connect --command="/subsystem=undertow/configuration=filter/rewrite=redirect-http-to-https:add(redirect=\"true\",target=\"https://%{LOCAL_SERVER_NAME}%{REQUEST_URL}\")"
Using/referencing the filter redirect-http-to-https:
./jboss-cli.sh --connect --command="/subsystem=undertow/server=default-server/host=default-host/filter-ref=redirect-http-to-https:add(predicate=\"equals(%p,80)\")"
Manually editing the respective config file (e.g. standalone.xml)
<subsystem xmlns="urn:jboss:domain:undertow:11.0" default-server="default-server" [...]>
<buffer-cache name="default"/>
<server name="default-server">
[...]
<host name="default-host" alias="localhost">
<filter-ref name="redirect-http-to-https" predicate="equals(%p,80)"/>
</host>
</server>
[...]
<filters>
<rewrite name="redirect-http-to-https" target="https://%{LOCAL_SERVER_NAME}%{REQUEST_URL}" redirect="true"/>
</filters>
</subsystem>
Note: For the Undertow exchange attributes (e.g. LOCAL_SERVER_NAME) refer to Undertow documentation. Further, the part predicate=\"equals(%p,80)\" in the filter-refchecks the requested port (%p -> just another Undertow exchange attribute) and if it equals to 80, then it triggers our redirect filter redirect-http-to-https - you can change the port 80 as per your need.

Thorntail 2.6.0.Final "WFLYJCA0114: Failed to load datasource class: com.mysql.cj.jdbc.MysqlXADataSource"

I am using Thorntail (2.6.0) for the first time and have Problems connecting it to my Mysql Database (8.0.18)
I get the following Exception
2019-12-22 17:43:08,832 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 48) WFLYCTL0013: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("jdbc-driver" => "mysql")
]) - failure description: "WFLYJCA0114: Failed to load datasource class: com.mysql.cj.jdbc.MysqlXADataSource"
Followed by this Exception
2019-12-22 17:43:09,981 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("data-source" => "MainDS")
]) - failure description: {
"WFLYCTL0412: Required services that are not installed:" => ["jboss.jdbc-driver.mysql"],
"WFLYCTL0180: Services with missing/unavailable dependencies" => [
"org.wildfly.data-source.MainDS is missing [jboss.jdbc-driver.mysql]",
"jboss.driver-demander.java:jboss/datasources/MainDS is missing [jboss.jdbc-driver.mysql]"
]
}
2019-12-22 17:43:09,982 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("data-source" => "MainDS")
]) - failure description: {
"WFLYCTL0412: Required services that are not installed:" => [
"jboss.jdbc-driver.mysql",
"jboss.jdbc-driver.mysql"
],
"WFLYCTL0180: Services with missing/unavailable dependencies" => [
"org.wildfly.data-source.MainDS is missing [jboss.jdbc-driver.mysql]",
"jboss.driver-demander.java:jboss/datasources/MainDS is missing [jboss.jdbc-driver.mysql]",
"org.wildfly.data-source.MainDS is missing [jboss.jdbc-driver.mysql]"
]
}
The Following Settings I already did
I have JAVA_HOME should be Java 8 Zulu on a MacBook with Catalina
I have a module ../src/main/resources/modules/com/mysql/main/module.xml with the Following inside
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="com.mysql">
<resources>
<resource-root path="mysql-connector-java-8.0.18.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
My Persistence.xml in ../src/main/resources/META-INF/persistence.xml has this inside
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
<persistence-unit name="SPU" transaction-type="JTA">
<!-- The "Java-Transaction-API" datasource here refers to the datasource defined in /src/main/resources/project-defaults.yml. -->
<jta-data-source>java:jboss/datasources/MainDS</jta-data-source>
<!-- User and password defines in project-defaults.yml -->
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
<property name="hibernate.connection.driver_class" value="com.mysql.cj.jdbc.Driver"/>
<property name="hibernate.show_sql" value="false"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
</properties>
</persistence-unit>
</persistence>
and my project-defaults.yml in ../src/main/resources/project-defaults.yml has this inside
thorntail:
datasources:
jdbc-drivers:
mysql:
driver-module-name: com.mysql
driver-xa-datasource-class-name: com.mysql.cj.jdbc.MysqlXADataSource
data-sources:
MainDS:
driver-name: mysql
connection-url: jdbc:mysql://localhost:3306/Mysql
user-name: ****
password: ****
I have this in my pom:
<dependency>
<groupId>io.thorntail</groupId>
<artifactId>datasources</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${version.mysql}</version>
</dependency>
My Database is running and this should be not the problem.
I also read somewhere that there is an error in WildFly, stopping thorntail in finding com.mysql.cj.jdbc.MysqlXADataSource.
I thank everyone who tries to help me, I have this problem the whole day already.
My Goal is a Java-EE Server (FatJar) with JPA and a MySQL Database at the back.
Thorntail can autodetect many JDBC drivers, MySQL included. You don't have to create the module.xml file, and the thorntail.datasources.jdbc-drivers.mysql piece of configuration also isn't necessary. It should be enough to have a dependency on the JDBC driver (which you have), and define the datasource (which you also do). The driver-name should be mysql, which you also already have.
See https://docs.thorntail.io/2.6.0.Final/#auto-detecting-jdbc-drivers_thorntail and https://docs.thorntail.io/2.6.0.Final/#_datasources for more info.

MongoDB DataSource Configuration In JBoss Server

How to configure MongoDB DataSource JNDI in JBoss Server.
I downloaded MongoDB jar (mongo-java-driver-3.4.2.jar) and deployed using admin console, it got successfully deployed but when I went to add Datasource in customize option I am not able to see MongoDB driver, the only one option available was h2. Why so? Do I have to do any other configuration change or am I missing any step?
I Even tried to manually create the MongoDB driver and datasource but that is also not working.
I placed module.xml and mongo-java-driver- 3.4.2.jar to the following path
..\devstudio\runtimes\jboss-eap\modules\system\layers\base\org\mongodb\main
--------- module.xml ---------------------
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="org.mongodb">
<resources>
<resource-root path="mongo-java-driver-3.4.2.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
--------------standalone.xml ------------
<datasource jndi-name="java:jboss/datasources/mongodb" pool-name="mongodb"
enabled="true" use-java-context="true">
<connection-url>jdbc:mongodb://127.0.0.1:27017/example;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
<driver>mongodb</driver>
</datasource>
<driver name="mongodb" module="org.mongodb">
<xa-datasource-class>mongodb.jdbc.MongoXADataSource</xa-datasource-class>
</driver>
I was getting the following error when i started the server
("subsystem" => "datasources"),
("data-source" => "mongodb")
]) - failure description: {"WFLYCTL0180: Services with missing/unavailable
dependencies" => [
"org.wildfly.data-source.mongodb is missing [jboss.jdbc-driver.mongodb]",
"jboss.driver-demander.java:jboss/datasources/mongodb is missing
[jboss.jdbc-driver.mongodb]"
]}
23:51:44,277 ERROR [org.jboss.as.controller.management-operation]
(Controller Boot Thread) WFLYCTL0013: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("data-source" => "mongodb")
]) - failure description: {"WFLYCTL0180: Services with missing/unavailable
dependencies" => [
"org.wildfly.data-source.mongodb is missing [jboss.jdbc-driver.mongodb]",
"jboss.driver-demander.java:jboss/datasources/mongodb is missing
[jboss.jdbc-driver.mongodb]",
"org.wildfly.data-source.mongodb is missing [jboss.jdbc-driver.mongodb]"
]}
Could you let me know how to do JNDI Datasource configuration in JBoss Server ?? Please explain in detail as I am new for JNDI Configuration
Refer https://www.progress.com/blogs/configure-connect-for-jdbc-mongodb-driver-with-jboss-eap-64enter link description here

Categories