0 Replies Latest reply on Sep 3, 2002 6:51 AM by Thierry Templier

    Using PJA with JBoss / Tomcat

    Thierry Templier Newbie

      Hello,

      I try to use PJA ( Pure Java AWT ) with JBoss 2.4.4 / Tomcat 4.0.1 to display buffered images
      on web without any display ( X11 server or xvfb ) on the linux machine where JBoss / Tomcat runs.

      I try the PJAToolkitDemo1.2.sh which works correctly but is a standalone java application.

      Then I modify the run.sh script to use PJA ( same way as in PJAToolkitDemo1.2.sh ):

      #!/bin/sh

      JAVA_HOME=/usr/lib/j2sdk1.3
      PJA_HOME=/applis/pja_2.4

      JBOSS_CLASSPATH=run.jar:$JAVA_HOME/lib/tools.jar

      # Add the XML parser jars and set the JAXP factory names
      # Crimson parser JAXP setup(default)
      JBOSS_CLASSPATH=$JBOSS_CLASSPATH:../lib/crimson.jar:$PJA_HOME/lib/pjatools.jar:$PJA_HOME/lib/pja.jar

      JAXP=-Djavax.xml.parsers.DocumentBuilderFactory=org.apache.crimson.jaxp.DocumentBuilderFactoryImpl
      JAXP="$JAXP -Djavax.xml.parsers.SAXParserFactory=org.apache.crimson.jaxp.SAXParserFactoryImpl"

      PJA=-Dawt.toolkit=com.eteks.awt.PJAToolkit
      PJA="$PJA -Djava.awt.graphicsenv=com.eteks.java2d.PJAGraphicsEnvironment"
      PJA="$PJA -Djava2d.font.usePlatformFont=false"
      PJA="$PJA -Djava.awt.fonts=$JAVA_HOME/jre/lib/fonts"
      PJA="$PJA -Duser.home=$PJA_HOME"

      XBOOT=-Xbootclasspath/a:$PJA_HOME/lib/pja.jar

      java $XBOOT $PJA $JAXP -classpath $JBOSS_CLASSPATH org.jboss.Main $@

      But when I try to show images, I have the following exception:

      java.awt.AWTError: Toolkit not found: com.eteks.awt.PJAToolkit
      at java.awt.Toolkit$2.run(Toolkit.java:519)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:503)

      It seems that the -Xbootclasspath/a:$PJA_HOME/lib/pja.jar option of the java command doesn't work correctly.

      Is anyone already try to use pja with tomcat /jboss and success?
      Thanks for your help
      Thierry