I have set my ws config property as below.
connectionTimeOut=10000
readTimeOut=10000
maxConnectionsPerHost=5
maxTotalConnections=20
userName=XXXX
password=XXX
endpoint=https://example.com/XXX.svc
I had my ws context as below:
<property name="messageSender">
<bean class="org.springframework.ws.transport.http.HttpComponentsMessageSender">
<property name="connectionTimeout" value="${connectionTimeOut}" />
<property name="readTimeout" value="${readTimeOut}"></property>
<property name="maxConnectionsPerHost"><map><entry key="${endpoint}" value="${maxConnectionsPerHost}"/></map></property>
<property name="maxTotalConnections" value="${maxTotalConnections}"/>
<property name = "credentials">
<bean class = "org.apache.http.auth.UsernamePasswordCredentials">
<constructor-arg value = "${userName}"/>
<constructor-arg value = "${password}"/>
</bean>
</property>
</bean>``
</property>
When I enter the netstat command as below
netstat -n | grep <ip of XXX.com>
I need to get 5 TCP connections as ESTABLISHED.
For my above configurations I am always getting only 2 TCP connections as ESTABLISHED.
When I tried updating my endpoint as http instead https.I could see 5 TCP connections as ESTABLISHED. However the webservice response is not retrieved and getting an WebServiceTransportException.
Can any one please help me on getting this working.
Thank you in advance.
Related
I'm using Spring Security (well, jasper reports server, that uses Spring security) to connect to a Microsoft AD. But I'm getting a 'bad credentials' in my log but I know the credentials are fine and on my same machine I can use JXplorer to connect to my AD and can use another program to login using this account. The log shows it's connecting, but failing:
Authentication attempt using com.jaspersoft.jasperserver.api.security.externalAuth.wrappers.spring.ldap.JSLdapAuthenticationProvider
Processing authentication request for user: pharmacy
Searching for user 'pharmacy', with user search [ searchFilter: '(sAMAccountName={0})', searchBase: 'OU=Users', scope: subtree, searchTimeLimit: 0, derefLinkFlag: false ]
Got Ldap context on server 'ldap://10.17.188.4:389/dc=harris,dc=local'
Searching for entry under DN 'dc=harris,dc=local', base = 'ou=Users', filter = '(sAMAccountName={0})'
Found DN: cn=pharmacy,ou=Users
Attempting to bind as cn=pharmacy,ou=Users,dc=harris,dc=local
Removing pooling flag for user cn=pharmacy,ou=Users,dc=harris,dc=local
Failed to bind as cn=pharmacy,ou=Users: org.springframework.ldap.AuthenticationException: [LDAP: error code 49 - 8009030C: LdapErr: DSID-0C0903AA, comment: AcceptSecurityContext error, data 532, v1772
Bad credentials
In my AD the user is as follows:
distinguished name: CN=pharmacy,OU=Users,DC=harris,DC=local
My configuration is as follows:
<bean id="ldapAuthenticationProvider" class="com.jaspersoft.jasperserver.api.security.externalAuth.wrappers.spring.ldap.JSLdapAuthenticationProvider">
<constructor-arg>
<bean class="com.jaspersoft.jasperserver.api.security.externalAuth.wrappers.spring.ldap.JSBindAuthenticator">
<constructor-arg>
<ref local="ldapContextSource"/>
</constructor-arg>
<property name="userSearch">
<ref local="userSearch" />
</property>
</bean>
</constructor-arg>
</bean>
<bean id="ldapContextSource" class="com.jaspersoft.jasperserver.api.security.externalAuth.ldap.JSLdapContextSource">
<constructor-arg value="ldap://10.17.188.4:389/DC=harris,DC=local"/>
<property name="userDn" value="CN=ldadmin,OU=Users,DC=harris,DC=local"/>
<property name="password" value="xxxxx"/>
<property name="referral" value="follow" />
</bean>
<bean id="userSearch"
class="com.jaspersoft.jasperserver.api.security.externalAuth.wrappers.spring.ldap.JSFilterBasedLdapUserSearch">
<constructor-arg index="0">
<value>OU=Users</value>
</constructor-arg>
<constructor-arg index="1">
<value>(sAMAccountName={0})</value>
</constructor-arg>
<constructor-arg index="2">
<ref local="ldapContextSource" />
</constructor-arg>
<property name="searchSubtree">
<value>true</value>
</property>
</bean>
I see so many different permutations of config on the internet it's hard to know which to follow. I did have a DefaultLdapAuthoritiesPopulator constructor for the group with the authentication provider but that didn't work either.
Can anyone help? Many thanks.
It seems to have been a VPN issue. The above is fine :)
Leaving in case anyone needs to get Microsoft AD working with Jasper/Spring.
I tried to follow the spring integration SFTP adapter to setup the data feed from local directory to remote site with sftp outbound channel adapter. The feed basically works fine.
But I would like to use cached connection. With the official
guideline for cachingSessionFactory setup:
http://docs.spring.io/spring-integration/reference/html/sftp.html#sftp-session-caching
<bean id="sftpSessionFactory"
class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory">
<property name="host" value="localhost"/>
</bean>
<bean id="cachingSessionFactory"
class="org.springframework.integration.file.remote.session.CachingSessionFactory">
<constructor-arg ref="sftpSessionFactory"/>
<constructor-arg value="10"/>
<property name="sessionWaitTimeout" value="1000"/>
</bean>
But seems even if I have the sftp-session-caching defined, the sftp session will be closed once a file is sent successfully?
Anyone has experience on this?
I'm using Apache camel 2.16.0 and CXF 3.1.2
How can i configure connection pooling (in cxf.xml) for all the http calls so that it can reuse the existing http connection instead of create a new connection every time ?
I see too may TIME_WAIT, CLOSE_WAIT and FIN_WAIT2 for each request, How can i close idle connections ?
<bean id="http" class="org.apache.camel.component.http.HttpComponent">
<property name="camelContext" ref="camel_context" />
<property name="httpConnectionManager" ref="myHttpConnectionManager" />
</bean>
<bean id="myHttpConnectionManager"
class="org.apache.commons.httpclient.MultiThreadedHttpConnectionManager">
<property name="params" ref="myHttpConnectionManagerParams" />
</bean>
<bean id="myHttpConnectionManagerParams"
class="org.apache.commons.httpclient.params.HttpConnectionManagerParams">
<property name="connectionTimeout" value="20000" />
<property name="soTimeout" value="20000" />
<property name="defaultMaxConnectionsPerHost" value="5" />
<property name="maxTotalConnections" value="10" />
</bean>
seems like maxTotalConnections isn't working !
maxTotalConnections is 10 but when i do a load test i can see more than 230 ESTABLISHED connections.. not only this
all the properties like connectionTimeout, soTimeout, defaultMaxConnectionsPerHost are all ignored !
any help is appreciated..
I am new Spring(3.1.2) and JMS. I am trying to consume a JMS message (QUEUE) which is being sent by an ActiveMQ server. I have done the below configuration in Spring xml file.
<bean id="connectionFactory" class="org.apache.activemq.spring.ActiveMQConnectionFactory">
<property name="brokerURL" value="tcp://xx.xx.xxx.144:61616" />
</bean>
<bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate">
<property name="connectionFactory" ref="connectionFactory" />
<property name="defaultDestinationName" value="videovantage-nslij" /> <!-- testQ -->
</bean>
<jms:listener-container connection-factory="connectionFactory" concurrency="1" >
<jms:listener destination="videovantage-nslij" ref="messageReceiver"
method="processMessage" />
</jms:listener-container>
Now I am able to receive JMS messages. But the problem is When i start the JBOSS server(7.1.1) I see two consumers from the same machine. When i do netstat i get the below, notice that activemq port 61616 is listening twice.
TCP xx.xxx.xxx.150:51234 xx.xxx.xxx.144:61616 ESTABLISHED 1044
TCP xx.xxx.xxx.150:51235 xx.xxx.xxx.190:27017 ESTABLISHED 1044
TCP xx.xxx.xxx.150:51236 xx.xxx.xxx.144:61616 ESTABLISHED 1044
Not sure why two consumers are getting created. Any suggestion or guidance will be very helpful. Please let me know if any additional details are required.
Thanks in advance,
Gopi
I am trying to configure a stable connection which doesn't timeout with the embedded ActiveMQ broker. I am using Camel+ActiveMQ+Spring to configure on the server side. In my broker config I have the below config, I have tried setting connectionTimeOut , wireFormat.maxInactivityDuration=0 on the transport connectors but didn't work, I am using StompClient to connect ws://localhost:61614/stomp?useInactivityMonitor=false on the client side. The connection gets established but it times out after 300000ms which seems to be the default idle time but can't turn it off, please help at which level this should be configured to ensure the connections don't get dropped :
<broker id="broker" brokerName="myBroker" useShutdownHook="false" useJmx="true" dataDirectory="activemq-data"
xmlns="http://activemq.apache.org/schema/core">
<transportConnectors>
<!-- vm transport for intra-jvm communication-->
<transportConnector name="vm" uri="vm://myBroker?transport.useInactivityMonitor=false"/>
<!-- tcp for external communication -->
<transportConnector name="tcp" uri="tcp://localhost:61616?transport.useInactivityMonitor=false"/>
<transportConnector name="ws" uri="ws://localhost:61614??transport.useInactivityMonitor=false"/>
<transportConnector name="stomp" uri="stomp://localhost:61613?transport.useInactivityMonitor=false"/>
</transportConnectors>
</broker>
<bean id="jmsConnectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL" value="vm://myBroker?create=false&waitForStart=5000" />
</bean>
<bean id="pooledConnectionFactory"
class="org.apache.activemq.pool.PooledConnectionFactory" init-method="start" destroy-method="stop">
<property name="maxConnections" value="12" />
<property name="connectionFactory" ref="jmsConnectionFactory" />
<property name="idleTimeout" value="120000" />
</bean>
<bean id="jmsConfig"
class="org.apache.camel.component.jms.JmsConfiguration">
<property name="connectionFactory" ref="pooledConnectionFactory"/>
<property name="concurrentConsumers" value="12"/>
<property name="idleConsumerLimit" value="120000"/>
</bean>
<bean id="activemq"
class="org.apache.activemq.camel.component.ActiveMQComponent">
<property name="configuration" ref="jmsConfig"/>
</bean>
Getting this in the log while disconnecting :
WebSocketConnectionRFC6455 DEBUG ClosedOut WebSocketServletConnectionRFC6455 p=WebSocketParserRFC6455#3565d22 state=OPCODE buffer=null g=WebSocketGeneratorRFC6455#309b59a6 closed=false buffer=-1 1000 Idle for 300074ms > 300000ms
It turned out to be the Jetty under the ActiveMQ causing this issue. It has a default idle time out of 300000ms, setting the transport connector as below increased the time out to the set value, setting it to '0' doesn't disable the inactivity monitor as it's suggested for "wireFormat.maxInactivityDuration=0", and using the "wireFormat.maxInactivityDuration=0" alone doesn't work either :
<transportConnectors>
<!-- vm transport for intra-jvm communication-->
<transportConnector name="vm" uri="vm://myBroker"/>
<transportConnector name="ws" uri="ws://localhost:61614?websocket.maxIdleTime=7200000"/>
</transportConnectors>
on the client side, I have the matching URL just in case : "ws://localhost:61614?maxIdleTime=7200000".
Couldn't find this in the regular ActiveMQ documentation or anywhere else. It would be nice to see the docs updated for this scenario.