Announcement Announcement Module
Collapse
No announcement yet.
SecurityException trying to access remote EJB Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • SecurityException trying to access remote EJB

    Hi,

    I am trying to access a remote EJB with a small Spring-app. The exception and top of the stack trace as well as my bean definitions and code is included below.

    The EJB is deployed on a JBoss AS and the methods should, to my understanding, be executable to the "matrix" user. I guess I am doing something really wrong... I get the feeling that I do not authenticate at all to the JBoss AS? Please contribute with your thought and point me in the right direction. (But I am quite new to Spring, so take it a bit easy with too advanced Spring-stuff ).

    Best regards
    // Rasmus


    My Spring configuration:
    <bean id="jndiTemplate"
    class="org.springframework.jndi.JndiTemplate">
    <property name="environment">
    <props>
    <prop key="java.naming.factory.initial">
    org.jnp.interfaces.NamingContextFactory
    </prop>
    <prop key="java.naming.provider.url">
    195.7.69.102:1099
    </prop>
    <prop key="java.naming.factory.url.pkgs">
    org.jboss.naming:org.jnp.interfaces
    </prop>
    <prop key="java.naming.authoritative">true</prop>
    <prop key="java.naming.security.authentication">simple</prop>

    <prop key="java.naming.security.principal">matrix</prop>
    <prop key="java.naming.security.credentials">xxx</prop>
    </props>
    </property>
    </bean>

    <bean id="customerBeanHome"
    class="org.springframework.jndi.JndiObjectFactoryB ean">
    <property name="jndiTemplate" ref="jndiTemplate" />
    <property name="jndiName">
    <value>se/xxx/ejb/customer/CCustomerBean</value>
    </property>
    </bean>

    <bean id="customerAdder" class="se.xxx.base.CustomerAdder">
    <property name="customerHome">
    <ref local="customerBeanHome" />
    </property>
    </bean>

    And my implementation:
    package se.xxx.base;

    import org.apache.commons.logging.Log;
    import org.apache.commons.logging.LogFactory;

    import se.xxx.ejb.client.customer.CCustomerHome;

    public class CustomerAdder {

    private CCustomerHome customerHome;
    protected final Log logger = LogFactory.getLog(getClass());
    public void add() {
    try {
    // The exception is thrown on the row below!
    customerHome.getAllWithActiveSubscriptions();
    }
    catch(Exception e) {
    e.printStackTrace();
    }
    }

    public void setCustomerHome(CCustomerHome customerHome) {
    this.customerHome = customerHome;
    }
    }

    java.lang.SecurityException: Insufficient method permissions, principal=null, ejbName=CCustomerBean, method=getAllWithActiveSubscriptions, interface=HOME, requiredRoles=[user], principalRoles=[]
    at org.jboss.ejb.plugins.SecurityInterceptor.checkSec urityAssociation(SecurityInterceptor.java:273)
    at org.jboss.ejb.plugins.SecurityInterceptor.invokeHo me(SecurityInterceptor.java:135)
    at org.jboss.ejb.plugins.LogInterceptor.invokeHome(Lo gInterceptor.java:132)
    at org.jboss.ejb.plugins.ProxyFactoryFinderIntercepto r.invokeHome(ProxyFactoryFinderInterceptor.java:10 7)
    at org.jboss.ejb.EntityContainer.internalInvokeHome(E ntityContainer.java:521)
    at org.jboss.ejb.Container.invoke(Container.java:981)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invok e(ReflectedDispatcher.java:155)
    at org.jboss.mx.server.Invocation.dispatch(Invocation .java:94)
    at org.jboss.mx.server.Invocation.invoke(Invocation.j ava:86)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(Ab stractMBeanInvoker.java:264)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanSe rverImpl.java:659)
    at org.jboss.invocation.unified.server.UnifiedInvoker .invoke(UnifiedInvoker.java:231)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.mx.interceptor.ReflectedDispatcher.invok e(ReflectedDispatcher.java:155)
    at org.jboss.mx.server.Invocation.dispatch(Invocation .java:94)
    at org.jboss.mx.server.Invocation.invoke(Invocation.j ava:86)
    at org.jboss.mx.server.AbstractMBeanInvoker.invoke(Ab

  • #2
    Solved

    I solved my problem. I used the wrong Initial Context Factory. By using: org.jboss.security.jndi.JndiLoginInitialContextFac tory everything worked just fine.

    Best regards
    // Rasmus

    Comment

    Working...
    X