[jboss-user] [Security & JAAS/JBoss] - Cannot update the DB from an EJB MDB, help!!

beherenow do-not-reply at jboss.com
Fri Feb 8 03:31:08 EST 2008


Hello,

I have a web application which must recive messages from TWINCAT and, depend on message, update the database.

I am working with Hibernate, and I never had any problem to read, insert or update from the controller. Now, from the EJB, the class Message driven Bean reads okay but it’s impossible to update the DB. Cannot execute the update method and there aren’t any exceptions or errors… simply not update.

I tried 2 possible but no good solutions:

1.	Adding a file “server.policy” at {jboss.home}/server/default/conf with the code:
<!-- ….. 
//Permisos requeridos para Hibernate

 grant codeBase "file:/C:/jboss/server/default/deploy/my_application.ear"{
   permission java.util.PropertyPermission "*", "read,write";
   permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
   permission java.lang.RuntimePermission "accessDeclaredMembers";
   permission java.lang.RuntimePermission "getProtectionDomain";
 };

 grant codeBase "file:/C:/jboss/server/default/deploy/ my_application.ear/-"{
   permission java.util.PropertyPermission "*", "read,write";
   permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
   permission java.lang.RuntimePermission "accessDeclaredMembers";
   permission java.lang.RuntimePermission "getProtectionDomain";
 };

2.	Adding an ejb-jar.xml file in the meta-inf of application ear (built) and in the folder src and at classes (when built) of the ejb.jar. The code:
<?xml version="1.0"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN" "http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd">

<ejb-jar>
    <enterprise-beans>
        
            <ejb-name>MyBean</ejb-name>
            <!-- ... -->
            <security-identity>
                <run-as>
                    A private internal role
                    <role-name>Manager</role-name>
                </run-as>
            </security-identity>
        
        
            <ejb-name>My2Bean</ejb-name>
            <!-- ... -->
            <security-identity>
                <run-as>
                    A private internal role
                    <role-name>Manager</role-name>
                </run-as>
            </security-identity>
        
    </enterprise-beans>
    <!-- ... -->

    <assembly-descriptor>
        <method-permission>
            
            <role-name>Manager</role-name>
            
                <ejb-name>MyBean</ejb-name>
                <method-name>*</method-name>
            
        </method-permission>
    </assembly-descriptor>
</ejb-jar>


The result of this it’s the same, impossible to update the database.

Thanks


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4127697#4127697

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4127697




More information about the jboss-user mailing list