users@glassfish.java.net

Re: Security Role

From: Art <ainfo_at_patteran.com>
Date: Fri, 02 Jun 2006 12:14:03 -0700

Dennis/Shing,

Thank you both for responding. Right now I have about 18 ejb 3.0
entities in my ejb-jar file, although the ejb-jar file is empty (<ejb/>
namespaces omitted). I tried this on glassfish b48 when I reported my
original error. I used netbeans 5.5 to validate all my deployment
descriptors. As a sanity check I tried deploying everything on JBoss
4.0.4GA, and everything worked. I know that I may be doing something
that is in violation of the spec and JBoss is allowing it anyway, but an
error that would point me in the right direction to fix the problem
would be ideal.

I tried deploying my webapp and ejb outside my ear one again on JBoss
without error, but on glassfish b48 deploying individual webapp/ejb
outside the ear I now the get error below. Unfortunately the error
below also does not give me a hint of what I should try next.

- Art


[#|2006-06-02T11:37:29.343-0700|SEVERE|sun-appserver-pe9.0|javax.enterprise.syst
em.tools.deployment|_ThreadID=11;_ThreadName=Timer-5;_RequestID=6b3fba43-51b3-44
97-a6cc-77e63fbb0181;|Exception occured in J2EEC Phase
com.sun.enterprise.deployment.backend.IASDeploymentException: Deployment
Error -
- null
        at java.util.HashMap$HashIterator.nextEntry(HashMap.java:790)
        at java.util.HashMap$KeyIterator.next(HashMap.java:823)
        at
com.sun.enterprise.deployment.backend.EjbModuleDeployer.generatePolic
y(EjbModuleDeployer.java:203)
        at
com.sun.enterprise.deployment.backend.ModuleDeployer.doRequestFinish(
ModuleDeployer.java:171)
        at
com.sun.enterprise.deployment.phasing.J2EECPhase.runPhase(J2EECPhase.
java:169)
        at
com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(De
ploymentPhase.java:95)
        at
com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhas
es(PEDeploymentService.java:871)
        at
com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDe
ploymentService.java:263)
        at
com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDe
ploymentService.java:281)
        at
com.sun.enterprise.admin.mbeans.ApplicationsConfigMBean.deploy(Applic
ationsConfigMBean.java:534)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at
com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelpe
r.java:353)
        at
com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelpe
r.java:336)
        at
com.sun.enterprise.admin.config.BaseConfigMBean.invoke(BaseConfigMBea
n.java:448)
        at
com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImp
l.java:213)
        at
com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:220)
        at
com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultM
BeanServerInterceptor.java:815)
        at
com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:784
)
        at sun.reflect.GeneratedMethodAccessor20.invoke(Unknown Source)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at
com.sun.enterprise.admin.util.proxy.ProxyClass.invoke(ProxyClass.java
:77)
        at $Proxy1.invoke(Unknown Source)
        at
com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.invoke(Sun
oneInterceptor.java:297)
        at
com.sun.enterprise.deployment.autodeploy.AutoDeployer.invokeDeploymen
tService(AutoDeployer.java:413)
        at
com.sun.enterprise.deployment.autodeploy.AutoDeployer.deploy(AutoDepl
oyer.java:394)
        at
com.sun.enterprise.deployment.autodeploy.AutoDeployer.deployAll(AutoD
eployer.java:253)
        at
com.sun.enterprise.deployment.autodeploy.AutoDeployControllerImpl$Aut
oDeployTask.run(AutoDeployControllerImpl.java:358)
        at java.util.TimerThread.mainLoop(Timer.java:512)
        at java.util.TimerThread.run(Timer.java:462)
|#]



Shing Wai Chan wrote:
> Dennis Gesker wrote:
>> Art:
>>
>> I just posted my logs for Shing-Wai to examine. However, after adding
>> a single session bean (no methods) the app deployed. I guess I don't
>> know enough about how things are supposed to work to know if this is
>> really a bug or just a curious happening.
> Does it means your original test-EJBModule_jar does not have any ejb?
> It is illegal to have an ejb jar without ejb.
>
> Hi Hong,
> Do you remember which build has this fix?
>
> Thanks.
> Shing Wai Chan
>>
>> Dennis
>>
>> Art wrote:
>>> +1 - I had this same error too. I posted the following to nbusers but I
>>> have heard nothing yet.
>>>
>>> Date: Thu, 01 Jun 2006 12:54:27 -0700
>>> From: Art <ainfo_at_patteran.com>
>>> To: nbusers_at_netbeans.org
>>> Subject: error deploying ear : Linked policy contexts have different
>>> roleToSubjectMaps
>>>
>>> Hello,
>>>
>>> I am trying to deploy my application as a ear on glassfish b48 on nb5.5
>>> (20060531200). I am getting the PolicyContextException shown below:
>>>
>>> Exception occured in J2EEC Phase
>>> com.sun.enterprise.deployment.backend.IASDeploymentException: Cannot
>>> generate policy file for test. --
>>> javax.security.jacc.PolicyContextException: java.lang.RuntimeException:
>>> Linked policy contexts have different roleToSubjectMaps
>>> (test/test-WebModule_war)<->(test/test-EJBModule_jar)
>>> at
>>> com.sun.enterprise.security.SecurityUtil.generatePolicyFile(SecurityUtil.java:242)
>>>
>>> at
>>> com.sun.enterprise.deployment.backend.AppDeployerBase.generatePolicy(AppDeployerBase.java:379)
>>>
>>> at
>>> com.sun.enterprise.deployment.backend.AppDeployer.doRequestFinish(AppDeployer.java:130)
>>>
>>> at
>>> com.sun.enterprise.deployment.phasing.J2EECPhase.runPhase(J2EECPhase.java:169)
>>>
>>> at
>>> com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:95)
>>>
>>> at
>>> com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:871)
>>>
>>> at
>>> com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:266)
>>>
>>> at
>>> com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:739)
>>>
>>> at
>>> com.sun.enterprise.management.deploy.DeployThread.deploy(DeployThread.java:174)
>>>
>>> at
>>> com.sun.enterprise.management.deploy.DeployThread.run(DeployThread.java:210)
>>>
>>>
>>> I have set my identical <security-role> in web.xml and application.xml.
>>> I set my EJB class roles as annotations using
>>> @RolesAllowed(value="ROLE1") leaving the ejb-jar.xml file blank. I also
>>> set identical <security-role-mapping> in sun-web.xml and
>>> sun-ejb-jar.xml and sun-application.xml to no avail.
>>>
>>> In this post it is stated we should not do this:
>>>
>>> http://forums.java.net/jive/thread.jspa?threadID=14134&tstart=135
>>>
>>> "In 9.1, we will fail deployment for empty ejb jar with an error message
>>> indicating the cause.
>>>
>>> So if you see this inconsistent module state error, please check your
>>> ejb jar to make sure you have ejbs inside. You should either have an
>>> ejb-jar.xml with all the bean elements defined. Or if you use
>>> annnotations and not having an ejb-jar.xml, your need to have component
>>> level annotations in your bean source code: @Stateless, @Stateful,
>>> @MessageDriven.
>>>
>>> Additional note: persistent unit (@Entity) should not be packaged as ejb
>>> jar(specified as ejb module in the application.xml)."
>>>
>>> My ejb-jar is empty because I use annotations to set the security roles.
>>> How do I get rid of this error? Any help is much appreciated.
>>>
>>> Dennis Gesker wrote:
>>>
>>>> <security-role>
>>>> <role-name>employee</role-name>
>>>> </security-role>
>>>>
>>>> When I add the element above to my application.xml I get a "Linked
>>>> policy contexts have different roleToSubjectMaps" error. This is a
>>>> fresh
>>>> project.
>>>>
>>>> Could someone offer a hint as to what is happening? Shouldn't the
>>>> application.xml cover both my ejb.jar and war files?
>>>>
>>>> Dennis
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>>
>>>
>>
>> --
>> Dennis R. Gesker
>> email: dennis_at_alamon.com
>> gpg key: 0xEFA10A51
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>