2 Replies Latest reply on Jan 4, 2005 1:25 PM by Alex Dorandish

    JBoss x11 and swing <---- Urgent

    Alex Dorandish Newbie

      Hi All,

      Problem:
      I have written a code which uploads an image and to determine the size of that image and also the type, I am using swing methods like:

       javax.swing.ImageIcon hwImage = new javax.swing.ImageIcon(formFile.getFileData());
       setWidth(new Integer(hwImage.getIconWidth()));
       setHeight(new Integer(hwImage.getIconHeight()));
       float picRatio = hwImage.getIconWidth() / hwImage.getIconHeight();
       this.setPossibleToBeMainPic(1);
      


      then I get an exception like

      02:16:04,757 ERROR [Engine] StandardWrapperValve[action]: Servlet.service() for servlet action threw exception
      java.lang.reflect.InvocationTargetException
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:324)
       at org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.java:1789)
       at org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.java:1684)
       at org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java:1713)
       at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1019)
       at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
       at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1252)
       at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)
       at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
       at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
       at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
       at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
       at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
       at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
       at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
       at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:66)
       at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:153)
       at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:540)
       at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:54)
       at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
       at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
       at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
       at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
       at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
       at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
       at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
       at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
       at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:300)
       at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:374)
       at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:743)
       at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:675)
       at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:866)
       at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
       at java.lang.Thread.run(Thread.java:534)
      Caused by: 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 sun.awt.motif.MToolkit.<clinit>(MToolkit.java:81)
       at java.lang.Class.forName0(Native Method)
       at java.lang.Class.forName(Class.java:141)
       at java.awt.Toolkit$2.run(Toolkit.java:748)
       at java.security.AccessController.doPrivileged(Native Method)
       at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:739)
       at javax.swing.ImageIcon.<init>(ImageIcon.java:205)
       at com.naturalbornprogrammer.dating.application.actionform.album.value.ImageFormValueObject.setFormFile(ImageFormValueObject.java:2527)
       ... 53 more
      
      


      Now I am trying to get my app to work with x11. How can I do that?
      Is there any alternative to this one considering I must have height and width of the image and must be set in the database? Something like a library to use?

      I also heard about awt.headless=true, but I don't know how to set it up with jboss?