10 Replies Latest reply: Dec 4, 2008 3:06 AM by 673428 RSS

    Deployment Plan / weblogic-ejb-jar.xml:  Problem

    673428
      Hello,

      I am trying to use a deployment plan to override the principal name in the weblogic-ejb-jar.xml.

      The deployment-plan looks like this (showing only the important sections)

      <variable-definition>
      <variable>
      <name>SecurityRoleAssignment_ejbRole_PrincipalNames_1</name>
      <value>MY PRINCIPAL 1</value>
      </variable>
      ...
      </variable-definition>

      .....
      <variable-assignment>
      <name>SecurityRoleAssignment_ejbRole_PrincipalNames_1</name>
      <xpath>/weblogic-ejb-jar/security-role-assignment/[role-name="View-Role"]/externally-defined</xpath>
      <operation>replace</operation>
      </variable-assignment>

      ...

      The security-role assignment in the weblogic-ejb-jar.xml looks like this:

      <security-role-assignment>
      <role-name>View-Role</role-name>
           <externally-defined/>
      </security-role-assignment>

      I 've tried to override the element-value of <externally-defined> (a valid tag in the weblogic-ejb-jar.xml ) with help of a deployment-plan.

      When trying to deploy my application (which is organised in the directory-structure: inst_dir/APP inst_dir/PLAN
      the following error occurs:

      VALIDATION PROBLEMS WERE FOUND problem: cvc-complex-type.2.4a: Expected element 'principal-name@http://www.bea.com/ns/weblogic/10.0' instead of 'externally-defined@http://www.bea.com/ns/weblogic/10.0' here in element security-role-assignment@http://www.bea.com/ns/weblogic/10.0:

      This has surprised me, as externally-defined is (according to the documentation) a valid tag.

      I have tried to replace <externally-defined> with an empty <principal-name> tag (which works fine when deploying the application), but causes a security exception, when trying to use the EJB.

      Has anybody an idea if there is a workaround for this problem?

      IMHO the Validatio Problem is not justified at this place then why should an otherwise valid weblogic-ejb-jar.xml (when not using a deployment-plan) suddenly become invalid when a deployment plan is used?

      Thanx a lot in advance!

      Edited by: user10672779 on 02.12.2008 04:09
        • 1. Re: Deployment Plan / weblogic-ejb-jar.xml:  Problem
          david.karr
          Could you show the beginning of your weblogic-ejb-jar.xml file, including the namespace declaration?
          • 2. Re: Deployment Plan / weblogic-ejb-jar.xml:  Problem
            673428
            Hi,

            The NS Declaration of the plan.xml is:

            <deployment-plan xmlns="http://www.bea.com/ns/weblogic/90" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-deployment-plan.xsd">


            The Declaration in the weblogic-ejb-jar.xml is:

            <weblogic-ejb-jar
                 xmlns="http://www.bea.com/ns/weblogic/90"
                 xmlns:j2ee="http://java.sun.com/xml/ns/j2ee"
                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-ejb-jar.xsd">

            The Target Environment is Weblogic Server 10.0.

            Hope this helps.

            Thanx a lot.
            • 3. Re: Deployment Plan / weblogic-ejb-jar.xml:  Problem
              david.karr
              I don't know if it will make a difference, but you might as well use the 10.x schemas instead of the 9.x schemas (where, oddly enough, the version number in the namespace for this file appears to be "1.0" instead of "10.0", for some unknown reason). Look here for that documentation.
              • 4. Re: Deployment Plan / weblogic-ejb-jar.xml:  Problem
                673428
                Hi again,

                I tried it with the weblogic 10 Namespace Declaration but got then this error:

                failed to load java type corresponding to e=weblogic-ejb-jar@http://www.bea.com/ns/weblogic/weblogic-ejb-jar/1.0/weblogic-ejb-jar.xsd


                and following Exception:

                <02.12.2008 20.00 Uhr CET> <Error> <J2EE> <BEA-160197> <Unable to load descriptor D:\exportapps\tb.ear\app\tb_flowcontrol.jar/META-INF/weblogic-ejb-jar.xml of module tb_flowcontrol.jar. The error is weblogic.descriptor.DescriptorException: Unmarshaller failed
                at weblogic.descriptor.internal.MarshallerFactory$1.createDescriptor(MarshallerFactory.java:152)
                at weblogic.descriptor.BasicDescriptorManager.createDescriptor(BasicDescriptorManager.java:292)
                at weblogic.descriptor.BasicDescriptorManager.createDescriptor(BasicDescriptorManager.java:260)
                at weblogic.application.descriptor.AbstractDescriptorLoader2.getDescriptorBeanFromReader(AbstractDescriptorLoader2.java:774)
                at weblogic.application.descriptor.AbstractDescriptorLoader2.createDescriptorBean(AbstractDescriptorLoader2.java:395)
                at weblogic.application.descriptor.AbstractDescriptorLoader2.loadDescriptorBeanWithoutPlan(AbstractDescriptorLoader2.java:745)
                ...
                ...
                Caused by: com.bea.xml.XmlException: failed to load java type corresponding to e=weblogic-ejb-jar@http://www.bea.com/ns/weblogic/weblogic-ejb-jar/1.0/weblogic-ejb-jar.xsd
                at com.bea.staxb.runtime.internal.UnmarshalResult.getPojoBindingType(UnmarshalResult.java:329)
                at com.bea.staxb.runtime.internal.UnmarshalResult.determineTypeForGlobalElement(UnmarshalResult.java:296)
                at com.bea.staxb.runtime.internal.UnmarshalResult.determineTypeForGlobalElement(UnmarshalResult.java:306)
                at com.bea.staxb.runtime.internal.UnmarshalResult.determineRootType(UnmarshalResult.java:287)
                at com.bea.staxb.runtime.internal.UnmarshalResult.unmarshalDocument(UnmarshalResult.java:153)
                at com.bea.staxb.runtime.internal.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:65)
                at weblogic.descriptor.internal.MarshallerFactory$1.createDescriptor(MarshallerFactory.java:141)


                Searching the net couldn't supply me with another answer as to use the 90 Namespace Declaration again...

                I think I forgot to mention I am using an exploded directory.

                This all seems very strange.

                cheers.
                • 5. Re: Deployment Plan / weblogic-ejb-jar.xml:  Problem
                  david.karr
                  This unhelpful error message likely just says that something in your XML doesn't validate against the schema. If you have a tool that can validate an XML against a schema, do that, and that should help. You should be able to do this in Eclipse.
                  • 6. Re: Deployment Plan / weblogic-ejb-jar.xml:  Problem
                    673428
                    Hi again,

                    I 've tried several tools (eclipse, liquid xml Studio, XMLPad) to validate the weblogic-ejb-jar.xml.
                    Although I can view the xsd in my Browser, I get messages saying, that Schema-Informations for the Element weblogic-ejb-jar (and all the other elements) could not be found.
                    I 've checked all the proxy configurations so that should not be the problem ( I hope) also checking the file with the Weblogic 90 NS-Declaration shows that the validition is working.


                    For today it is enough.

                    Thanks a lot for your support!

                    I will think tomorrow about an alternative way.

                    Enjoy the rest of the day :-)
                    • 7. Re: Deployment Plan / weblogic-ejb-jar.xml:  Problem
                      673428
                      Hi,

                      I managed to validate the weblogic-jar-xml afterall.
                      There is a mistake in the BEA Documentation concerning the NS-Declaration for the weblogic-ejb-jar.xml:

                      The correct declaration is:

                      <weblogic-ejb-jar xmlns="http://www.bea.com/ns/weblogic/weblogic-ejb-jar"
                      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                      xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-ejb-jar/1.0/weblogic-ejb-jar.xsd http://www.bea.com/ns/weblogic/weblogic-ejb-jar/1.0/weblogic-ejb-jar.xsd">

                      This as hint for others as well.

                      Nevertheless, even this valid weblogic-ejb-jar.xml seems not to work, but I will try it tomorrow again.

                      cheers.
                      • 8. Re: Deployment Plan / weblogic-ejb-jar.xml:  Problem
                        673428
                        Hi

                        The problem was solved.
                        The error was found in the Plan.xml and was not in the weblogic-ejb-jar.xml.

                        Thanks to everyone and especially mr. Karr.

                        Cheers

                        Edited by: user10672779 on 03.12.2008 09:35
                        • 9. Re: Deployment Plan / weblogic-ejb-jar.xml:  Problem
                          david.karr
                          What specifically was wrong with it?
                          • 10. Re: Deployment Plan / weblogic-ejb-jar.xml:  Problem
                            673428
                            Hello,

                            The error was that I defined the Variables as:
                            <variable-definition>
                            <variable>
                            <name>SecurityRoleAssignment_ejbRole_PrincipalNames_1</name>
                            <value>MY_VALUE</value>
                            </variable>
                            </variable-definition>

                            The Replacement as:

                            <variable-assignment>
                            <name>SecurityRoleAssignment_ejbRole_PrincipalNames_1</name>
                            <xpath>/weblogic-ejb-jar/security-role-assignment/[role-name="View-Role"]/Principal-Name</xpath>
                            <operation>replace</operation>
                            </variable-assignment>

                            But in my weblogic-ejb-jar.xml this XPATH to Principal-Name did not exist, as I uses <externally-defined> instead.

                            So the correct Assignment is:


                            <variable-assignment>
                            <name>SecurityRoleAssignment_ejbRole_PrincipalNames_1</name>
                            <xpath>/weblogic-ejb-jar/security-role-assignment/[role-name="View-Role"]/externally-defined</xpath>
                            <operation>replace</operation>
                            </variable-assignment>

                            Also a stupid copy/paste error as I used an example with "Principal-Name" as template.

                            That was all.

                            Regards

                            Edited by: user10672779 on 04.12.2008 01:05