[JBoss Messaging] - Securing Queues fails when using JmsXA
by Eugen Grosu
grosueugen [http://community.jboss.org/people/grosueugen] created the discussion
"Securing Queues fails when using JmsXA"
To view the discussion, visit: http://community.jboss.org/message/576154#576154
--------------------------------------------------------------
Hello,
I'm using JBoss 5.1.0.GA, jdk 1.6, on Linux.
I need to use distributed transaction with JBoss Messaging, so I used JmsXA for the connection factory.
I changed the DB for messaging, so I used Oracle DB.
With the default security, I was able to send/consume messages to a Queue.
I decided to add a user in the Oracle DB, and that user to have rights to send/receive messages from my Queue.
So, I did the following:
1. create a new user in the Oracle DB:
+INSERT INTO JBM_USER (USER_ID, PASSWD, CLIENTID) VALUES ('my-user', 'my-user-pwd', null);
INSERT INTO JBM_ROLE (ROLE_ID, USER_ID) VALUES ('my-role', 'my-user');
+
2. in code, when obtaining a connection, I would use the username: "my-user", password: "my-user-pwd":
+Connection connection = connectionFactory.createConnection("my-user", "my-user-pwd");+
3. I created a new file for defining destinations, named, my-jms-service.xml, and put it in xxx/deploy/
+ <?xml version="1.0" encoding="UTF-8"?>+
+<server>
<mbean code="org.jboss.jms.server.destination.QueueService"
name="orvaal.rtra.jms.destination:service=Queue,name=MyQueue"
xmbean-dd="xmdesc/Queue-xmbean.xml">
<depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
<depends>jboss.messaging:service=PostOffice</depends>+
+ <attribute name="SecurityConfig">
<security>
<role name="my-role" read="true" write="true"/>
</security>
</attribute>+
+ </mbean>
+
+</server>+
4. In xxx/conf/login-config.xml, I created a new <application-policy>:
+<application-policy name="MyJmsXARealm">
<authentication>
<login-module code="org.jboss.security.auth.spi.DatabaseServerLoginModule" flag="required">
<module-option name="dsJndiName">java:/jdbc/MyXAOracleDSJms</module-option>
<module-option name="principalsQuery">SELECT PASSWD FROM JBM_USER WHERE USER_ID=?</module-option>
<module-option name="rolesQuery">SELECT ROLE_ID, 'Roles' FROM JBM_ROLE WHERE USER_ID=?</module-option>
</login-module>
</authentication>
</application-policy>+
+java:/jdbc/MyXAOracleDSJms+ is the JNDI name for the datasource configured for the Oracle DB used by JBoss Messaging
5. In xxx/deploy/messaging/jms-ds.xml, I edited the JmsXA to know of the created MyJmsXARealm:
+
+
+ <!-- JMS XA Resource adapter, use this to get transacted JMS in beans -->
<tx-connection-factory>
<jndi-name>JmsXA</jndi-name>
<xa-transaction/>
<rar-name>jms-ra.rar</rar-name>
<connection-definition>org.jboss.resource.adapter.jms.JmsConnectionFactory</connection-definition>
<config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Topic</config-property>
<config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/DefaultJMSProvider</config-property>
<max-pool-size>20</max-pool-size>
<!-- COMMENTED THE INITIAL REALM <security-domain-and-application>JmsXARealm</security-domain-and-application> -->
<security-domain-and-application>MyJmsXARealm</security-domain-and-application>
<depends>jboss.messaging:service=ServerPeer</depends>
</tx-connection-factory>+
The error is:
2010-12-15 15:27:53,374 ERROR [org.jboss.resource.adapter.jms.JmsSessionFactoryImpl] (http-127.0.0.1-8080-1) could not create session
java.lang.SecurityException: Unauthenticated caller:null
at org.jboss.security.integration.JBossSecuritySubjectFactory.createSubject(JBossSecuritySubjectFactory.java:92)
at org.jboss.resource.connectionmanager.BaseConnectionManager2.getSubject(BaseConnectionManager2.java:687)
at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:495)
at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:941)
at org.jboss.resource.adapter.jms.JmsSessionFactoryImpl.allocateConnection(JmsSessionFactoryImpl.java:395)
at org.jboss.resource.adapter.jms.JmsSessionFactoryImpl.createSession(JmsSessionFactoryImpl.java:374)
at MySLSB.addToMyQueue(MySLSB.java:103)
Have I done something wrong?
Thanks.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/576154#576154]
Start a new discussion in JBoss Messaging at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 6 months
[JBoss Tools] - Beginner question Input Type ArrayList
by Diego Gusava
Diego Gusava [http://community.jboss.org/people/diegogusava] created the discussion
"Beginner question Input Type ArrayList"
To view the discussion, visit: http://community.jboss.org/message/576141#576141
--------------------------------------------------------------
I have smooks-config.xml, and the param "input.java" is "example.srcmodel.Order" , but i want pass a ArrayList<Order> and receive a ArrayList<OrderLine>. Its possible? If yes, how ? Thanks.
<?xml version="1.0" encoding="UTF-8"?><smooks-resource-list xmlns="http://www.milyn.org/xsd/smooks-1.1.xsd" xmlns:ftl="http://www.milyn.org/xsd/smooks/freemarker-1.1.xsd" xmlns:jb="http://www.milyn.org/xsd/smooks/javabean-1.2.xsd">
<params>
<param name="stream.filter.type">SAX</param>
<param name="inputType">input.java</param>
<param name="input.java" type="input.type.deactived">java.util.ArrayList</param>
<param name="input.java" type="input.type.actived">example.srcmodel.Order</param>
</params>
<jb:bean beanId="LineOrder" class="example.target.LineOrder" createOnElement="example.srcmodel.Order">
<jb:value data="/example.srcmodel.Order/header/customerNumber" property="customeId"/>
<jb:value data="/example.srcmodel.Order/header/customerName" property="customerName"/>
<jb:wiring beanIdRef="lineItems" property="lineItems" wireOnElement="/example.srcmodel.Order/orderItems"/>
<jb:value data="/example.srcmodel.Order/header/priority" decoder="Enum" property="priority">
<jb:decodeParam name="enumType">example.target.LineOrderPriority</jb:decodeParam>
<jb:decodeParam name="IMPORTANT">IMPORTANT</jb:decodeParam>
<jb:decodeParam name="NOTIMPORTANT">NOTIMPORTANT</jb:decodeParam>
<jb:decodeParam name="VERYIMPORTANT">VERYIMPORTANT</jb:decodeParam>
</jb:value>
</jb:bean>
<jb:bean beanId="lineItems" class="java.util.ArrayList" createOnElement="/example.srcmodel.Order/orderItems">
<jb:wiring beanIdRef="LineItem" wireOnElement="/example.srcmodel.Order/orderItems"/>
</jb:bean>
<jb:bean beanId="LineItem" class="example.target.LineItem" createOnElement="/example.srcmodel.Order/orderItems/example.srcmodel.OrderItem">
<jb:value data="/example.srcmodel.Order/orderItems/example.srcmodel.OrderItem/productId" property="productCode"/>
<jb:value data="/example.srcmodel.Order/orderItems/example.srcmodel.OrderItem/price" property="unitPrice"/>
<jb:value data="/example.srcmodel.Order/orderItems/example.srcmodel.OrderItem/quantity" property="unitQuantity"/>
</jb:bean>
</smooks-resource-list>
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/576141#576141]
Start a new discussion in JBoss Tools at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 6 months
[JBoss Messaging] - Changing to Oracle DB fails when using < xa-datasource>
by Eugen Grosu
grosueugen [http://community.jboss.org/people/grosueugen] created the discussion
"Changing to Oracle DB fails when using <xa-datasource>"
To view the discussion, visit: http://community.jboss.org/message/576148#576148
--------------------------------------------------------------
Hello,
I'm using JBoss 5.1.0.GA, jdk 1.6, on Linux
I wanted to use the Oracle DB for messaging, so I started like this:
- created a new schema in Oracle
- creating a new oracle-xa-ds.xml file, using <xa-datasource> (we use distributed transaction because we write into another Oracle DB, while adding to a Queue)
- copied from JBOSS_HOME/docs/examples/jms/oracle-persistence-service.xml to xxx/deploy/messaging/oracle-persistence-service.xml.
- replaced DefaultDS with MyOracleDS in all 3 places
- deleted xxx/deploy/messaging/hsqldb-persistence-service.xml
When starting JBoss, the error was:
=> java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist
After adding in jboss-log4j.xml
<category name="org.jboss.messaging">
<priority value="DEBUG"/>
</category>
=> CREATE TABLE JBM_MSG (MESSAGE_ID INTEGER, RELIABLE CHAR(1), EXPIRATION INTEGER, TIMESTAMP INTEGER, PRIORITY INTEGER, TYPE INTEGER, HEADERS BLOB, PAYLOAD BLOB, PRIMARY KEY (MESSAGE_ID))
java.sql.SQLSyntaxErrorException: ORA-02089: COMMIT is not allowed in a subordinate session
So, what I did was to replace <xa-datasource> with <local-datasource>, and it worked fine: all tables were added to the Oracle schema.
Afterwords, I put all "CreateTablesOnStartup" to false oracle-persistence-service.xml and put back <xa-datasource>.
I did a test, and it adds messages successfully to the Oracle DB.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/576148#576148]
Start a new discussion in JBoss Messaging at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 6 months
[Datasource Configuration] - Stop mySQL DataSource from showing info in the console
by Sergiu Pienar
Sergiu Pienar [http://community.jboss.org/people/sergiu_pienar] created the discussion
"Stop mySQL DataSource from showing info in the console"
To view the discussion, visit: http://community.jboss.org/message/576105#576105
--------------------------------------------------------------
When I use a JBoss DS , I always get information about what is happening with the dataSource.
Example :
10:54:43,875 ERROR [STDERR] Wed Dec 15 10:54:43 GMT 2010 DEBUG: Executing XA statement: XA START 0x312d2d33663537316636303a3935313a34643038396363633a336166,0x2d33663537316636303a3935313a34643038396363633a343338,0x20003
10:54:50,546 ERROR [STDERR] Wed Dec 15 10:54:50 GMT 2010 DEBUG: Executing XA statement: XA END 0x312d2d33663537316636303a3935313a34643038396363633a336166,0x2d33663537316636303a3935313a34643038396363633a343338,0x20003
10:54:50,562 ERROR [STDERR] Wed Dec 15 10:54:50 GMT 2010 DEBUG: Executing XA statement: XA PREPARE 0x312d2d33663537316636303a3935313a34643038396363633a336166,0x2d33663537316636303a3935313a34643038396363633a343338,0x20003
10:54:50,937 ERROR [STDERR] Wed Dec 15 10:54:50 GMT 2010 DEBUG: Executing XA statement: XA COMMIT 0x312d2d33663537316636303a3935313a34643038396363633a336166,0x2d33663537316636303a3935313a34643038396363633a343338,0x20003
It all completes perfectly fine , but I would like to stop the display of these informations.
How can this be done?
Thank you.
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/576105#576105]
Start a new discussion in Datasource Configuration at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 6 months
[JBoss Messaging] - Need some help on creating a bridge between two queues in the same Jboss server!
by indika peiris
indikap [http://community.jboss.org/people/indikap] created the discussion
"Need some help on creating a bridge between two queues in the same Jboss server!"
To view the discussion, visit: http://community.jboss.org/message/576047#576047
--------------------------------------------------------------
Dear Community,
Need some help on creating a bridge between two queues in the same Jboss server!
I have following two queues I have Java app sending messages to Queue "MyQueueA" and I'm expecting the bridge will bridge messages from "MyQueueA" to "MyQueueB". However I'm getting errors as described below
Queue Names are:
--------------------------
MyQueueA, JNDI Name : /queue/MyQueueA
MyQueueB, JNDI Name : /queue/MyQueueB
I'm using the following config To create Bridge. And the file copied to <Jboss_soa_502GA>jboss-as\server\default\deploy
<mbean code="org.jboss.jms.server.bridge.BridgeService"
name="jboss.messaging:service=Bridge,name=TestBridgeQueueAtoB"
xmbean-dd="xmdesc/Bridge-xmbean.xml">
<depends optional-attribute-name="SourceProviderLoader">jboss.messaging:service=JMSProviderLoader,name=DefaultJMSProvider</depends>
<depends optional-attribute-name="TargetProviderLoader">jboss.messaging:service=JMSProviderLoader,name=DefaultJMSProvider</depends>
<attribute name="SourceDestinationLookup">/queue/MyQueueA</attribute>
<attribute name="TargetDestinationLookup">/queue/MyQueueB</attribute>
<!-- attribute name="SourceUsername">admin</attribute -->
<!-- attribute name="SourcePassword">admin</attribute -->
<!-- attribute name="TargetUsername">admin</attribute -->
<!-- attribute name="TargetPassword">admin</attribute -->
<attribute name="QualityOfServiceMode">1</attribute>
<attribute name="MaxBatchSize">1</attribute>
<attribute name="MaxBatchTime">1000</attribute>
<attribute name="FailureRetryInterval">1000</attribute>
<attribute name="MaxRetries">1</attribute>
</mbean>
I get the following Errors in the server.log.
08:03:10,046 ERROR [MeasurementManager] Could not get measurement values
java.lang.IllegalStateException
: Failed to find [ComponentType{type=JMSDestination, subtype=Queue}] ManagedComponent named [/queue/MyQueueB].at org.rhq.plugins.jbossas5.ManagedComponentComponent.getManagedComponent(
ManagedComponentComponent.java:367)at org.rhq.plugins.jbossas5.ManagedComponentComponent.getValues(
ManagedComponentComponent.java:229)at sun.reflect.NativeMethodAccessorImpl.invoke0(
Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.rhq.core.pc.inventory.ResourceContainer$ComponentInvocationThread.call(
ResourceContainer.java:525)at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
08:03:10,296 ERROR [InventoryManager] Call to getAvailablity() on ResourceComponent for Resource[id=-86, type=Queue, key=/queue/MyQueueB, name=MyQueueB, parent=JBoss AS 5 (default)] failed.
Can someone please help to fix this issue. Your help is greatly appreciated in advance.
Rgds,
IP
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/576047#576047]
Start a new discussion in JBoss Messaging at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
13 years, 6 months