You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Letícia Álvares Barbalho <le...@gmail.com> on 2006/02/07 13:53:26 UTC

Tomcat + Linux Server + Jasper Reports problem

Hello everyone,

I developed my webapp using netbeans and its embedded tomcat. I did some
reports in jasper reports and they were working just fine with the embedded
tomcat.

Then, I moved my app to the tomcat directory in the server (which is the
same machine) and the reports stopped working. They don't work locally in
the server and they don't work when accessing the app from any other client
machine (being linux or windows).

At first, I was getting the following error:

java.lang.InternalError: Can't connect to X11 window server using
':0.0' as the value of the DISPLAY variable.
	sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
	sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:134)
	java.lang.Class.forName0(Native Method)
	java.lang.Class.forName(Class.java:141)
	java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:62)



Through google I found out that I should use the catalina.sh file to set:

 JAVA_OPTS="-Djava.awt.headless=true"



I did it, but it did not solve the problem. It changed the error. Now I
have:

java.awt.HeadlessException
	java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:121)
	java.awt.Window.<init>(Window.java:274)
	java.awt.Frame.<init>(Frame.java:401)
	java.awt.Frame.<init>(Frame.java:366)
	javax.swing.JFrame.<init>(JFrame.java:154)
	net.sf.jasperreports.view.JasperViewer.<init>(JasperViewer.java:144)

I tried google, but couldn't find a solution for it. Can someone help,
please? Other important data about my server:

leticia:/home/leticia # java -version
java version "1.4.2_06" Java(TM) 2 Runtime Environment, Standard Edition
(build 1.4.2_06-b03)
Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode)
leticia:/home/leticia # echo $JAVA_HOME
/usr/lib/jvm/java
leticia:/home/leticia # echo $PATH
/usr/sbin:/bin:/usr/bin:/sbin:/usr/X11R6/bin

Since it's working fine in the netbeans embedded tomcat and not in my linux
server tomcat, I suppose the problem is in tomcat configuration. Both
tomcat's are in the same computer.

Any help is appreciated

Thanks

--
Letícia Álvares Barbalho
leticia.barbalho@gmail.com

Re: Tomcat + Linux Server + Jasper Reports problem

Posted by Mikolaj Rydzewski <mi...@becomo.com>.
Letícia Álvares Barbalho wrote:
> I developed my webapp using netbeans and its embedded tomcat. I did some
> reports in jasper reports and they were working just fine with the embedded
> tomcat.
>
> Then, I moved my app to the tomcat directory in the server (which is the
> same machine) and the reports stopped working. They don't work locally in
> the server and they don't work when accessing the app from any other client
> machine (being linux or windows).
>
> At first, I was getting the following error:
>
> java.lang.InternalError: Can't connect to X11 window server using
> ':0.0' as the value of the DISPLAY variable.
>   
We had similiar problem. The solution was to run a X server on the same 
machine where tomcat runs.

-- 
Mikolaj Rydzewski  <mi...@becomo.com>
Becomo S.A.
tel. (12) 2927104




Re: Tomcat + Linux Server + Jasper Reports problem

Posted by Letícia Álvares Barbalho <le...@gmail.com>.
Thanks everyone,
I've just managed to get rid of the error.
I set the display variable ":0" and then did a "xhost +". I also had to get
rid of the headless parameter, as you said I didn't need it.
Now my report successfully appears on my server.
The thing is that I wanted it to be shown on the machine that requested it.
If I'm in a client machine and request the report, I want it to appear on
this client machine. But the way it is, it always appears on the server.
But I think this is not a problem to be solved on this list, is it?

thanks very much everyone

On 2/8/06, Mike Sabroff <mi...@cygnusb2b.com> wrote:
>
> Why not just set the environment variable to wherever the reports are
> expected to be produced.
> In other words, if it is the macine you are on, use "unix:0.0" if it is
> another machine, get ip of that machine and set the DISPLAY variable to
> "whateverip:0.0" that is providing there is an XServer running on that
> box.
>
> � wrote:
> > the Anyone?
> >
> > On 2/7/06, Let�cia �lvares Barbalho <le...@gmail.com> wrote:
> >
> >> Hello everyone,
> >>
> >> I developed my webapp using netbeans and its embedded tomcat. I did
> some
> >> reports in jasper reports and they were working just fine with the
> embedded
> >> tomcat.
> >>
> >> Then, I moved my app to the tomcat directory in the server (which is
> the
> >> same machine) and the reports stopped working. They don't work locally
> in
> >> the server and they don't work when accessing the app from any other
> client
> >> machine (being linux or windows).
> >>
> >> At first, I was getting the following error:
> >>
> >> java.lang.InternalError: Can't connect to X11 window server using ':0.0
> >> ' as the value of the DISPLAY variable.
> >>      sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
> >>      sun.awt.X11GraphicsEnvironment.<clinit>(
> X11GraphicsEnvironment.java:134)
> >>      java.lang.Class.forName0(Native Method)
> >>
> >>      java.lang.Class.forName(Class.java:141)
> >>      java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(
> GraphicsEnvironment.java:62)
> >>
> >>
> >>
> >> Through google I found out that I should use the catalina.sh file to
> set:
> >>
> >>  JAVA_OPTS="-Djava.awt.headless=true"
> >>
> >>
> >>
> >> I did it, but it did not solve the problem. It changed the error. Now I
> >> have:
> >>
> >> java.awt.HeadlessException
> >>      java.awt.GraphicsEnvironment.checkHeadless(
> GraphicsEnvironment.java:121)
> >>      java.awt.Window.<init>(Window.java:274)
> >>      java.awt.Frame.<init>(Frame.java:401)
> >>      java.awt.Frame
> >> .<init>(Frame.java:366)
> >>      javax.swing.JFrame.<init>(JFrame.java:154)
> >>      net.sf.jasperreports.view.JasperViewer.<init>(JasperViewer.java
> :144)
> >>
> >> I tried google, but couldn't find a solution for it. Can someone help,
> >> please? Other important data about my server:
> >>
> >> leticia:/home/leticia # java -version
> >> java version "1.4.2_06" Java(TM) 2 Runtime Environment, Standard
> Edition
> >> (build 1.4.2_06-b03)
> >> Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode)
> >> leticia:/home/leticia # echo $JAVA_HOME
> >> /usr/lib/jvm/java
> >> leticia:/home/leticia # echo $PATH
> >> /usr/sbin:/bin:/usr/bin:/sbin:/usr/X11R6/bin
> >>
> >> Since it's working fine in the netbeans embedded tomcat and not in my
> >> linux server tomcat, I suppose the problem is in tomcat configuration.
> Both
> >> tomcat's are in the same computer.
> >>
> >> Any help is appreciated
> >>
> >> Thanks
> >>
> >> --
> >> Let�cia �lvares Barbalho
> >> leticia.barbalho@gmail.com
> >>
> >
> >
> >
> >
> > --
> > Let�cia �lvares Barbalho
> > leticia.barbalho@gmail.com
> >
> >
>
> --
> Mike Sabroff
> Web Services
> Developer
> mike.sabroff@cygnusb2b.com
> 920-568-8379
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


--
Letícia Álvares Barbalho
leticia.barbalho@gmail.com

Re: Tomcat + Linux Server + Jasper Reports problem

Posted by Mike Sabroff <mi...@cygnusb2b.com>.
Why not just set the environment variable to wherever the reports are 
expected to be produced.
In other words, if it is the macine you are on, use "unix:0.0" if it is 
another machine, get ip of that machine and set the DISPLAY variable to 
"whateverip:0.0" that is providing there is an XServer running on that box.

� wrote:
> the Anyone?
>
> On 2/7/06, Let�cia �lvares Barbalho <le...@gmail.com> wrote:
>   
>> Hello everyone,
>>
>> I developed my webapp using netbeans and its embedded tomcat. I did some
>> reports in jasper reports and they were working just fine with the embedded
>> tomcat.
>>
>> Then, I moved my app to the tomcat directory in the server (which is the
>> same machine) and the reports stopped working. They don't work locally in
>> the server and they don't work when accessing the app from any other client
>> machine (being linux or windows).
>>
>> At first, I was getting the following error:
>>
>> java.lang.InternalError: Can't connect to X11 window server using ':0.0
>> ' as the value of the DISPLAY variable.
>> 	sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
>> 	sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:134)
>> 	java.lang.Class.forName0(Native Method)
>>
>> 	java.lang.Class.forName(Class.java:141)
>> 	java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:62)
>>
>>
>>
>> Through google I found out that I should use the catalina.sh file to set:
>>
>>  JAVA_OPTS="-Djava.awt.headless=true"
>>
>>
>>
>> I did it, but it did not solve the problem. It changed the error. Now I
>> have:
>>
>> java.awt.HeadlessException
>> 	java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:121)
>> 	java.awt.Window.<init>(Window.java:274)
>> 	java.awt.Frame.<init>(Frame.java:401)
>> 	java.awt.Frame
>> .<init>(Frame.java:366)
>> 	javax.swing.JFrame.<init>(JFrame.java:154)
>> 	net.sf.jasperreports.view.JasperViewer.<init>(JasperViewer.java:144)
>>
>> I tried google, but couldn't find a solution for it. Can someone help,
>> please? Other important data about my server:
>>
>> leticia:/home/leticia # java -version
>> java version "1.4.2_06" Java(TM) 2 Runtime Environment, Standard Edition
>> (build 1.4.2_06-b03)
>> Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode)
>> leticia:/home/leticia # echo $JAVA_HOME
>> /usr/lib/jvm/java
>> leticia:/home/leticia # echo $PATH
>> /usr/sbin:/bin:/usr/bin:/sbin:/usr/X11R6/bin
>>
>> Since it's working fine in the netbeans embedded tomcat and not in my
>> linux server tomcat, I suppose the problem is in tomcat configuration. Both
>> tomcat's are in the same computer.
>>
>> Any help is appreciated
>>
>> Thanks
>>
>> --
>> Let�cia �lvares Barbalho
>> leticia.barbalho@gmail.com
>>     
>
>
>
>
> --
> Let�cia �lvares Barbalho
> leticia.barbalho@gmail.com
>
>   

-- 
Mike Sabroff
Web Services
Developer
mike.sabroff@cygnusb2b.com
920-568-8379


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Tomcat compression not working for data sent by server only - compression works for receipt from browser

Posted by Medha Parathasarathy <me...@fastmail.fm>.
We have a small application running on tomcat 5.5. We tried to enable
compression. The same is working on communcation received from the
browser[ at around 50% ]. But the data sent from the server gets an
compression of only 1%.   Had anybody used this feature. How ensure that
the compression is uniform data received and sent.

Regards


Sarathy
On Wed, 8 Feb 2006 08:11:00 -0200, "Letícia Álvares Barbalho"
<le...@gmail.com> said:
> Anyone?
> 
> On 2/7/06, Letícia Álvares Barbalho <le...@gmail.com> wrote:
> >
> > Hello everyone,
> >
> > I developed my webapp using netbeans and its embedded tomcat. I did some
> > reports in jasper reports and they were working just fine with the embedded
> > tomcat.
> >
> > Then, I moved my app to the tomcat directory in the server (which is the
> > same machine) and the reports stopped working. They don't work locally in
> > the server and they don't work when accessing the app from any other client
> > machine (being linux or windows).
> >
> > At first, I was getting the following error:
> >
> > java.lang.InternalError: Can't connect to X11 window server using ':0.0
> > ' as the value of the DISPLAY variable.
> > 	sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
> > 	sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:134)
> > 	java.lang.Class.forName0(Native Method)
> >
> > 	java.lang.Class.forName(Class.java:141)
> > 	java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:62)
> >
> >
> >
> > Through google I found out that I should use the catalina.sh file to set:
> >
> >  JAVA_OPTS="-Djava.awt.headless=true"
> >
> >
> >
> > I did it, but it did not solve the problem. It changed the error. Now I
> > have:
> >
> > java.awt.HeadlessException
> > 	java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:121)
> > 	java.awt.Window.<init>(Window.java:274)
> > 	java.awt.Frame.<init>(Frame.java:401)
> > 	java.awt.Frame
> > .<init>(Frame.java:366)
> > 	javax.swing.JFrame.<init>(JFrame.java:154)
> > 	net.sf.jasperreports.view.JasperViewer.<init>(JasperViewer.java:144)
> >
> > I tried google, but couldn't find a solution for it. Can someone help,
> > please? Other important data about my server:
> >
> > leticia:/home/leticia # java -version
> > java version "1.4.2_06" Java(TM) 2 Runtime Environment, Standard Edition
> > (build 1.4.2_06-b03)
> > Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode)
> > leticia:/home/leticia # echo $JAVA_HOME
> > /usr/lib/jvm/java
> > leticia:/home/leticia # echo $PATH
> > /usr/sbin:/bin:/usr/bin:/sbin:/usr/X11R6/bin
> >
> > Since it's working fine in the netbeans embedded tomcat and not in my
> > linux server tomcat, I suppose the problem is in tomcat configuration. Both
> > tomcat's are in the same computer.
> >
> > Any help is appreciated
> >
> > Thanks
> >
> > --
> > Letícia Álvares Barbalho
> > leticia.barbalho@gmail.com
> 
> 
> 
> 
> --
> Letícia Álvares Barbalho
> leticia.barbalho@gmail.com

-- 
http://www.fastmail.fm - Faster than the air-speed velocity of an
                          unladen european swallow


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat + Linux Server + Jasper Reports problem

Posted by Mike Fowler <to...@mlfowler.com>.
Hello,

Though I generally do not reply to people who repost their own questions 
daily, I did miss your original post and I spent some considerable time 
trying to solve this problem myself.

Checking the JavaDoc for HeadlessException you should note that it is 
"thrown when code that is dependent on a keyboard, display, or mouse is 
called in an environment that does not support a keyboard, display, or 
mouse.", which when you run headless is the case. Looking at your stack 
trace your construction of the JasperViewer object relies on creating a 
JFrame, and as per the exception documentation, you can't do. Therefore 
running headless is not your solution.

IMHO your solution should be to change what you are invoking so that you 
are not reliant on the JasperViewer and therefore the JFrame as Swing 
and AWT don't make sense in a server environment. However, if this is 
not possible you will need a correctly configured X environment and the 
DISPLAY environment variable set. Assuming a BASH shell, you can set the 
display variable with:

export DISPLAY=hostname:0

repacing hostname with your machine's real hostname.

Best wishes,

--
Mike Fowler
Registered Linux user: 379787

"I could be a genius if I just put my mind to it, and I,
I could do anything, if only I could get 'round to it"
-PULP 'Glory Days'

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat + Linux Server + Jasper Reports problem

Posted by Letícia Álvares Barbalho <le...@gmail.com>.
Anyone?

On 2/7/06, Letícia Álvares Barbalho <le...@gmail.com> wrote:
>
> Hello everyone,
>
> I developed my webapp using netbeans and its embedded tomcat. I did some
> reports in jasper reports and they were working just fine with the embedded
> tomcat.
>
> Then, I moved my app to the tomcat directory in the server (which is the
> same machine) and the reports stopped working. They don't work locally in
> the server and they don't work when accessing the app from any other client
> machine (being linux or windows).
>
> At first, I was getting the following error:
>
> java.lang.InternalError: Can't connect to X11 window server using ':0.0
> ' as the value of the DISPLAY variable.
> 	sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
> 	sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:134)
> 	java.lang.Class.forName0(Native Method)
>
> 	java.lang.Class.forName(Class.java:141)
> 	java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:62)
>
>
>
> Through google I found out that I should use the catalina.sh file to set:
>
>  JAVA_OPTS="-Djava.awt.headless=true"
>
>
>
> I did it, but it did not solve the problem. It changed the error. Now I
> have:
>
> java.awt.HeadlessException
> 	java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:121)
> 	java.awt.Window.<init>(Window.java:274)
> 	java.awt.Frame.<init>(Frame.java:401)
> 	java.awt.Frame
> .<init>(Frame.java:366)
> 	javax.swing.JFrame.<init>(JFrame.java:154)
> 	net.sf.jasperreports.view.JasperViewer.<init>(JasperViewer.java:144)
>
> I tried google, but couldn't find a solution for it. Can someone help,
> please? Other important data about my server:
>
> leticia:/home/leticia # java -version
> java version "1.4.2_06" Java(TM) 2 Runtime Environment, Standard Edition
> (build 1.4.2_06-b03)
> Java HotSpot(TM) Client VM (build 1.4.2_06-b03, mixed mode)
> leticia:/home/leticia # echo $JAVA_HOME
> /usr/lib/jvm/java
> leticia:/home/leticia # echo $PATH
> /usr/sbin:/bin:/usr/bin:/sbin:/usr/X11R6/bin
>
> Since it's working fine in the netbeans embedded tomcat and not in my
> linux server tomcat, I suppose the problem is in tomcat configuration. Both
> tomcat's are in the same computer.
>
> Any help is appreciated
>
> Thanks
>
> --
> Letícia Álvares Barbalho
> leticia.barbalho@gmail.com




--
Letícia Álvares Barbalho
leticia.barbalho@gmail.com