I have a RMI client/server configuration created with Spring 3.0.
When client and server run on the same machine at the url:
rmi://localhost:1099/myService
everything is ok. When I run the client on a different machine (server run now on 192.168.1.67) and the client "points" to:
rmi://192.168.1.67:1099/myService
I can see this error message from the client:
org.spring...RmiClientInterceptor handlerRemoteConnectFailure.
Could not connect to Rmi Service [rmi://192.1681.67:1099/myService]
The server is configured in this way:
<bean id="myService" class="org.springframework.remoting.rmi.RmiServiceExporter">
<property name="service" ref="myService"/>
<property name="serviceInterface" value="org.myapp.MyService"/>
<property name="serviceName" value="myService"/>
<property name="alwaysCreateRegistry" value="true"/>
</bean>
<bean id="myService" class="org.myapp.MyServiceImpl" />
and the client:
RmiProxyFactoryBean rpfb = new RmiProxyFactoryBean();
rpfb.setServiceInterface(MyService.class);
rpfb.setLookupStubOnStartup(true);
rpfb.setRefreshStubOnConnectFailure(true);
RMICustomClientSocketFactory socketFactory = new RMICustomClientSocketFactory();
socketFactory.setTimeout(5000);
rpfb.setRegistryClientSocketFactory(socketFactory);
rpfb.setServiceUrl(getRmiUrl(address, port));
rpfb.afterPropertiesSet();
I checked with a sniffer the port 1099 of the server, and when the client starts its process I can see some data "dispatched" on the server side:
JRMI..K
...192.168.1.65..
..192.168.1.65....
P....w"..........................D.M...;.t..myService
Q....w.....e...7B+#5..s}.....5org.springframework.remoting.rmi.RmiInvocationHandlerpxr..java.lang.reflect.Proxy.'. ..C....L..ht.%Ljava/lang/reflect/InvocationHandler;pxpsr.-java.rmi.server.RemoteObjectInvocationHandler...........pxr..java.rmi.server.RemoteObject.a...a3....pxpw2.
UnicastRef..127.0.1.1..../.T~.X.....e...7B+#5...x
R
S
T...e...7B+#5..
My question is: Why if client & server run on the same machine, everything is ok but on different machines I get this problem? and how to fix it?
I run the server on windows and client on linux (ubuntu) and everything was ok.
When I run the server on linux and client on windows I get the problem.
To fix it on linux just run the server with: -Djava.rmi.server.hostname=192.168.1.67.
Related
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 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.
We have a web application in Java (Spring Framework). For authentication and user management, we are using SSO with LDAP.
The LDAP context is as defined in the bean below:
<bean id="legacyLdapContext" class="org.springframework.ldap.core.support.LdapContextSource">
<property name="url" value="ldaps://aaa.bbb.ccc.edu:636"/>
<property name="base" value="cn=Users,dc=bbb,dc=ccc,dc=edu"/>
<property name="userDn" value="user"/>
<property name="password" value="*****"/>
<property name="pooled" value="true"/>
<property name="baseEnvironmentProperties">
<map>
<entry>
<key>
<value>java.naming.security.authentication</value>
</key>
<value>simple</value>
</entry>
<entry key="java.naming.referral">
<value>ignore</value>
</entry>
</map>
</property>
</bean>
Everything works fine, but the connection/queries are very slow.
If the same configuration is changed to non ssl (`ldap://aaa.bbb.ccc.edu:389') it is lightening fast. A query that takes the non SSL context just a few seconds, takes the SSL context 7 minutes.
Is there any LDAPS related configuration missing? I have installed the certificate to JVM using the steps here http://javacolors.blogspot.in/2012/05/how-to-register-ssl-certificates-in.html .
To force the JVM to pool SSL connections, add the following line to your Apache Tomcat /bin/setenv.sh ({{setenv.bat}} for Windows) file
On Linux:
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.jndi.ldap.connect.pool.protocol='plain ssl' -Dcom.sun.jndi.ldap.connect.pool.authentication='none simple DIGEST-MD5'"
On Windows:
JAVA_OPTS=%JAVA_OPTS% -Dcom.sun.jndi.ldap.connect.pool.protocol="plain ssl" -Dcom.sun.jndi.ldap.connect.pool.authentication="none simple DIGEST-MD5"
https://confluence.atlassian.com/display/CROWDKB/Performance+problem+when+using+LDAPS
GridGain using yardstick on using TcpDiscoverySpi on aws ec2 instances launched into a VPC cant form a cluster. what setting should i be looking at ? thanks
my xml config
<property name="discoverySpi">
<bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
<property name="ipFinder">
<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
<property name="addresses">
<list>
<value>10.0.0.245</value><value>10.0.0.246</value><value>10.0.0.247</value><value>10.0.0.35</value>
</list>
</property>
</bean>
</property>
</bean>
</property>
some important log lines
ver. 1.0.0#20150329-sha1:5fc2cd05
INFO: OS user: ec2-user
INFO: IGNITE_HOME=/home/ec2-user/yardstick-ignite
INFO: Non-loopback local IPs: 10.0.0.245
INFO: Enabled local MACs: 0A5AEFFFF957
INFO: Successfully bound to TCP port [port=47100, locHost=/127.0.0.1]
INFO: Successfully bound to TCP port [port=47500, localHost=/127.0.0.1]
WARNING: Failed to connect to any address from IP finder (make sure IP finder addresses are correct and firewalls are disabled on all host machines): [/10.0.0.246:47500, /10.0.0.245:47500, /10.0.0.247:475
00, /10.0.0.35:47500]
Jul 13, 2015 7:41:09 PM org.apache.ignite.logger.java.JavaLogger warning
WARNING: Failed to connect to any address from IP finder (make sure IP finder addresses are correct and firewalls are disabled on all host machines): [/10.0.0.247:47500, /10.0.0.245:47500, /10.0.0.35:4750
0, /10.0.0.246:47500]
I am running in an aws VPC using the default security group
where i have opened ports 47000 - 48500 for TCP
my default security group was not configured correctly
and
I also did this
Remove this configuration property.
<property name="localHost" value="127.0.0.1"/>
as this answer says
How to use gridgain with two nodes where each node on its own different host
I am working on ActiveMQ JMS Spring application. I am using ActiveMQ instance which is present in Cloud server and i trying to read message from queue. In a configuration file i have configured broker URL as
<bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
<!-- brokerURL, You may have different IP or port -->
<constructor-arg index="0" value="tcp://ip address:8161" />
</bean>
but when i try to connect it gives me error
Caused by: org.apache.activemq.transport.InactivityIOException: Cannot send, channel has already failed: tcp://ip address:8161
at org.apache.activemq.transport.AbstractInactivityMonitor.doOnewaySend(AbstractInactivityMonitor.java:297)
at org.apache.activemq.transport.AbstractInactivityMonitor.oneway(AbstractInactivityMonitor.java:286)
at org.apache.activemq.transport.TransportFilter.oneway(TransportFilter.java:85)
at org.apache.activemq.transport.WireFormatNegotiator.oneway(WireFormatNegotiator.java:104)
at org.apache.activemq.transport.MutexTransport.oneway(MutexTransport.java:68)
at org.apache.activemq.transport.ResponseCorrelator.asyncRequest(ResponseCorrelator.java:81)
at org.apache.activemq.transport.ResponseCorrelator.request(ResponseCorrelator.java:86)
at org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1409)
... 21 more
Can you please suggest me is am i missing something here?