1 2 Previous Next 15 Replies Latest reply on Oct 4, 2002 7:26 PM by 101342

    uiXML with Struts: Illegal Access Error

    144413
      I created a project in JDeveloper for the example found in the JDeveloper help documentation, "Using uiXML with Struts". It says I need uix-config.xml in my WEB-INF directory. I created one and copied the xml from the example to it. When I run login.uix from JDeveloper I get:

      500 Internal Server Error

      java.lang.IllegalAccessError: oracle/cabo/servlet/struts/ui/MessageDataProvider
      java.lang.Object oracle.cabo.servlet.struts.ui.DataProviderParserFactory$Parser.getNodeValue(oracle.cabo.share.xml.ParseContext, java.lang.String, java.lang.String, org.xml.sax.Attributes)
      void oracle.cabo.share.xml.LeafNodeParser.startElement(oracle.cabo.share.xml.ParseContext, java.lang.String, java.lang.String, org.xml.sax.Attributes)
      void oracle.cabo.share.xml.TreeBuilder$Handler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
      void oracle.cabo.share.xml.ParserAdapter.startElement(java.lang.String, org.xml.sax.AttributeList)
      void oracle.xml.parser.v2.XMLContentHandler.startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
      XMLContentHandler.java:166
      .
      .
      .

      I notice if I remove that file, I don't get this error, but the struts components do nothing, which seems logical if we do indeed need this configuration information.

      I also notice the following error in JDeveloper when I compile login.uix:

      Warning(11,44): logon.uix: Parsing error, line 11, column 44: <form> is not an understood element.
      This sometimes means the element's namespace (http://xmlns.oracle.com/uix/struts) is set incorrectly. This may also be an issue with the syntax of its parent element.

      I'm not sure what that is.

      Thanks for your help,

      -James
        • 1. re:uiXML with Struts: Illegal Access Error
          101342
          I'm baffled why you're getting the IllegalAccessError. The MessageDataProvider class
          is package-private, but the inner class trying to access it is in the same package;
          the Java code is legit, and "works here". What VM are you using - the oJVM, or a Sun
          VM, or another?

          The later parsing error - about the element-not-understood or namespace problem - is
          happening because of the first errors; the StrutsUIExtension doesn't start up
          correctly, so can't be registered, so its parsing code doesn't get hooked in.
          • 2. re:uiXML with Struts: Illegal Access Error
            144413
            True, that doesn't make sense does it. I'm using JDeveloper 9.0.3 preview of course and using the OJVM. I've tried using the Embedded OC4J Server and deploying to a local instance of the OC4J on my machine...same results. The startup of the Embedded OC4J,

            [Starting OC4J using the following ports: HTTP=8988, RMI=23891, JMS=9227.]
            D:\jdev903\jdk\bin\javaw.exe -ojvm -classpath D:\jdev903\j2ee\home\oc4j.jar -Doracle.j2ee.dont.use.memory.archive=true com.evermind.server.OC4JServer -config D:\jdev903\jdev\system9.0.3.988\oc4j-config\server.xml
            [waiting for the server to complete its initialization...]
            Embedded OC4J startup time: 6860 ms.
            Oracle9iAS (9.0.3.0.0) Containers for J2EE initialized Target URL -- http://192.168.205.91:8988/AddTickler-UIXStrutsLogin-context-root/logon.uix

            , says I'm using ojvm. So I switched the VM to "server" and got:

            java.lang.NoClassDefFoundError: org/apache/struts/action/ActionMessages
            at oracle.cabo.servlet.struts.ui.DataProviderParserFactory$Parser.getNodeValue(Unknown Source)
            at oracle.cabo.share.xml.LeafNodeParser.startElement(Unknown Source)
            at oracle.cabo.share.xml.TreeBuilder$Handler.startElement(Unknown Source)
            .
            .
            .

            hmmm, looks like it can't find the struts.jar. struts.jar is in my WEB-INF/lib directory. It's supposed to find it there, right? Am I missing a classpath somewhere? I'll keep looking.

            Thanks.
            • 3. re:uiXML with Struts: Illegal Access Error
              144413
              Looks like ovjm may be giving me an inaccurate error message too with that IllegalAccessError message. That message may be triggered by the real problem...NoClassDefFoundError.

              Just a guess.
              • 4. re:uiXML with Struts: Illegal Access Error
                168284
                I am waiting with bated breath for your resolution as I am having what appears to be the same problem. I added the runtime Struts via the project settings:libraies route. I am running the OJVM and the embedded OC$J server.
                Bill
                • 5. re:uiXML with Struts: Illegal Access Error
                  101342
                  J2EE classpaths are a very complicated thing.

                  In order for uix2.jar to find struts.jar, struts.jar must be deployed at the same level as
                  uix2.jar or "higher". For example, if uix2.jar is referenced from an OC4J application.xml
                  or server.xml file, but struts.jar is only in WEB-INF/lib, then struts.jar will not be found.
                  To overcome this, you can either move the UIX JAR down into WEB-INF/lib, or move the struts
                  JAR up to the same level as the UIX JAR.

                  Again, classpaths are a major pain in the #%%@! in J2EE, and it's easy to get errors
                  that seem nonsensical if you don't completely grok how Java class loaders work.
                  • 6. re:uiXML with Struts: Illegal Access Error
                    144413
                    That solved the problem! I am relatatively new to
                    all this as are many of us "seasoned developers"...and learning
                    fast...well...sort of.

                    Another observation: I placed the following entry,
                    oracle.cabo.servlet.struts.StrutsUIExtension, in my web.xml file
                    (borrowed from a plain ol' jsp struts test I've been working
                    with). Here's the whole section for the uix servlet:


                    <servlet>
                    <servlet-name>uix</servlet-name>
                    <servlet-class>oracle.cabo.servlet.UIXServlet</servlet-class>
                    <init-param>
                    <param-name>oracle.cabo.servlet.pageBroker</param-name>
                    <param-value>oracle.cabo.servlet.xml.UIXPageBroker</param-value>
                    </init-param>
                    <init-param>
                    <param-name>oracle.cabo.ui.UIExtensions</param-name>
                    <param-value>oracle.cabo.servlet.struts.StrutsUIExtension,oracle.cabo.data.jbo.ui.JboUIExtension</param-value>
                    </init-param>
                    <load-on-startup>1</load-on-startup>
                    </servlet>


                    That solved the parsing errors I was receiving from JDeveloper
                    saying that certain elements were not understood. But
                    then...when I run logon.uix, the browser displayed this lovely
                    error:


                    java.lang.IllegalStateException: ParserFactory already registered at http://xmlns.oracle.com/uix/struts


                    AAAAAAARGHH! Sooooooo...I removed the uix-config.xml from
                    the WEB-INF directory, and hooray! I got my form. Whew!
                    I can also get it to run by leaving my uix-config.xml alone and
                    removing that entry in web.xml. Weird? Anyway, I'm leaving out
                    the entry in uix-config.xml or just not including it for now.
                    I'm sure I'll run in to some other problem with that later :)

                    The little application doesn't work quite right yet. When I
                    click the "Log On" button I get a "Page not found". Must be a
                    typo or something.

                    Anyway, thanks for your help Adam. I'm sure I'll have more
                    questions later. I'll try to make them good ones.

                    -James
                    • 7. re:uiXML with Struts: Illegal Access Error
                      101342
                      That solved the parsing errors I was receiving from JDeveloper
                      saying that certain elements were not understood. But
                      then...when I run logon.uix, the browser displayed this lovely
                      error:
                      java.lang.IllegalStateException: ParserFactory already registered at http://xmlns.oracle.com/uix/struts
                      AAAAAAARGHH! Sooooooo...I removed the uix-config.xml from
                      the WEB-INF directory, and hooray! I got my form. Whew!
                      I can also get it to run by leaving my uix-config.xml alone and
                      removing that entry in web.xml. Weird? Anyway, I'm leaving out
                      the entry in uix-config.xml or just not including it for now.
                      Not so weird: you can register UIExtensions either in WEB-INF/web.xml or WEB-INF/uix-config.xml.
                      If you try to register it in both, you'll get that error (it'd be nice if we detected this
                      and just gave a convenient warning).

                      Registering UIExtensions in uix-config.xml is preferred. I prefer the syntax, and the
                      UIExtensions get registered with somewhat wider scope.
                      • 8. re:uiXML with Struts: Illegal Access Error _continuation
                        168284
                        Adam,
                        I understand that the struts.jar must preceed the uix2.jar in the classpath. I used the projects setting:libraries window and placed the Struts Runtime library higher than the UIX Runtime Library. I also verified that the uix2.jar is in the UIX Runtime Library and that the struts.jar is in the Struts Runtime library. Am I mistaken or should, after rebuilding the project, that should have re-aligned the classpath for the embedded OC4J? I am still recieving the parser problem both in the UIX Preview and when attempting to run teh UIX page.
                        • 9. re:uiXML with Struts: Illegal Access Error _continuation
                          101342
                          Classpath order is irrelevant. [It has never really mattered, unless you happen
                          to define the same class in two different libraries, which isn't the case here,
                          and never should be unless you're hacking around while developing.]

                          What's relevant is the location to which the uix2.jar and struts.jar libraries are
                          getting deployed.
                          • 10. re:uiXML with Struts: Illegal Access Error _continuation
                            168284
                            How do I modify where JDeveloper deploys the library jars when I run using the embedded OC4J? I looked in the Tools:Preferences:OC4j and did not find anything. I examined the XML files in the OC4J-config directory but the help files specifically warn against changing these configuration files.

                            I would like to keep this in the realm of the embedded OC4J because my team is inexperienced and the more i KISS the better it works.
                            • 11. re:uiXML with Struts: Illegal Access Error _continuation
                              101342
                              We've left my area of expertise, I'm afraid. I'll have to ask around.
                              • 12. re:uiXML with Struts: Illegal Access Error _continuation
                                101342
                                But first - have you tried James Cornett's suggestion? Try registering the
                                StrutsUIExtension in WEB-INF/web.xml instead of uix-config.xml, but
                                not in both.

                                (I don't know at all why it would matter - it shouldn't - but he had
                                success, so it's worth a shot.)
                                • 13. re:uiXML with Struts: Illegal Access Error _continuation
                                  168284
                                  I was able to get the UIX Preview to function by using the web.xml vice the uix-config.xml registration. (never did get a conflict in registration even with both in the web-inf directory.)

                                  However, I am having some trouble with the running of the logon.uix. Namely I receive a error:
                                  500 Internal Server Error


                                  java.lang.NoClassDefFoundError: org.apache.struts.action.ActionMessages
                                  java.lang.Object oracle.cabo.servlet.struts.ui.DataProviderParserFactory$Parser.getNodeValue(oracle.cabo.share.xml.ParseContext,
                                  java.lang.String, java.lang.String, org.xml.sax.Attributes)

                                  I have include the struts.jar in the project settings as a user library. (was not certain what was in the struts runtime library). Obviously, a class not found.

                                  What I would like to know is what the mechanism is that the IDE uses to deploy to the embedded OC4j and whether it can be configured? Where can I examine the files the OC4J is running under?
                                  I appreciate your time and effort.

                                  Thanl you
                                  Bill
                                  • 14. re:uiXML with Struts: Illegal Access Error _continuation
                                    101342
                                    I was able to get the UIX Preview to function by using the web.xml vice the uix-config.xml registration.
                                    (never did get a conflict in registration even with both in the web-inf directory.)
                                    The conflict isn't using both web.xml and uix-config.xml - that's totally legal and normal.
                                    You get a problem if you try to register StrutsUIExtension in both. (But I'll have
                                    to check if there's a problem in the UIX Previewer with uix-config.xml.)
                                    However, I am having some trouble with the running of the logon.uix. Namely I receive a error:
                                    500 Internal Server Error
                                    java.lang.NoClassDefFoundError: org.apache.struts.action.ActionMessages
                                    java.lang.Object oracle.cabo.servlet.struts.ui.DataProviderParserFactory$Parser.getNodeValue(oracle.cabo.share.xml.ParseContext,
                                    java.lang.String, java.lang.String, org.xml.sax.Attributes)
                                    I have include the struts.jar in the project settings as a user library. (was not certain what was in the struts runtime library). Obviously, a class not found.
                                    Yes, though it's likely due to these libraries being deployed to different locations.
                                    What I would like to know is what the mechanism is that the IDE uses to deploy to the embedded OC4j and whether it can be configured? Where can I examine the files the OC4J is running under?
                                    This part of the IDE is outside of my expertise, so I'll need to pass this
                                    message on... stay tuned.

                                    In the meantime, if you're the sort that likes hacking around on machines, try
                                    deploying to an external OC4J instance and seeing where uix2.jar and struts.jar
                                    end up.
                                    1 2 Previous Next