simone
Member since : Jan 19, 2004
Messages : 1
|
Jan 19, 2004 at 11:14 AM
I cannot get the PJA to work in my environment and still get error without xlibs: java.lang.UnsatisfiedLinkError: /usr/java/j2sdk1.4.0_01/jre/lib/i386/libawt.so: libXp.so.6: cannot open shared object file: No such file or directory
Linux without X installed
PJA 2.5 beta
tomcat 4.0.4
j2sdk 1.4.0_01
First I tryed my code used to resize a JPEG, but when I
Image image1 = Toolkit.getDefaultToolkit().getImage(sourceFileName);
I've the error in of the subject.
So I used the JPEG test jsp
-----
<%@ page contentType="image/jpeg"
import="java.awt.image.*,java.awt.*,com.sun.image.codec.jpeg.*" %>
<% // Create an offscreen image 100 x 100 pixels
BufferedImage image = new BufferedImage (100, 100, BufferedImage.TYPE_INT_RGB);
// Draw into the image a black circle with the text Hello on a yellow background
Graphics g = image.getGraphics();
g.setColor (Color.yellow);
g.fillRect (0, 0, 100, 100);
g.setColor (Color.black);
g.drawOval (0, 0, 99, 99);
g.drawString ("Hello", 30, 50);
// Create a JPEG encoder to send the image at JPEG format
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(response.getOutputStream());
encoder.encode(image);
response.getOutputStream().close (); %>
-----
I've these in the catalina.sh script
--------
JAVA_OPTS="$JAVA_OPTS -Djava2d.font.usePlatformFont=false -Xbootclasspath/a:/web/piyosailing/admin/WEB-INF/lib/pja.jar -Djava.awt.fonts=/usr/java/j2sdk1.4.0_01/jre/lib/fonts -Dawt.toolkit=com.eteks.awt.PJAToolkit -Djava.awt.graphicsenv=com.eteks.java2d.PJAGraphicsEnvironment"
---------
but I still get the error
-----
java.lang.UnsatisfiedLinkError: /usr/java/j2sdk1.4.0_01/jre/lib/i386/libawt.so: libXp.so.6: cannot open shared object file: No such file or directory
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1480)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1396)
at java.lang.Runtime.loadLibrary0(Runtime.java:772)
at java.lang.System.loadLibrary(System.java:832)
at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:50)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.image.ColorModel.loadLibraries(ColorModel.java:188)
at java.awt.image.ColorModel.(ColorModel.java:196)
at java.awt.image.BufferedImage.(BufferedImage.java:212)
at org.apache.jsp.test$jsp._jspService(test$jsp.java:62)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:201)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:531)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
at java.lang.Thread.run(Thread.java:536)
[Subject changed by moderator]
|
Manu
Location : Paris / France
Member since : Apr 29, 2003
Messages : 394
|
Jan 19, 2004 at 10:48 PM
Java BufferedImage and JPEGEncoder classes need java.awt.image.ColorModel class that itself requires awt **and** libXp.so.6 libraries. This behavior can't be overridden as the ColorModel class loads these libs in its static initializer and thus whatever option you'll add to java command line you'll always have this error at the loading time of these classes.
If you really don't want or can't install X11 libs, the only workaround I know at this time is to compute your offscreen image with com.eteks.pja.PJAImage and com.eteks.pja.PJAGraphics classes and to encode it with Acme.JPM.Encoders.GifEncoderNoCM class provided in pjatools.jar.
Please have a look at http://www.eteks.com/pja/en/forum/viewSubject.jsp?subjectId=90#91 for a basic example and http://www.eteks.com/pja/en/forum/viewSubject.jsp?subjectId=134#136 for a real-world example.
If you need more features in PJA for an environment without X11 libs (JPEGEncoder, antialiasing,...), please answer the survey at http://www.eteks.com/pja/en/x11survey.jsp --- Manu (moderator/modérateur)
|