• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

WS and tomcat

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello

I have a little web service that works fine when i deploy it on a tomcat 6.0 server using eclipse.
It is used to transform a XML file (that contains a reference to a file img/logo.gif) into a PDF file. The PDF file is generated with that logo.
The img/logo.gif file is into a JAR file used the WS.

Now, I have created a WAR file to put my WS on a server.
The web service is deployed correctly, i can see the WSDL when I type is URL on a browser, and when I execute it the PDF is correctly generated. The only problem is that the logo image is not put on the file. In the tomcat console a message indicating that the image has not been found is displayed.

Remember: the image file is on a JAR file that is on the WAR file. When I open the jar file on the MyWebservice/WEB-INF/lib directory, I can see clearly that the image file is there with the correct name and correct path.

Just to try, I put the img/logo.gif directory/file on the tomcat root directory, and like this, the image has been found and the PDF generated with the image.

I hope that I have explained well my problem.

What am I missing for the image been found?

Thanks

Best regards
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How is the code accessing the image? It needs to use the class loading/resource mechanism, not standard file I/O.
 
Paulo Carvalho
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello

Thanks for your answer.

However, the image path is only indicated on the XML file. No code is used to access it...



Ulf Dittmer wrote:How is the code accessing the image? It needs to use the class loading/resource mechanism, not standard file I/O.

 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, so it's not your code that uses the image then, it's some library? Maybe check the library's documentation/forum for cases like this, then.
 
Paulo Carvalho
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I dont think its a library problem, because everything works fine:
- when i deploy and use the web service using eclipse + tomcat
or
- when i deploy and use my application normally with the command line and I put the img directory on the root directory of tomcat installation

 
Paulo Carvalho
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe you were right about the problem coming from a library that I use. (maybe

For the transformation XML to PDF, I use FOP.
In the log file of my application the error message generated is the following one:

2010-02-15 14:27:29,267 ERROR org.apache.fop.fo.FONode - ExternalGraphic.java:70 - Image not available: url(img\\logo.gif)

So now, if the problem is related with FOP, why FOP can access the message when the web service as been deployed eclipse and why he cannot when the web service as been deployed using standard command line?

Thanks

Best regards
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

why FOP can access the message when the web service as been deployed eclipse and why he cannot when the web service as been deployed using standard command line?


Does Eclipse use the war file directly, or does it explode it into a directory tree? If the latter, then I can see how it could work.

The FOP docs talk about this at http://xmlgraphics.apache.org/fop/fo.html#external-resources. It is possible to create URLs that point into jar files using a syntax like "jar:..."; that should help in this case.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe the way you are giving a ref to the image is incorrect. Try an absolute address.

Bill

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic