mrklc
Jan 17th, 2005, 09:04 AM
Hi all,
I am new here and I would like to ask a question about the setting of JNDI with the
SimpleRemoteStatelessSessionProxyFactoryBean in a cluster environment.
The question is simple: does Spring support jndi syntax like this: iiop://app1:9081,:app2:9081?
The details of the question is in the following:
Assume that I have the following bean defined in an applicationContext.xml:
<bean id="MyFacade" class="org.springframework.ejb.access.SimpleRemoteStatele ssSessionProxyFactoryBean">
<property name="jndiEnvironment">
<props>
<prop key="java.naming.factory.initial">${javax.naming.Context.INITIAL_CONTEXT_FACTORY}</prop>
<prop key="java.naming.provider.url">${javax.naming.Context.PROVIDER_URL}</prop>
</props>
</property>
<property name="jndiName"><value>ejb/MyFacadeHome</value></property>
<property name="businessInterface"><value>MyFacade</value></property>
</bean>
Both javax.naming.Context.INITIAL_CONTEXT_FACTORY & javax.naming.Context.PROVIDER_URL are defined in a properties file. It
was fine until we move our codes in a cluster environment.
In the cluster, we have 2 app servers which are WebSphere, app1 and app2 and their port for jndi lookup is 9081. In single
server case, my "javax.naming.Context.PROVIDER_URL" would be iiop://app1:9081.
However, in a cluster, if I want to use naming service from both app servers, the url would like this:
iiop://app1:9081,:app2:9081. I read from a WebSphere Red Book to find this syntax but it does not work with the above Spring
configuration and I got the following error:
Initialization of bean failed; nested exception is javax.naming.ConfigurationEx
ception: java.lang.NumberFormatException: 9081,:app2:9081
javax.naming.ConfigurationException: java.lang.NumberFormatException: 9081,:sapp02:9081. Root exception is
java.lang.NumberFormatException: 9081,:sapp02:9081
at java.lang.Integer.parseInt(Integer.java(Compiled Code))
at java.lang.Integer.<init>(Integer.java(Inlined Compiled Code))
at com.ibm.ws.naming.util.WsnInitCtxFactory.parseIiop Url(WsnInitCtxFactory.java(Compiled Code))
at com.ibm.ws.naming.util.WsnInitCtxFactory.parseBoot strapURL(WsnInitCtxFactory.java(Compiled Code))
at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitia lContextInternal(WsnInitCtxFactory.java(Compiled Code))
at com.ibm.ws.naming.util.WsnInitCtx.getContext(WsnIn itCtx.java:102)
at com.ibm.ws.naming.util.WsnInitCtx.getContextIfNull (WsnInitCtx.java(Inlined Compiled Code))
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCt x.java(Compiled Code))
at javax.naming.InitialContext.lookup(InitialContext. java(Compiled Code))
at org.springframework.jndi.JndiTemplate$1.doInContex t(JndiTemplate.java:120)
at org.springframework.jndi.JndiTemplate.execute(Jndi Template.java:85)
at org.springframework.jndi.JndiTemplate.lookup(JndiT emplate.java:117)
at org.springframework.jndi.AbstractJndiLocator.looku p(AbstractJndiLocator.java:169)
at org.springframework.jndi.AbstractJndiLocator.after PropertiesSet(AbstractJndiLocator.java:164)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods
(AbstractAutowireCapableBeanFactory.
java:718)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean
(AbstractAutowireCapableBeanFactory.java:21
3)
at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:159)
at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons
(DefaultListableBeanFactory.java:172)
at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:272)
at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationContext.java:58)
It seems that it treats all chars after the first ":" as port number.
Any idea or work around or I did something totally wrong?
Thanks in advance.
Regards,
KC
I am new here and I would like to ask a question about the setting of JNDI with the
SimpleRemoteStatelessSessionProxyFactoryBean in a cluster environment.
The question is simple: does Spring support jndi syntax like this: iiop://app1:9081,:app2:9081?
The details of the question is in the following:
Assume that I have the following bean defined in an applicationContext.xml:
<bean id="MyFacade" class="org.springframework.ejb.access.SimpleRemoteStatele ssSessionProxyFactoryBean">
<property name="jndiEnvironment">
<props>
<prop key="java.naming.factory.initial">${javax.naming.Context.INITIAL_CONTEXT_FACTORY}</prop>
<prop key="java.naming.provider.url">${javax.naming.Context.PROVIDER_URL}</prop>
</props>
</property>
<property name="jndiName"><value>ejb/MyFacadeHome</value></property>
<property name="businessInterface"><value>MyFacade</value></property>
</bean>
Both javax.naming.Context.INITIAL_CONTEXT_FACTORY & javax.naming.Context.PROVIDER_URL are defined in a properties file. It
was fine until we move our codes in a cluster environment.
In the cluster, we have 2 app servers which are WebSphere, app1 and app2 and their port for jndi lookup is 9081. In single
server case, my "javax.naming.Context.PROVIDER_URL" would be iiop://app1:9081.
However, in a cluster, if I want to use naming service from both app servers, the url would like this:
iiop://app1:9081,:app2:9081. I read from a WebSphere Red Book to find this syntax but it does not work with the above Spring
configuration and I got the following error:
Initialization of bean failed; nested exception is javax.naming.ConfigurationEx
ception: java.lang.NumberFormatException: 9081,:app2:9081
javax.naming.ConfigurationException: java.lang.NumberFormatException: 9081,:sapp02:9081. Root exception is
java.lang.NumberFormatException: 9081,:sapp02:9081
at java.lang.Integer.parseInt(Integer.java(Compiled Code))
at java.lang.Integer.<init>(Integer.java(Inlined Compiled Code))
at com.ibm.ws.naming.util.WsnInitCtxFactory.parseIiop Url(WsnInitCtxFactory.java(Compiled Code))
at com.ibm.ws.naming.util.WsnInitCtxFactory.parseBoot strapURL(WsnInitCtxFactory.java(Compiled Code))
at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitia lContextInternal(WsnInitCtxFactory.java(Compiled Code))
at com.ibm.ws.naming.util.WsnInitCtx.getContext(WsnIn itCtx.java:102)
at com.ibm.ws.naming.util.WsnInitCtx.getContextIfNull (WsnInitCtx.java(Inlined Compiled Code))
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCt x.java(Compiled Code))
at javax.naming.InitialContext.lookup(InitialContext. java(Compiled Code))
at org.springframework.jndi.JndiTemplate$1.doInContex t(JndiTemplate.java:120)
at org.springframework.jndi.JndiTemplate.execute(Jndi Template.java:85)
at org.springframework.jndi.JndiTemplate.lookup(JndiT emplate.java:117)
at org.springframework.jndi.AbstractJndiLocator.looku p(AbstractJndiLocator.java:169)
at org.springframework.jndi.AbstractJndiLocator.after PropertiesSet(AbstractJndiLocator.java:164)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods
(AbstractAutowireCapableBeanFactory.
java:718)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean
(AbstractAutowireCapableBeanFactory.java:21
3)
at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:159)
at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons
(DefaultListableBeanFactory.java:172)
at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:272)
at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationContext.java:58)
It seems that it treats all chars after the first ":" as port number.
Any idea or work around or I did something totally wrong?
Thanks in advance.
Regards,
KC