users@glassfish.java.net

Re: Security Role

From: Shing Wai Chan <Shing-Wai.Chan_at_Sun.COM>
Date: Fri, 02 Jun 2006 14:14:55 -0700

Art wrote:
> In section 2.1 of EJB 3.0 Simplified API
>
> "Metadata annotations may be used as an alternative to the deployment
> descriptors that were required by
> earlier versions of the Enterprise JavaBeans specification."
>
> My ejb jar file is empty because I use annotations instead.
>
If your ejb jar is empty, then there is no classes there, then how can
you have annotations.
Can you clarify what you mean?
> If I remove my ejb-jar.xml file I get the error:
>
> [#|2006-06-02T13:04:55.796-0700|INFO|sun-appserver-pe9.0|javax.enterprise.system
> .tools.deployment|_ThreadID=11;_ThreadName=Timer-3;|[AutoDeploy]
> Exception occur
> es while invoking backend deployment service for file :
> C:\bin\glassfish\domains\domain1\autodeploy\test-EJBModule.jar. --
> Cannot determine the Java EE module type for
> C:\bin\glassfish\domains\domain1\autodeploy\test-EJBModule.jar -
> - Cannot determine the Java EE module type for
> C:\bin\glassfish\domains\domain1\autodeploy\test-EJBModule.jar|#]
>
> If I leave in the ejb-jar.xml file I get the error listed in my old email.
>
> Do you have any sugestions?
>
> Thanks,
>
> Art
>
> Dennis Gesker wrote:
>
>> Shing-Wai:
>>
>> Exactly right. My original test app did not have any ejbs in the
>> ejb.jar. I didn't realize this was a violation of the spec. As soon as I
>> added the empty session bean the problem cleared up.
>>
>> Dennis
>>
>> 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
>>>
>>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>