Hello
A third party are sending text data through websphere mq into one of two queues. I am charged with retrieving the data and loading it into an oracle database.
With this in mind I have opened a discourse elesewhere on the forum and have reached a given point - special thanks to Lyserg, any mistakes in my code are entirely my own and are probably to do with me not understanding properly.
Anyway.......
I have created an interface like so....
which is implemented in the following...Code:public interface TextMessageDelegate { void onMessage(String text); }
This, I believe is pretty much the sum total of what I require to get the data back, the devil being the the config....Code:public class A2OCardMessage implements TextMessageDelegate { public void onMessage(String cardMessage) { try { // TODO put in the stored procedure stuff here.... System.out.println(cardMessage); }catch (RuntimeException e){ e.printStackTrace(); } } }
My applicationcontext looks like so......
and web.xml has been amended to show like so.....Code:<beans> <!-- MQ definitions --> <bean id="messageBean" class="appl.message.A2OCardMessage"> </bean> <bean id="listener" class="org.springframework.jms.listener.adapter.MesssageListenerAdapter"> <property name="delegate" ref="messageBean"/> </bean> <bean id="container" class="org.springframework.jms.listener.DefaultMessageListenerContainer"> <property name="connectionFactory" ref="connectionFactory"/> <property name="messageListener" ref="listener"/> <property name="destination" ref="requestQueue"/> </bean> <bean id="requestQueue" class="com.ibm.mq.jms.MQQueue" depends-on="connectionFactory"> <property name="baseQueueManagerName" value="ECSTHP01"/> <property name="baseQueueName" value="A2O.EXP.CARD.SIT"/> <property name="targetClient" value="1"/> <property name="persistence" value="-1"/> </bean> <bean id="connectionFactory" class="com.ibm.mq.jms.MQQueueConnectionFactory"> <property name="queueManager" value="ECSTHP01"/> <property name="transportType" value="1"/> </bean> <!-- database definitions --> <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName" value="java:comp/env/jdbc/a2o"/> </bean> <bean id="lwsSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref local="dataSource" /> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.c3p0.minPoolSize">10</prop> <prop key="hibernate.c3p0.maxPoolSize">20</prop> <prop key="hibernate.c3p0.timeout">600</prop> <prop key="hibernate.c3p0.max_statement">10</prop> <prop key="hibernate.generate_statistics">true</prop> <prop key="hibernate.cache.use_query_cache">true</prop> </props> </property> </bean> </beans>
I have an ant build file like so.....to create a .ear file for deploying in websphereCode:<web-app id="WebApp_ID" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <display-name>Display Name</display-name> <context-param> <param-name>contextConfigLocation</param-name> <param-value>applicationContext.xml</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <session-config> <!-- Default to 5 minute session timeouts --> <session-timeout>5</session-timeout> </session-config> <welcome-file-list> <welcome-file>index.html</welcome-file> </welcome-file-list> <resource-ref> <description>Oracle</description> <res-ref-name>jdbc/a2o</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> <res-sharing-scope>Shareable</res-sharing-scope> </resource-ref> </web-app>
Code:<project name="A2OMQCard_Build" default="build_full" basedir="."> <property name="webapp" value="${basedir}/jardir" /> <property name="base" value="A2OMQCardInterface" /> <property name="javaSource" value="${basedir}/src" /> <property name="webSource" value="${basedir}/WebContent" /> <fileset dir="${webSource}/WEB-INF/lib" id="libs"> <include name="com.ibm.mq.jar" /> <include name="com.ibm.mqbind.jar" /> <include name="com.mq.mqjms.jar" /> <include name="commons-logging" /> <include name="connector.jar" /> <include name="dhbcore.jar" /> <include name="fscontext.jar" /> <include name="jms.jar" /> <include name="jmscommon.jar" /> <include name="jndi.jar" /> <include name="jta.jar" /> <include name="ldap.jar" /> <include name="log4j-1.2.11.jar" /> <include name="ojdbc14.jar" /> <include name="providerutil.jar" /> <include name="rmm.jar" /> <include name="spring.jar" /> </fileset> <!-- Production Build --> <target name="build_full" depends="javac_src,support_files,create_war"> <ear destfile="${base}.ear" appxml="${basedir}/EarContent/META-INF/application.xml"> <fileset dir="${basedir}" includes="*.war" /> </ear> </target> <target name="support_files" depends="setup"> <copy todir="${webapp}/META-INF"> <fileset dir="${webSource}/META-INF" /> </copy> <copy todir="${libDir}"> <fileset id="libs" dir="${webSource}/WEB-INF/lib"/> </copy> <copy file="${webSource}/WEB-INF/web.xml" todir="${webapp}/WEB-INF" /> <copy todir="${webapp}/WEB-INF/classes"> <fileset dir="${basedir}/src"> <include name="*.xml" /> <include name="*.properties" /> </fileset> </copy> <copy todir="${webapp}/WEB-INF/classes/appl/business"> <fileset dir="${basedir}/src/appl/business"> <include name="*.xml" /> <include name="*.properties" /> </fileset> </copy> </target> <!-- set global properties for this build --> <target name="setup" if="webapp"> <property name="sourceDir" value="${basedir}/src" /> <property name="utilsDir" value="${webapp}/WEB-INF/utils" /> <property name="outputDir" value="${webapp}/WEB-INF/classes" /> <property name="libDir" value="${webapp}/WEB-INF/lib" /> <mkdir dir="${webapp}" /> <mkdir dir="${sourceDir}" /> <mkdir dir="${utilsDir}" /> <mkdir dir="${outputDir}" /> <mkdir dir="${libDir}" /> </target> <!-- Clean all directories --> <target name="clean"> <delete failonerror="false" description="clean up"> <fileset file="${base}.war" /> <fileset file="${base}.ear" /> <fileset file="${webapp}/*.jsp" /> <fileset file="${webapp}/WEB-INF/web.xml" /> <fileset dir="${webapp}/WEB-INF/classes" /> <fileset dir="${webapp}/WEB-INF/utils" /> <fileset dir="${webapp}/WEB-INF/src" /> <fileset file="${webapp}/WEB-INF/lib/*.*" /> </delete> </target> <!-- Set the javac classpath --> <path id="compile.classpath"> <fileset id="libs" dir="${webSource}/WEB-INF/lib"/> </path> <target name="javac_src" depends="setup" description="compile the src "> <javac srcdir="${sourceDir}" destdir="${outputDir}" source="1.4"> <classpath refid="compile.classpath" /> </javac> </target> <!-- Package the files into a Web Application --> <target name="create_war" if="webapp" description="build the war file "> <jar destfile="${base}.war" basedir="${webapp}" defaultexcludes="yes"> <exclude name="**/lib/*"/> </jar> </target> </project>
Firstly could someone quickly run an eye over what I have done to confirm if I am on the right tracks..and secondly when I deploy the .ear file I am getting the following error.....
Code:AppDeploymentException: [null] com.ibm.etools.j2ee.commonarchivecore.exception.DeploymentDescriptorLoadException: IWAE0022E Exception occurred loading deployment descriptor for module "A2OMQInterface.war" in EAR file "/hosting/configs/WebSphereD01/DeploymentManager/profiles/Dmgr_CD01/wstemp/0/upload/A2OMQCardInterface.ear"
Could someone help me to sort this out....
Thanks in advance


Reply With Quote