Liberty Server :It is not valid to call the 'commit' method on a nontransacted session - exception

I'm moving from WAS8 to Liberty. Following is my code:
connection = factory.createConnection();
session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE);
When I run my application it gives error saying:
DetailedIllegalStateException: JMSCC0014: It is not valid to call the 'commit' method on a nontransacted session.
Server.xml
<variable name="wmqJmsClient.rar.location"
value="${server.config.dir}/wmq/wmq.jmsra.rar"/>
<jmsConnectionFactory jndiName="jms/xyz/QCF" >
<properties.wmqJms
transportType="CLIENT"
hostName="host3153.GOT.NET"
port="1414"
channel="CLIENTS.xyz"
queueManager="host141Q"/>
<connectionManager maxPoolSize="10"/>
</jmsConnectionFactory>
<jmsQueue id="jms/queue1" jndiName="jms/xyz/queue/response">
<properties.wmqJms
baseQueueName="host1533A.RESP"
baseQueueManagerName="host141Q" CCSID="1208" expiry="APP" failIfQuiesce="true" persistence="APP" priority="APP" putAsyncAllowed="ENABLED" readAheadAllowed="ENABLED" readAheadClosePolicy="ALL" receiveConversion="QMGR" targetClient="JMS" receiveCCSID="1208" />
</jmsQueue>
<jmsQueue id="jms/queue2" jndiName="jms/xyz/queue/transportAssignment/request">
<properties.wmqJms
baseQueueName="host1533A.RQST"
baseQueueManagerName="host141Q" CCSID="1208" expiry="APP" failIfQuiesce="true" persistence="APP" priority="APP" putAsyncAllowed="ENABLED" readAheadAllowed="ENABLED" readAheadClosePolicy="ALL" receiveConversion="QMGR" targetClient="JMS" receiveCCSID="1208" />
</jmsQueue>

Related

BIML: automatic creation of OleDbDestinations for XMLSource in Dataflow

I'm having a XML file with 2 outputpaths and 2 tables in my staging DB. Tables and outputpaths do have same names.
Instead of writing 2 times OleDbDestination and changing Inputpath and ExternalTableOutput I would like to use some Bimlscript.
My current solution:
<Dataflow Name="DF_MyXml">
<Transformations>
<XmlSource Name="MyXml">
<FileInput ConnectionName="simple.xml" />
<XmlSchemaFileInput ConnectionName="simple.xsd" />
</XmlSource>
<OleDbDestination Name="Database" ConnectionName="Dest">
<InputPath OutputPathName = "MyXml.Database" />
<ExternalTableOutput Table="Database" />
</OleDbDestination>
<OleDbDestination Name="Project" ConnectionName="Dest">
<InputPath OutputPathName = "MyXml.Project" />
<ExternalTableOutput Table="Project" />
</OleDbDestination>
</Transformations>
</Dataflow>
What I would like to achive:
<Dataflow Name="DF_MyXML">
<Transformations>
<XmlSource Name="MyXml">
<FileInput ConnectionName="simple.xml" />
<XmlSchemaFileInput ConnectionName="simple.xsd" />
</XmlSource>
<#foreach (var OutP in ["myXML"].DataflowOutputs) { #>
<OleDbDestination Name="<#=OutP.Name#>" ConnectionName="Dest">
<InputPath OutputPathName = "MyXml.<#=OutP.Name#>" />
<ExternalTableOutput Table="<#=OutP.Name#>" />
</OleDbDestination>
<# } #>
</Transformations>
</Dataflow>
Sadly this isn't working. ;-)
In API-Documentation for AstXMLSourceNode I found the property "DataflowOutputs" which "Gets a collection of all dataflow output paths for this transformation" (sounds promising, uhh?) but I can't even figure out how to reference the XMLSource in Bimlscript in any way.
Starting from RootNode I was able to find my Dataflow-Task but then I got stuck and didn't manage to "find" my Transformations\XMLSource.
Any help would be much appreciated!!
BTW: if there is a solution to automatically create destination-tables based on a given XSD this would be greate too. :-)
You need to make sure your connections are declared in a separate file to be easily accessed in Biml script. You can mess with Console.WriteLine() to print out details about objects to the output window and get a glimpse of what is going on in the BimlScript.
In the second file, traditionally called Environmnet.biml,
you need (only with your xml file connection info, the data here is just a placeholder):
<Connections>
<FileConnection Name="XmlFile" FilePath="C:\test\XmlFile.xml" RelativePath="true" />
<FileConnection Name="XmlXsd" FilePath="C:\test\XmlXsd.Xsd" RelativePath="true" />
</Connections>
then you can do something to the effect of :
var fileConnection = RootNode.Connections["XmlFile"];
(sorry before I accidentally put DbConnections)
and play with it from there. I do not have any xml files at my disposal right now to play around with to help you get the exact information that you are looking for. I will update on Monday.

Hit query on pagination in display tag

I use DisplayTag in my struts2 application and i want to hit query on clicking pagination.
Ex : When user click on the next page or any page then query is fire on action class.
FILE : displayTag.jsp
<display:table name="list1" sort="list" size="20" pagesize="5" id="table1" export="true" requestURI="" partialList="true">
<display:column property="no" group="1" sortable="true" headerClass="sortable"></display:column>
<display:column property="nam" group="2" sortable="true" headerClass="sortable"></display:column>
<display:column property="ct" group="3" sortable="true" headerClass="sortable" autolink="true"></display:column>
<display:setProperty name="export.excel.filename" value="diplayTag.xls"></display:setProperty>
<display:setProperty name="export.pdf.filename" value="diplayTag.pdf"></display:setProperty>
<display:setProperty name="export.csv.filename" value="diplayTag.csv"></display:setProperty>
<display:setProperty name="export.pdf" value="true"></display:setProperty>
</display:table>
I use request.setAttribute("list1", li); where i set all data in list1(ArrayList) and pass to the displayTag.jsp.
DisplayTag get all data and display in the table format. But my need is to pass only 5 data at a time and on clicking next page action class send other 5 data and so on.
I refer link : Display tag pagination problem
But i can not understand because i'm use MySql and also new on DisaplyTag.
DB : MySql
Framework : struts2
After researching and hard working i found answer.
FILE : displayTag.jsp
<display:table name="list1" sort="external" size="20" pagesize="5" id="table1" export="true" requestURI="disTag" partialList="true">
// code as above
</dispaly:table>
here requestURI="disTag" is a action name.
FILE : struts.xml
<action name="disTag" class="className">
<result name="success">/displayTag.jsp</result>
<result name="error">/error.jsp</result>
</action>
FILE : class file
page = Integer.parseInt(request.getParameter((new ParamEncoder("table1").encodeParameterName(TableTagParameters.PARAMETER_PAGE))));
if(page != 0)
{
start = (page - 1) * 5; //5 is row or data per page.
}
getData(start, 5); //getData is a method which store all data in ArrayList. Based on start index.

Spring integration tcp outbound and http inbound don t work properly

Hey I am sitting in front of Spring Integration for several days without speedy progress. Hope you can help me:
My trace:
Client.Input (POJO)
-> Client.[tcp-outbound].defaultserializer
-> Server.[tcp-inbound].defaultserializer
-> Server.[http-outbound] -> transform(POJO-to-Json)
-> Spring MVC Controller : return same POJO (automatic transform to json)
-> Server -> transform(Json-to-POJO)
-> Server -> defaultserializer
-> Client -> defaultserializer
Here the configuration:
Client-Side:
<int:channel id="input" />
<int-ip:tcp-connection-factory id="client"
type="client"
host="192.168.178.28"
port="5678"
serializer="javaSerializer"
deserializer="javaDeserializer"/>
<int-ip:tcp-outbound-gateway id="outboundGateway"
request-channel="input"
connection-factory="client"
request-timeout="10000"
reply-timeout="10000"/>
Server-Side:
<int-ip:tcp-connection-factory id="connectionFactory"
type="server"
port="6000"
serializer="javaSerializer"
deserializer="javaDeserializer"/>
<int-ip:tcp-inbound-gateway id="inboundGateway"
connection-factory="connectionFactory"
request-channel="requestChannel"
reply-channel="outboundChannel"/>
<int:channel id="requestChannel" />
<int:channel id="toMvcChannel" />
<int:channel id="toTcpChannel" />
<int:channel id="outboundChannel" />
<int:object-to-json-transformer input-channel="requestChannel"
output-channel="toMvcChannel"/>
<int:header-enricher input-channel="toMvcChannel">
<int:header name="Content-Type" value="application/json" />
</int:header-enricher>
<int-http:outbound-gateway
url="http://localhost:10100/arx/dataset/receiveGateway"
request-channel="toMvcChannel"
reply-channel="toTcpChannel"/>
<int:json-to-object-transformer input-channel="toTcpChannel"
output-channel="outboundChannel"/>
SimpleGateway:
public interface SimpleGateway {
public DefinitionServer send(DefinitionServer definition);}
I cannot understand why I get the error message below on Client side ON RECEIVE (last step in the routing):
No converter found capable of converting from type [java.lang.String] to type [...DefinitionServer]
Thanks in advance!

Show request in Camel route

Is there any way to log request from body in camel route?
<camel:log message="RequestType [${request.body.request}]" loggingLevel="INFO" />
Error in logs:
Caused by: org.apache.camel.language.simple.types.SimpleParserException: Unknown function: request.body.request
This is working part, but dunno how to get into field :
<camel:log message="RequestType ${in.body}" loggingLevel="INFO" />
<camel:log message="RequestType2 [${body}]" loggingLevel="INFO" />
Request field for sure it's not empty becaue later I'm checking it:
<camel:ognl>request.body.request instanceof ...
Try with
<camel:log message="RequestType [${body.request}]" loggingLevel="INFO" />
The camel:log is using the simple language which you can read more about here: http://camel.apache.org/simple

Session expired on form submit

There is a scenario in which I am having a form which is shown from my application as a pop up dynamically for various events. I am filling up the form and submitting it which causes session expiry.
I found out that when printing the values of the request headers in the form, i see that the jsession id is missing or sometimes new jseesion id is created.
This is not happening frequently. In working cases I am not missing any jsession id or getting differnt jseesion id's.
Any suggestions?
Below is the code sample.
<HTML>
<HEAD>
</HEAD>
<%
Enumeration<String> headerNames = request.getHeaderNames();
while (headerNames.hasMoreElements())
{
String headerName = headerNames.nextElement();
String headerValue = request.getHeader(headerName);
System.out.println("Header Name " +headerName );
System.out.println("headerValue " +headerValue );
}
%>
<body>
Comments </br>
<form name = 'savefrm' action ='save.jsp'>
<textarea name = 'comments' id = 'text' cols=38 rows=8>"+comments.trim()+"</textarea>
<input type="submit" value="ok"/>
</form>
</body>
</html>
You should set your session timeout through web.config like this:
<configuration>
<system.web>
<sessionState timeout="100000"></sessionState>
</system.web>
</configuration>
1000 ms = 1 second
On web.xml file :
<web-app>
<session-config>
<session-timeout>20</session-timeout>
</session-config>
</web-app>
20 = 20 minutes
Or you can do it inside the code :
HttpSession session = request.getSession();
session.setMaxInactiveInterval(20*60);
20 * 60 = 20 minutes