7 Replies Latest reply on Aug 13, 2007 7:16 PM by mshannon-Oracle

    Can't connect to X11 window server and java.lang.NoClassDefFoundError

    wchin
      Greetings!

      I think I have something new for the content DB community.

      We have a custom event handler that is tasked to process certain events. Lets just say for argument sake, I'm trying to convert every document that is loaded into the content DB into a PDF file. We are using an off the shelf tool called Autovue.

      The event handler pulls the newly created files out of the CDB for a client process that is started by the event handler.

      We have no problems with the event handler itself.

      However, the client that must be invoked to make a connection to the other server utilizes a java.awt.Frame. We display nothing, but the frame is required by the vendor's framework. So even before we get to make the connection to the other server, we get an exception when the event handler tries to execute "Frame f = new Frame();"

      The exception is as follows:
      java.lang.InternalError: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.
      at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
      at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:134)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:141)
      at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:62)
      at java.awt.Window.init(Window.java:231)
      at java.awt.Window.<init>(Window.java:275)
      at java.awt.Frame.<init>(Frame.java:401)
      at java.awt.Frame.<init>(Frame.java:366)
      at com.gdbiw.cdb.event.handlers.renderpdf.SFIRenderingEngine$1.<init>(SFIRenderingEngine.java:216)
      at com.gdbiw.cdb.event.handlers.renderpdf.SFIRenderingEngine.init(SFIRenderingEngine.java:215)
      at com.gdbiw.cdb.event.handlers.renderpdf.RenderPDFEventTrigger.handleEventPosted(RenderPDFEventTrigger.java:610)
      at oracle.ifs.fdk.impl.EventHandlerAgent$EventPostedTask.call(EventHandlerAgent.java:2856)


      So, this obviously needs the X11 Windows server. We did some research and implemented the Xvbf methodology, and set our DISPLAY to localhost:0.0 and
      exported with "XHOST +" (running xclock works so our configuration should be correct).

      The user who does this is "oracle" and is set to do so when the server reboots and before the content DB starts up. We rebooted the entire server along with the CDB.

      We checked the system (using ps) and we saw the Xvfb process running and check the DISPLAY settting. All is in order.

      Next we uploaded a file into CDB and the event handler blows out at the same location with a new exception.

      java.lang.NoClassDefFoundError
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:141)
      at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:62)
      at java.awt.Window.init(Window.java:231)
      at java.awt.Window.<init>(Window.java:275)
      at java.awt.Frame.<init>(Frame.java:401)
      at java.awt.Frame.<init>(Frame.java:366)
      at com.gdbiw.cdb.event.handlers.renderpdf.SFIRenderingEngine$1.<init>(SFIRenderingEngine.java:216)
      at com.gdbiw.cdb.event.handlers.renderpdf.SFIRenderingEngine.init(SFIRenderingEngine.java:215)
      at com.gdbiw.cdb.event.handlers.renderpdf.RenderPDFEventTrigger.handleEventPosted(RenderPDFEventTrigger.java:610)
      at oracle.ifs.fdk.impl.EventHandlerAgent$EventPostedTask.call(EventHandlerAgent.java:2856)
      at oracle.ifs.share.Executor.callTask(Executor.java:317)
      at oracle.ifs.share.Executor.handleTask(Executor.java:300)
      at oracle.ifs.share.Executor.handleRequests(Executor.java:283)
      at oracle.ifs.share.Executor.run(Executor.java:191)
      at java.lang.Thread.run(Thread.java:534)

      We beleive that its trying to dynamically load some class and that class can't be found.

      Can you shed any light on this.
      We have searched the web and there seems to be a lot of similar issues, but nothing seems to work for us.

      You could replicate this easily by creating an event handler that fires on any event and simply create a new Frame object.

      Any comments or hits would be appreciated.


      Thanks
      Winston


      PS. We are running on a linux machine. OCDB version 10.2.0.0.3, JVM is 1.4.2_08


      This is also a very high priority for us right now. In parallel we have opened a SR.
        • 1. Re: Can't connect to X11 window server and java.lang.NoClassDefFoundError
          wchin
          Hi,

          Just a heads up. I've logged the SR 6466254.992.

          Thanks
          Winston
          • 2. Re: Can't connect to X11 window server and java.lang.NoClassDefFoundError
            mshannon-Oracle
            Hi Winston,

            Can you try and create a skeleton (HelloWorld style) java process (outside of the eventhandler framework) that invokes the autovue code using the JDK bundled with the Oracle mid-tier ($ORACLE_HOME/jdk) and see if you can get this to function from the standard console (outside of any X-Server).

            If it fails, try using a different JDK/version (what do the autovue folks recommend?)

            cheers

            Matt.
            • 3. Re: Can't connect to X11 window server and java.lang.NoClassDefFoundError
              wchin
              Matt,

              Thanks for the quick reply. I did as you suggested and to my surprise it worked.

              I am logged on as oracle, the Xvfb is active and the DISPLAY variable is set.

              Here is the program

              import java.awt.Frame;
              import java.awt.Graphics;

              public class TestFrame {
              public TestFrame() {
              System.out.println("New Instance of TestFrame.");
              }

              public static void main(String[] args) {
              TestFrame testFrame = new TestFrame();
              testFrame.createFrame();
              System.exit(0);
              }

              public void createFrame() {

              Frame f = new Frame() {
              public void update(final Graphics g) {
              paint(g);
              }
              };
              System.out.println("New Instance of Frame.");
              }
              }


              NO EXCEPTIONS right off the bat?!?!


              So, why can't the event handler frame work do the same? Now I'm totally at a loss.
              What can I do?

              Winston

              PS. The Autovue guys have very little experience with Oracle and Linux. Their primary platform is Windows (where it works fine). They also suggest the Xvfb and DISPLAY settings.
              • 4. Re: Can't connect to X11 window server and java.lang.NoClassDefFoundError
                mshannon-Oracle
                Can you try also adding the display variable to opmn.xml ($ORACLE_HOME/opmn/conf) and "opmnctl reload" when done, and then bounce the node.

                e.g.

                <ias-component id="Content">
                <process-type id="Node" module-id="Content" working-dir="$ORACLE_HOME">
                <environment>
                <variable id="DISPLAY" value="localhost:1.0"/>
                ...
                etc

                cheers

                Matt.
                • 5. Re: Can't connect to X11 window server and java.lang.NoClassDefFoundError
                  wchin
                  Matt,

                  Thanks for the next step. Unfortunately, I'm not the aministrator. I only have temporary access with the promise that I would not reconfigure the server. So, I must wait until morning to have the real server admin do it for me.

                  I'm hoping for the best.

                  Winston
                  • 6. Re: Can't connect to X11 window server and java.lang.NoClassDefFoundError
                    wchin
                    Matt,

                    Once again THANKS for the tip. I just wanted to let you know that this was big, with your suggestion we were able to deploy within our schedule!! We are in full client acceptance testing now.

                    I have one question though. It is my experience that any unix process that is started up by another process (in this case the user oracle - who starts up the CDB) inherits its environmental setting of the parent process. "oracle" has its environment DISPLAY variable set as localhost:0.0 and owns the Xfvb process running (which it also starts).

                    So, why is it that when oracle starts up CDB, it appears that is didn't know what the value of DISPLAY variable was. From this I must assume that

                    When OCDB starts up it resets the environment to what ever it wants or needs it to be. In this case it wipes out the inherited settings?!?

                    Thanks Again for the big and VERY TIMELY help!!!!

                    Winston
                    • 7. Re: Can't connect to X11 window server and java.lang.NoClassDefFoundError
                      mshannon-Oracle
                      Glad it worked.

                      Re environment settings not being inheritied from source shell, the only thing I can surmise is that it is intended to prevent invalid source environment settings from being leveraged - (and by using hard-coded known working values ultimately would reduce support requests / TARs :) ).

                      cheers

                      Matt.