[JCA/JBoss] - Integration with Oracle AQ via Sun Adapter
by ryandavid
Hello to everybody,
I have to integrate my JBoss 4.0.2 with OracleAQ.
I cannot deploy a JBoss ESB on it because it requires a 4.0.5 at least and I cannot upgrade the server.
So I decided to take the Sun Adapter solution described in the wiki
http://www.jboss.org/community/docs/DOC-9035
So I created an oracleaq-ds.xml like this
| <?xml version="1.0" encoding="UTF-8"?>
| <connection-factories>
|
| <mbean code="org.jboss.resource.deployment.AdminObject" name="jboss.oracleaq:service=Queue,name=msg_queue">
| <attribute name="JNDIName">oracleaq/queue/msg_queue</attribute>
| <depends optional-attribute-name="RARName">jboss.jca:service=RARDeployment,name='oracleaq.rar'</depends>
| <attribute name="Type">javax.jms.Queue</attribute>
| <attribute name="Properties">
| DestinationProperties=owner\=senaprod,name\=FROM_QUEUE
| </attribute>
| </mbean>
|
|
| <!-- JMS XA Resource adapter, use this to get transacted JMS in beans -->
| <tx-connection-factory>
| <jndi-name>jdbc/OracleAQ</jndi-name>
| <rar-name>oracleaq.rar</rar-name>
| <connection-definition>javax.jms.QueueConnectionFactory</connection-definition>
| <config-property name="ConnectionFactoryProperties" type="java.lang.String">host=mydbms,user=scott,password=mypass,port=1521,sid=svil,driver=thin</config-property>
| <config-property name="username" type="java.lang.String">scott</config-property>
| <config-property name="password" type="java.lang.String">mypass</config-property>
| <max-pool-size>20</max-pool-size>
| </tx-connection-factory>
|
| </connection-factories>
and deployed the oracleaq.rar as required.
When I try to get a connection
QueueConnectionFactory queueFactory = QueueConnectionFactory)context.lookup("java:jdbc/OracleAQ");
|
| QueueConnection queueConnection = queueFactory.createQueueConnection();
|
I get this error
javax.jms.JMSException: invalid arguments in call
| at com.sun.genericra.util.ExceptionUtils.newJMSException(ExceptionUtils.java:67)
| at com.sun.genericra.outbound.ConnectionFactory.createConnection(ConnectionFactory.java:80)
| at com.sun.genericra.outbound.ConnectionFactory.createQueueConnection(ConnectionFactory.java:115)
| at it.senato.testjms.FeederServlet.startJMSConnection(FeederServlet.java:69)
| at it.senato.testjms.FeederServlet.process(FeederServlet.java:116)
| at it.senato.testjms.FeederServlet.doGet(FeederServlet.java:95)
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
| at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
| at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
| at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:153)
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
| at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
| at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
| at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
| at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
| at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
| at java.lang.Thread.run(Thread.java:595)
| Caused by: javax.resource.ResourceException: invalid arguments in call
| at com.sun.genericra.util.ExceptionUtils.newResourceException(ExceptionUtils.java:73)
| at com.sun.genericra.outbound.AbstractManagedConnectionFactory.createManagedConnection(AbstractManagedConnectionFactory.java:130)
| at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:508)
| at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:207)
| at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:534)
| at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:395)
| at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:297)
| at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:447)
| at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:874)
| at com.sun.genericra.outbound.ConnectionFactory.createConnection(ConnectionFactory.java:75)
| ... 25 more
| Caused by: oracle.jms.AQjmsException: invalid arguments in call
| at oracle.jms.AQjmsDBConnMgr.checkForSecurityException(AQjmsDBConnMgr.java:926)
| at oracle.jms.AQjmsDBConnMgr.getConnection(AQjmsDBConnMgr.java:605)
| at oracle.jms.AQjmsDBConnMgr.<init>(AQjmsDBConnMgr.java:172)
| at oracle.jms.AQjmsConnection.<init>(AQjmsConnection.java:163)
| at oracle.jms.AQjmsQueueConnectionFactory.createQueueConnection(AQjmsQueueConnectionFactory.java:229)
| at com.sun.genericra.outbound.ManagedQueueConnectionFactory.createConnection(ManagedQueueConnectionFactory.java:60)
| at com.sun.genericra.outbound.AbstractManagedConnectionFactory.createPhysicalConnection(AbstractManagedConnectionFactory.java:141)
| at com.sun.genericra.outbound.AbstractManagedConnectionFactory.createManagedConnection(AbstractManagedConnectionFactory.java:122)
| ... 33 more
|
All the connection parameters are ok. I decompiled some AQ classes but I don't find nothing. Do you have some idea ?
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4211144#4211144
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4211144
17 years, 2 months
[Persistence, JBoss/CMP, Hibernate, Database] - edit data in dataTable
by croco
Hello. I'm new at JSF and this thing and I have a problem. I have a dataTable which in filled with data (userid, first name, last name and email) read from the database and on the userid is a commandLink that opens (with ajax) inputFiels to edit this user (first last name and email). Now the problem I have is that i don't know how to send to the bean this userid, so the bean would know in which row of the database fit the new data.
Here is the code:
jsp file:
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
| <%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
| <%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
| <%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
| <html>
| <head>
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
| <title>Database handle</title>
| </head>
| <body>
| <f:view>
| <center>
| <table border="5">
| <tr><th>Database Handle</th></tr>
| </table>
| <p />
|
| <h:dataTable value="#{databaseBean.linkedList}" var="linkedList" border="3">
|
| <h:column>
| <f:facet name="header">
| <h:outputText value="UserID" />
| </f:facet>
| <h:form>
| <a4j:commandLink action="#{databaseBean.enableEdit}" reRender="enableEdit" >
| <h:outputText value="#{linkedList.userID}" />
| </a4j:commandLink>
| </h:form>
| </h:column>
|
| <h:column>
| <f:facet name="header">
| <h:outputText value="First Name" />
| </f:facet>
| <h:outputText value="#{linkedList.firstName}" />
| </h:column>
|
| <h:column>
| <f:facet name="header">
| <h:outputText value="Last Name" />
| </f:facet>
| <h:outputText value="#{linkedList.lastName}" />
| </h:column>
|
| <h:column>
| <f:facet name="header">
| <h:outputText value="Email" />
| </f:facet>
| <h:outputText value="#{linkedList.email}" />
| </h:column>
|
| </h:dataTable>
| <p />
| <h:form>
| <h:panelGrid id="enableEdit" columns="2" >
| <h:outputText value="Insert new first name: " rendered="#{not empty databaseBean.editData}" />
| <h:inputText value="#{databaseBean.newFirstName}" rendered="#{not empty databaseBean.editData}" />
| <h:outputText value="Insert new last name: " rendered="#{not empty databaseBean.editData}" />
| <h:inputText value="#{databaseBean.newLastName}" rendered="#{not empty databaseBean.editData}" />
| <h:outputText value="Insert new email: " rendered="#{not empty databaseBean.editData}" />
| <h:inputText value="#{databaseBean.newEmail}" rendered="#{not empty databaseBean.editData}" />
| <a4j:commandButton action="#{databaseBean.fireAjax}" value="Send new data" rendered="#{not empty databaseBean.editData}" />
| </h:panelGrid>
| </h:form>
|
| </center>
| </f:view>
| </body>
| </html>
Bean:
package ...;
| import java.sql.*;
| import java.util.LinkedList;
|
| public class DatabaseBean {
| private LinkedList<User> linkedList;
| private String editData;
| private String newFirstName;
| private String newLastName;
| private String newEmail;
|
| public DatabaseBean() {
| try {
| Class.forName("com.mysql.jdbc.Driver").newInstance();
| String host = "...";
| String database = "...";
| String username = "...";
| String password = "...";
| String prefix = "jdbc:mysql://";
| String URL = prefix + host + "/" + database;
| Connection connection = DriverManager.getConnection(URL, username, password);
| Statement statement = connection.createStatement();
| String query = "SELECT * FROM Podatki";
| ResultSet resultSet = statement.executeQuery(query);
| handleData(resultSet);
| connection.close();
| editData = "";
| newFirstName = "";
| newLastName = "";
| newEmail = "";
| }
| catch (ClassNotFoundException cnfe) {
| System.out.println("Error loading driver: " + cnfe);
| } catch (InstantiationException ie) {
| System.out.println("Instantiation error: " + ie);
| } catch (IllegalAccessException iae) {
| System.out.println("Illegal access: " + iae);
| } catch (SQLException sqle) {
| System.out.println("SQL exception: " + sqle);
| }
| }
|
| private void handleData(ResultSet rs) {
| try {
| linkedList = new LinkedList<User>();
| while(rs.next()) {
| linkedList.add(new User(rs.getString(1), rs.getString(2), rs.getString(3), rs.getString(4)));
| }
| }
| catch(SQLException sqle) {
| System.out.println("Error in sql result fied: " + sqle);
| }
| }
|
| public LinkedList<User> getLinkedList() {
| return this.linkedList;
| }
|
| public String getEditData() {
| return editData;
| }
|
| public void setEditData(String editData) {
| this.editData = editData;
| }
|
| /*
| * Ajax
| */
| public String enableEdit() {
| this.editData = "enableEdit";
| this.newFirstName = "...insert new name...";
| this.newLastName = "...insert new last name...";
| this.newEmail = "...insert new email...";
| return null;
| }
|
| public String getNewFirstName() {
| return newFirstName;
| }
|
| public void setNewFirstName(String newFirstName) {
| this.newFirstName = newFirstName;
| }
|
| public String getNewLastName() {
| return newLastName;
| }
|
| public void setNewLastName(String newLastName) {
| this.newLastName = newLastName;
| }
|
| public String getNewEmail() {
| return newEmail;
| }
|
| public void setNewEmail(String newEmail) {
| this.newEmail = newEmail;
| }
|
| /*
| * Ajax
| */
| public String fireAjax() {
| // here is supposed to be the code to set the new values in the db
| System.out.println("hello!");
| return null;
| }
|
| }
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4211130#4211130
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4211130
17 years, 2 months
[Clustering/JBoss] - Re: Problem singleton scheduling in a clustered JBoss 4.02 (
by bstansberry@jboss.com
Looking at the javadoc for the 4.0.2 version of SingleScheduleProvider I don't see a way to pass in the kind of arguments you want:
| /**
| * Sets the method name to be called on the Schedulable MBean. It can optionally be
| * followed by an opening bracket, list of attributes (see below) and a closing bracket.
| * The list of attributes can contain:
| * <ul>
| * <li>NOTIFICATION which will be replaced by the timers notification instance
| * (javax.management.Notification)</li>
| * <li>DATE which will be replaced by the date of the notification call
| * (java.util.Date)</li>
| * <li>REPETITIONS which will be replaced by the number of remaining repetitions
| * (long)</li>
| * <li>SCHEDULER_NAME which will be replaced by the Object Name of the Scheduler
| * (javax.management.ObjectName)</li>
| * <li>any full qualified Class name which the Scheduler will be set a "null" value
| * for it</li>
| * </ul>
| * <br>
| * An example could be: "doSomething( NOTIFICATION, REPETITIONS, java.lang.String )"
| * where the Scheduler will pass the timer's notification instance, the remaining
| * repetitions as int and a null to the MBean's doSomething() method which must
| * have the following signature: doSomething( javax.management.Notification, long,
| * java.lang.String ).
| *
| * @jmx:managed-attribute
| *
| * @param pTargetMethod Name of the method to be called optional followed
| * by method arguments (see above).
| *
| * @throws InvalidParameterException If the given value is not of the right
| * format
| */
| public void setTargetMethod( String pTargetMethod )
Basically you can specify argument types, but what will be passed in will be null, which isn't much use.
In 4.0.3 some changes were made to the scheduling service including a separate config for the argument types versus the argument values. See:
http://docs.jboss.org/jbossas/jboss4guide/r3/html/ch10.html#ch10.sched.sect
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4211121#4211121
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4211121
17 years, 2 months