Announcement Announcement Module
Collapse
No announcement yet.
Using SLSB's on different weblogic instances Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using SLSB's on different weblogic instances

    Hi,

    I'm really new to spring and I hadn't encountered any serious problem using it until today... there's a first time for everything I guess :?

    I'm using different "base services" (as we call them in my company, they are in fact SLSB's) that are deployed on different weblogic instances.

    So, I'm defining 2 SimpleRemoteStatelessSessionProxyFactoryBean in my applicationContext.xml with the proper jndi names and environment properties. Everything (creating the beans, performing lookup,..) is going fine until I finally make use of those SLSB's. It seems that one of the SLSB's is trying to use jndi environment properties from the other SLSB (like java.naming.security.principal) and as they're not the same, I got a java.lang.SecurityException.

    When using them apart, everything is ok... the problem occurs only when the 2 SLSB's are defined at the same time (even if I only make use of only one).

    Maybe something is wrong with the jndi stuff ?

    applicationContext.xml
    Code:
    <bean id="service1"
        class="...SimpleRemoteStatelessSessionProxyFactoryBean">
      <property name="jndiEnvironment">
        <props>
          <prop
              key="java.naming.factory.initial">
            weblogic.jndi.WLInitialContextFactory
          </prop>
          <prop key="java.naming.provider.url">t3&#58;//server1&#58;7215</prop>
          <prop key="java.naming.security.principal">user1</prop>
          <prop key="java.naming.security.credentials">pw1</prop>
        </props>	
      </property>
      <property name="jndiName">
        <value>ejb/service1</value>
      </property>
      <property name="businessInterface">
        <value>...Service1</value>
      </property>
    </bean>
    	
    <bean id="employerIdentifier"
        class="...SimpleRemoteStatelessSessionProxyFactoryBean">
      <property name="jndiEnvironment">
        <props>
          <prop
              key="java.naming.factory.initial">
            weblogic.jndi.WLInitialContextFactory
          </prop>
          <prop key="java.naming.provider.url">t3&#58;//server2&#58;7027</prop>
          <prop key="java.naming.security.principal">user2</prop>
          <prop key="java.naming.security.credentials">pw2</prop>
        </props>	
      </property>
      <property name="jndiName">
        <value>ejb/service2</value>
      </property>
      <property name="businessInterface">
        <value>...Service2</value>
      </property>
    </bean>
    Any help would be greatly appreciated!

    Thanks a lot!

  • #2
    I've been digging a little more (wihtout spring) and it seems that it is impossible to have multiple javax.naming.Context at the same time...

    if I do something like this:

    Code:
    initialize context 1 &#40;url=L1, user=U1, password=P1&#41;
    initialize context 2 &#40;url=L2, user=U2, password=P2&#41;
    
    context2.lookup&#40;something&#41;
    context1.lookup&#40;somethingElse&#41; throws java.lang.SecurityException &#91;Security&#58;090398&#93;Invalid Subject&#58; principals=&#91;U2&#93;
    somehow, the context1's java.naming.security.principal has been overwritten with the one contained in context2...

    So, I suppose that spring is not fautive... but does any J2EE god know some trick to avoid the problem?

    thanks!

    Comment

    Working...
    X