Query Timeout spring xml Parameter - java

I got this bean in my data-access-functions-config.xml:
<bean id="pbfuLinkTrasmissionDao" class="******.zja.dao.stored.StoredDao">
<property name="dataSource" ref="easyDataSource" />
<property name="parameterHandlerManager" ref="parameterHandlerManager" />
<property name="queryTimeout" value="${store.procedure.timeout}" />
<property name="storedDaoConfiguration">
<bean class="******.zja.dao.stored.config.StoredDaoConfiguration">
<property name="spSchema" value="DSVIL" />
<property name="spPackage" value="WAPK_EASY_SERVICE" />
<property name="spName" value="wapr_PolicyCustomerLinkage " />
<property name="storedType" value="PROCEDURE" />
<property name="spParameters">
<list>
My .property file got:
store.procedure.timeout=1
I have problems with this property
<property name="queryTimeout" value="${store.procedure.timeout}" />
The procedure runs for about 5 seconds, but it does not give any timeout.
Am I missing something for this configuration?
The procedure runs well, also the call. I have only to add this queryTimeout. Is right to use this in this way? Do I have to add some others parameters or java parameters?
it does not go in timeout even if i do this:
<property name="queryTimeout" value="1" />

Related

JdbcHttpSessionConfiguration messes my Bean Constants

I am using spring MVC 4.2 I have this code in my app-context.xml
<bean id="beanConstants" name="beanConstants" class="com.my.web.controller.BeanConstants">
<property name="dbProplocation" value="/my/database.properties" />
<property name="extractDbProplocation" value="/my/extract.database.properties" />
<property name="cssLocation" value="uncompiled" />
<property name="enableSuspensionPollingStr" value="false" />
</bean>
<!-- JDBC Session Config -->
<bean class="org.springframework.session.jdbc.config.annotation.web.http.JdbcHttpSessionConfiguration"/>
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="${hibernate.connection.url}" />
<property name="username" value="${hibernate.connection.username}" />
<property name="password" value="${hibernate.connection.password}" />
</bean>
Now this all worked fine until I added the JdbcHttpSessionConfiguration bean. If I take that line out, it works. otherwise I get this:
Caused by: java.lang.IllegalArgumentException:
Could not resolve placeholder 'hibernate.connection.url' in string value "${hibernate.connection.url}"
I am trying to save the sesstion info in the DB. Why is this doing this? What has one got to do with the other?

Method org.postgresql.jdbc3.Jdbc3PreparedStatement.setQueryTimeout(int) is not yet implemented.;

Am New to spring batch. with spring batch job i am inserting data in postgres db then i am getting this error . how to fix this?
Method org.postgresql.jdbc3.Jdbc3PreparedStatement.setQueryTimeout(int) is not yet implemented.; nested exception is java.sql.SQLException: Method org.postgresql.jdbc3.Jdbc3PreparedStatement.setQueryTimeout(int) is not yet implemented.'
This is my datasource code.
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<!-- DB connection properties -->
<property name="driverClass" value="${db.driver:oracle.jdbc.OracleDriver}" />
<property name="jdbcUrl" value="${db.url}" />
<property name="user" value="${db.user:}" />
<property name="password" value="${db.password:}" />
<!-- Pool sizing properties -->
<property name="initialPoolSize" value="${db.pool.initialSize:5}" />
<property name="maxPoolSize" value="${db.pool.maxSize:25}" />
<property name="minPoolSize" value="${db.pool.minSize:0}" />
<property name="maxStatements" value="${db.pool.maxStatements:10}" />
<!-- Connection testing and acquisition properties -->
<property name="maxIdleTime" value="${db.con.maxIdleTime:300}" />
<property name="idleConnectionTestPeriod" value="${db.con.testPeriod:30}" />
<property name="preferredTestQuery" value="${db.con.testQuery:select 1 from dual}" />
<property name="acquireIncrement" value="${db.con.acquireIncrement:5}" />
<property name="acquireRetryAttempts" value="${db.con.retryAttempts:0}" />
<property name="acquireRetryDelay" value="${db.con.retryDelay:3000}" />
<!-- JMX name -->
<property name="dataSourceName" value="Datasource" />
<!-- Debugging options -->
<property name="unreturnedConnectionTimeout" value="${db.con.unreturnedTimeout:0}" />
<property name="debugUnreturnedConnectionStackTraces" value="${db.con.debugUnreturned:false}" />
</bean>
The data source looks OK.... #duffymo, the Oracle driver is the default, but would be overridden by the value of 'db.driver' property if 'db.driver' is specified.
The setTimeout error is thrown by some versions of the PostgreSQL driver because they have not, in fact, implemented setTimeout, so they don't want users thinking the setTimeout actually has any effect.
What version of the PostreSQL driver are you using? Can you share some details of the Spring Batch job? I'm not sure how to prevent Spring from setting the timeout on a PreparedStatement. At a guess, you could set db.con.unreturnedTimeout to 0; I'm thinking that value may be passed to setTimeout; but I'm not sure.

Using messageSelector with AbstractMessageListenerContainer Spring Framework

I want to use messageSelector String which is inside the class AbstractMessageListenerContainer.class and here is the XML Configurations that i am giving.
<bean id="jmsContainer"
class="org.springframework.jms.listener.DefaultMessageListenerContainer">
<property name="autoStartup" value="${listener.setup}" />
<property name="connectionFactory" ref="connectionFactory" />
<property name="destination" ref="paymentResponseQueue" />
<property name="messageListener" ref="myAbstractListener" />
</bean>
<bean id="myAbstractListener"
class="org.springframework.jms.listener.AbstractMessageListenerContainer">
<property name="autoStartup" value="${listener.setup}" />
<property name="connectionFactory" ref="connectionFactory" />
<property name="destination" ref="paymentResponseQueue" />
<property name="messageListener" ref="authorisationResponseHandler" />
<property name="messageSelector" value="JMSCorelationId = 'AMM--AS1-6e07c3092bc94f77a183889ababeabc2'" />
</bean>
After giving this configuration, when i start tomcat, my application is not getting started.
Where as when i give the config as below and start tomcat, i am able to start my application and working as expected. xyzResponseHandler is referencing to Class file where i am implementing
public class xyzResponseHandler implements MessageListener{
}
<bean id="jmsContainer"
class="org.springframework.jms.listener.DefaultMessageListenerContainer">
<property name="autoStartup" value="${listener.setup}" />
<property name="connectionFactory" ref="connectionFactory" />
<property name="destination" ref="paymentResponseQueue" />
<property name="messageListener" ref="xyzResponseHandler" />
</bean>
What wrong i am doing in the First Config. Can you please correct me if i am going in wrong direction. Basically i want to filter the message using messageSelector.
In DefaultMessageListenerContainer the property messageListener should be either a standard JMS MessageListener object or a Spring SessionAwareMessageListener object.
Refer the below spring doc
http://docs.spring.io/spring-framework/docs/3.0.5.RELEASE/api/org/springframework/jms/listener/AbstractMessageListenerContainer.html#setMessageListener(java.lang.Object)
But you are referring to a bean of another ListenerContainer.

How to handle Spring Webservice connection error in the start up?

I'm using JaxWsPortProxyFactoryBean in Spring to connect a SOAP webservice. The problem is that if in the moment of Spring start up the webservice is down (because of network problem). It will cause an Exception and stop the Spring initialization. I don't want this behavior, the application doesn't need to stop only because of a failure with a webservice connection.
Is there any better/correct way using Spring to deal with this problem ?
Here is my current xml context.
<bean id="beanWebServiceSOAP" class="org.springframework.remoting.jaxws.JaxWsPortProxyFactoryBean" lazy-init="true">
<property name="serviceInterface" value="com.company.bean.BeanWebServiceSoap" />
<property name="wsdlDocumentUrl" value="${bean.wsdldocumenturl}" />
<property name="namespaceUri" value="${bean.namespaceuri}" />
<property name="serviceName" value="BeanWebService" />
<property name="portName" value="BeanWebServiceSoap" />
</bean>
Thanks,
Maybe by setting the property 'lookupServiceOnStartup' to false:
<bean id="beanWebServiceSOAP" class="org.springframework.remoting.jaxws.JaxWsPortProxyFactoryBean" lazy-init="true">
<property name="serviceInterface" value="com.company.bean.BeanWebServiceSoap" />
<property name="wsdlDocumentUrl" value="${bean.wsdldocumenturl}" />
<property name="namespaceUri" value="${bean.namespaceuri}" />
<property name="serviceName" value="BeanWebService" />
<property name="portName" value="BeanWebServiceSoap" />
<property name="lookupServiceOnStartup" value="false" />
</bean>

RTMPS , implementation not getting hit from client side

I m trying to implement rtmps on my red5 server. i have added the certificates i.e imported them to a key store and have uploaded them on the server. have enabled rtmps part on red5-core.xml .. This much part i.e
<!-- RTMPS -->
<bean id="rtmpsMinaIoHandler"
class="org.red5.server.net.rtmps.RTMPSMinaIoHandler">
<property name="handler" ref="rtmpHandler" />
<property name="codecFactory" ref="rtmpCodecFactory" />
<property name="rtmpConnManager" ref="rtmpMinaConnManager" />
<property name="keyStorePassword" value="${rtmps.keystorepass}" />
<property name="keystoreFile" value="conf/keystore" />
</bean>
<bean id="rtmpsTransport" class="org.red5.server.net.rtmp.RTMPMinaTransport" init-method="start" destroy-method="stop">
<property name="ioHandler" ref="rtmpsMinaIoHandler" />
<property name="connectors">
<list>
<bean class="java.net.InetSocketAddress">
<constructor-arg index="0" type="java.lang.String" value="${rtmps.host}" />
<constructor-arg index="1" type="int" value="${rtmps.port}" />
</bean>
</list>
</property>
<property name="connectionThreads" value="${rtmp.connect_threads}" />
<property name="ioThreads" value="${rtmp.io_threads}" />
<property name="receiveBufferSize" value="${rtmp.receive_buffer_size}" />
<property name="sendBufferSize" value="${rtmp.send_buffer_size}" />
<!-- This is the interval at which the sessions are polled for stats. If mina monitoring is not
enabled, polling will not occur. -->
<property name="jmxPollInterval" value="1000" />
<property name="tcpNoDelay" value="${rtmp.tcp_nodelay}" />
</bean>
The problem is when i try to hit my server with
rtmps://mysite:8443/red5server
I dont get a hit on my server. If as rtmps is not running at all. Any help or tutorial on configuring rtmps will be a grat help.

Categories

Resources