Code Monkey home page Code Monkey logo

Comments (58)

geekdenz avatar geekdenz commented on July 29, 2024

Can you try with the new release? I suspect it's not an issue any more.

from mapfish-print.

jesseeichar avatar jesseeichar commented on July 29, 2024

I probably should publish a new snapshot with your new changes. I will do that right now.

from mapfish-print.

jesseeichar avatar jesseeichar commented on July 29, 2024

I have just uploaded 2.0-SNAPSHOT to the maven central snapshots repository. https://oss.sonatype.org/content/repositories/snapshots

You can test that upload and see if it works for you.

from mapfish-print.

geekdenz avatar geekdenz commented on July 29, 2024

Hi Jesse, I think you were a bit fast. I haven't yet even added the changes. I can do it tomorrow though.

from mapfish-print.

jonathan-wcc avatar jonathan-wcc commented on July 29, 2024

I can't see any obvious snapshots in that directly, just a warren of subdirectories. Nothing in redis or github that looks like it. I'm afraid I can't test it without a build.

from mapfish-print.

jesseeichar avatar jesseeichar commented on July 29, 2024

Hi Jonathan. I has assumed you are familar with maven, my apologies. The URL I gave you is he root of a maven repository it has all the builds and libraries. The mapfish stuff is under the subdirectories org.mapfish: https://oss.sonatype.org/content/repositories/snapshots/org/mapfish/print/

The standalone (with all dependencies in one jar) is at https://oss.sonatype.org/content/repositories/snapshots/org/mapfish/print/print-standalone/2.0-SNAPSHOT/print-standalone-2.0-SNAPSHOT.jar

from mapfish-print.

jonathan-wcc avatar jonathan-wcc commented on July 29, 2024

Thanks. I used the servlet snapshot as I'm using an extracted .war - https://oss.sonatype.org/content/repositories/snapshots/org/mapfish/print/print-servlet/2.0-SNAPSHOT/ - Tue Apr 16 01:03:19 CDT 2013

Unfortunately this made the issue WORSE. Now I don't get any legend graphics for any layers! The "EA Flood Zone 3" item is just a regular layer - no special categorised styling, so previously it would have showed fine but doesn't now.

Clipboard01

I tested the URL received by GeoServer and they serve just fine. i.e.:
http://wppgeog3:8082/geoserver/wms?version=1.3.0&TRANSPARENT=TRUE&SERVICE=WMS&REQUEST=GetLegendGraphic&EXCEPTIONS=application%2Fvnd.ogc.se_xml&LAYER=Public_Data_DB%3AEA_DET_RIV_NWK_SUBREG&FORMAT=image%2Fpng&SCALE=19999.99999369495


But then other times it doesn't make ANY GetLegendGraphic requests received by GeoServer, despite them correctly being in the mapfish-print.log ("DEBUG [org.mapfish.print.servlet.BaseMapServlet] - Generating PDF for spec= ..." section)

from mapfish-print.

geekdenz avatar geekdenz commented on July 29, 2024

Have you checked your .yaml file? There are are quite a few options that changed. Have a look here:
https://github.com/mapfish/mapfish-print/blob/master/docs/configuration.txt
under "Legends block".

from mapfish-print.

jonathan-wcc avatar jonathan-wcc commented on July 29, 2024

I don't think I've changed my YAML between that last test and this one.
I've now tweaked it based on your link to the following. No effect:

    #Legend
    - !columns
      #This line determines if the legend is shown in the template.
      condition: legends
      absoluteX: 37
      absoluteY: 560
      width: 150
      config:
        borderWidth: 1
        cells:
          - borderWidth: 1
            borderColor: #555555
            padding: 5

      items:
        - !legends
          iconMaxWidth: 9
          iconMaxHeight: 9
          maxWidth: 150
          #Padding between layers
          layerSpace: 5
          layerFont: Helvetica
          layerFontSize: 9
          #Padding between text and icon within layer
          classSpace: 2
          classIndentation: 5
          classFont: Helvetica
          classFontSize: 9
          backgroundColor: white
          inline:true

As you can see from the screenshot, it even seems to be ignoring the "padding" which was working in the original screenshot.


I note that for some reason:
? maxIconWidth: 8
? maxIconHeight: 8

have become:
? iconMaxWidth: 8
? iconMaxHeight: 8

Changing that made no difference either.

from mapfish-print.

geekdenz avatar geekdenz commented on July 29, 2024

I haven't tried the release version as we use the dev version, since I can fix potential problems if they arise. I would have to try the release version and try to reproduce your problem. Unfortunately, I do not have time for that right now.

So, you said it was working correctly with a release version from before?

from mapfish-print.

jonathan-wcc avatar jonathan-wcc commented on July 29, 2024

Right.
The "new" version that was linked to by Jesse here (i.e. https://oss.sonatype.org/content/repositories/snapshots/org/mapfish/print/print-servlet/2.0-SNAPSHOT/) produces:
2 0


The "old" version, which is a snapshot I downloaded from: http://dev.mapfish.org/maven/repository/org/mapfish/print/print-servlet/1.2-SNAPSHOT/ - print-servlet-1.2-SNAPSHOT.war 19-Dec-2012 11:49 24M

is this:
1 2

As you can see, the "new" one is broken in a lot more ways than the old one. Both are using the exact same YAML (as above).

from mapfish-print.

geekdenz avatar geekdenz commented on July 29, 2024

Can you send your spec that you would get in the print module log file or through your browser when the AJAX request is made?

from mapfish-print.

jonathan-wcc avatar jonathan-wcc commented on July 29, 2024

OK, change of plan. Github sucks for attaching files in no less than two browsers. Doesn't seem to support pretty much any attaching filetype. See below instead:

2013-04-17 13:41:55,101 DEBUG [org.mapfish.print.servlet.BaseMapServlet] - Generating PDF for spec={"units":"m","srs":"EPSG:27700","layout":"A4 Landscape","dpi":150,"mapTitle":"","mapComment":"","mapFooter":"","layers":[{"baseURL":"http://wppgeog3:8082/geoserver/gwc/service/tms/","opacity":1,"singleTile":false,"type":"TMS","layer":"Warks_Full","maxExtent":[0,0,700000,1300000],"tileSize":[256,256],"resolutions":[2800,1400,700,350,175,87.5,43.75,21.875,10.9375,5.46875,2.734375,1.3671875,0.68359375,0.341796875,0.1708984375,0.08544921875],"format":"png"},{"baseURL":"http://wppgeog3:8082/geoserver/wms?version=1.3.0","opacity":0.65,"singleTile":true,"type":"WMS","layers":["Public_Data_DB:PROP_BOUNDS_SUB_REG"],"format":"image/png","styles":[""],"customParams":{"TRANSPARENT":true}},{"baseURL":"http://wppgeog3:8082/geoserver/wms?version=1.3.0","opacity":0.65,"singleTile":true,"type":"WMS","layers":["Public_Data_DB:EA_FLOOD_ZONE_3_WSHIRE"],"format":"image/png","styles":[""],"customParams":{"TRANSPARENT":true}}],"pages":[{"center":[430987,271325],"scale":40000,"rotation":0}],"legends":[{"name":"EA Flood Zone 3 - Med to High Risk","classes":[{"name":"","icons":["http://wppgeog3:8082/geoserver/wms?version=1.3.0&TRANSPARENT=TRUE&SERVICE=WMS&REQUEST=GetLegendGraphic&EXCEPTIONS=application%2Fvnd.ogc.se_xml&LAYER=Public_Data_DB%3AEA_FLOOD_ZONE_3_WSHIRE&FORMAT=image%2Fpng"]}]},{"name":"Property Boundaries - SubRegional","classes":[{"name":"","icons":["http://10.76.14.105:8082/geoserver/wms?version=1.3.0&TRANSPARENT=TRUE&SERVICE=WMS&REQUEST=GetLegendGraphic&EXCEPTIONS=application%2Fvnd.ogc.se_xml&LAYER=Public_Data_DB%3APROP_BOUNDS_SUB_REG&FORMAT=image%2Fpng"]}]}]}

from mapfish-print.

geekdenz avatar geekdenz commented on July 29, 2024

Ah, I know what is wrong. I haven't implemented multiple legend icons in the new legends block logic.

A quick fix for you would be to instead of having

{
"name": "Property Boundaries - SubRegional",
"classes": [
{
"name": "",
"icons": [
"http://10.76.14.105:8082/geoserver/wms?version=1.3.0&TRANSPARENT=TRUE&SERVICE=WMS&REQUEST=GetLegendGraphic&EXCEPTIONS=application%2Fvnd.ogc.se_xml&LAYER=Public_Data_DB%3APROP_BOUNDS_SUB_REG&FORMAT=image%2Fpng"
]
}
]
}
HAVE:
{
"name": "Property Boundaries - SubRegional",
"classes": [
{
"name": "",
"icon": "http://10.76.14.105:8082/geoserver/wms?version=1.3.0&TRANSPARENT=TRUE&SERVICE=WMS&REQUEST=GetLegendGraphic&EXCEPTIONS=application%2Fvnd.ogc.se_xml&LAYER=Public_Data_DB%3APROP_BOUNDS_SUB_REG&FORMAT=image%2Fpng"
}
]
}

Hope this helps. I will keep that in mind and implement this accordingly. It shouldn't be hard to do, I will just need to find some time to do it.

from mapfish-print.

geekdenz avatar geekdenz commented on July 29, 2024

This is fixed now in master. Please close if happy.

from mapfish-print.

jesseeichar avatar jesseeichar commented on July 29, 2024

I will publish a new snapshot in about 20 minutes.

On Mon, Apr 22, 2013 at 4:20 AM, Tim-Hinnerk Heuer <[email protected]

wrote:

This is fixed now in master. Please close if happy.


Reply to this email directly or view it on GitHubhttps://github.com//issues/44#issuecomment-16751365
.

from mapfish-print.

jonathan-wcc avatar jonathan-wcc commented on July 29, 2024

Using the build of this morning. Printing with the legend enabled errors out. Works fine with legend disabled. Exact same YAML as before. Error is:

2013-04-22 10:24:19,564 ERROR [org.mapfish.print.servlet.BaseMapServlet] - Error while generating PDF
com.lowagie.text.DocumentException: The document is not open yet; you can only add Meta information.
at com.lowagie.text.Document.add(Unknown Source)
at org.mapfish.print.config.layout.LegendsBlock$Renderer.getHeight(LegendsBlock.java:353)
at org.mapfish.print.config.layout.LegendsBlock$Renderer.render(LegendsBlock.java:190)
at org.mapfish.print.config.layout.LegendsBlock.render(LegendsBlock.java:99)
at org.mapfish.print.PDFUtils.createCell(PDFUtils.java:536)
at org.mapfish.print.PDFUtils.buildTable(PDFUtils.java:521)
at org.mapfish.print.config.layout.ColumnsBlock$1.render(ColumnsBlock.java:58)
at org.mapfish.print.PDFCustomBlocks.addAbsoluteDrawer(PDFCustomBlocks.java:183)
at org.mapfish.print.config.layout.ColumnsBlock.render(ColumnsBlock.java:56)
at org.mapfish.print.config.layout.Page.render(Page.java:73)
at org.mapfish.print.config.layout.MainPage.render(MainPage.java:63)
at org.mapfish.print.config.layout.Layout.render(Layout.java:59)
at org.mapfish.print.output.AbstractOutputFormat.doPrint(AbstractOutputFormat.java:30)
at org.mapfish.print.output.PdfOutputFactory.print(PdfOutputFactory.java:62)
at org.mapfish.print.MapPrinter.print(MapPrinter.java:183)
at org.mapfish.print.servlet.MapPrinterServlet.doCreatePDFFile(MapPrinterServlet.java:304)
at org.mapfish.print.servlet.MapPrinterServlet.createPDF(MapPrinterServlet.java:160)
at org.mapfish.print.servlet.MapPrinterServlet.doPost(MapPrinterServlet.java:98)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:755)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:669)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:457)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:533)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1075)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:384)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1009)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
at org.eclipse.jetty.server.Server.handle(Server.java:368)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489)
at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:953)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1014)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:861)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:628)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
at java.lang.Thread.run(Unknown Source)

from mapfish-print.

geekdenz avatar geekdenz commented on July 29, 2024

Mh, will have a look tomorrow. Assumed it would work, because my local version works fine. Will need to do a diff with the master branch.

from mapfish-print.

geekdenz avatar geekdenz commented on July 29, 2024

Sorry, didn't get a chance to look at this yet. I suspect this is due to changes between my landcare branch and master. I will need to investigate.

from mapfish-print.

geekdenz avatar geekdenz commented on July 29, 2024

Looked at this just now and it is indeed fixed.

from mapfish-print.

jonathan-wcc avatar jonathan-wcc commented on July 29, 2024

Thanks Tim, though I can't test it until there is a build.

from mapfish-print.

jesseeichar avatar jesseeichar commented on July 29, 2024

Well, I just uploaded the latest. Tim. Could you download it and make
sure it works for you to make sure you haven't forgotten a commit or have
something locally that makes it work?

https://oss.sonatype.org/content/repositories/snapshots/org/mapfish/print/print-standalone/2.0-SNAPSHOT/print-standalone-2.0-SNAPSHOT.jar

Jesse

On Wed, May 1, 2013 at 11:06 AM, jonathan-wcc [email protected]:

Thanks Tim, though I can't test it until there is a build.


Reply to this email directly or view it on GitHubhttps://github.com//issues/44#issuecomment-17273882
.

from mapfish-print.

jonathan-wcc avatar jonathan-wcc commented on July 29, 2024

Using Jesse's build, it still bugs-out when I try to attach any legend, even a non-categorised one:

2013-05-01 11:25:45,772 WARN [org.mapfish.print.servlet.BaseMapServlet] - Cannot delete file:C:\Users\jmou1.WCC-CORP\AppData\Local\Temp\19\jetty-0.0.0.0-8090-print2.0-_print2.0-any-\mapfish-print75452
71930841531908.pdf.printout
2013-05-01 11:25:45,810 ERROR [org.mapfish.print.servlet.BaseMapServlet] - Error while generating PDF
com.lowagie.text.DocumentException: The document is not open yet; you can only add Meta information.
at com.lowagie.text.Document.add(Unknown Source)
at org.mapfish.print.config.layout.LegendsBlock$Renderer.getHeight(LegendsBlock.java:353)
at org.mapfish.print.config.layout.LegendsBlock$Renderer.render(LegendsBlock.java:190)
at org.mapfish.print.config.layout.LegendsBlock.render(LegendsBlock.java:99)
at org.mapfish.print.PDFUtils.createCell(PDFUtils.java:536)
at org.mapfish.print.PDFUtils.buildTable(PDFUtils.java:521)
at org.mapfish.print.config.layout.ColumnsBlock$1.render(ColumnsBlock.java:58)
at org.mapfish.print.PDFCustomBlocks.addAbsoluteDrawer(PDFCustomBlocks.java:183)
at org.mapfish.print.config.layout.ColumnsBlock.render(ColumnsBlock.java:56)
at org.mapfish.print.config.layout.Page.render(Page.java:73)
at org.mapfish.print.config.layout.MainPage.render(MainPage.java:63)
at org.mapfish.print.config.layout.Layout.render(Layout.java:59)
at org.mapfish.print.output.AbstractOutputFormat.doPrint(AbstractOutputFormat.java:30)
at org.mapfish.print.output.PdfOutputFactory.print(PdfOutputFactory.java:62)
...

1.2 on the same jetty instance doesn't bug out.

from mapfish-print.

geekdenz avatar geekdenz commented on July 29, 2024

Does C:\Users\jmou1.WCC-CORP\AppData\Local\Temp\19\jetty-0.0.0.0-8090-print2.0-_print2.0-any-\mapfish-print75452
71930841531908.pdf.printout exist?

It's complaining it cannot delete it. Seems like a permissions problem.

Oh, sorry, that was just the warning on top of it...

from mapfish-print.

geekdenz avatar geekdenz commented on July 29, 2024

OK, just to do it again and double check, I did the following:

$ cd /tmp
$ git clone git://github.com/mapfish/mapfish-print.git
$ cd mapfish-print/
$ gradle war
$ ./debugJetty
In another terminal:
$ cd /tmp/mapfish-print/src/main/webapp/

Then I copied my .yaml file and spec populated html file into that directory and ran a print with legends (icon and icons both tried).

Tried it with this legends block:

"legends": [
{
"name": "Potential Natural Vegetation",
"classes": [
{
"name": "Unclassified",
"icons": ["http://maps-b/cgi-bin/mapserv?map=/opt/mapserver/mapfiles/lenz.map&map.imagetype=svg&transparent=true&REQUEST=GetLegendGraphic&EXCEPTIONS=application%2Fvnd.ogc.se_xml&ICON=lenz_potnatveg_full%2C0&FORMAT=image%2Fsvg%2Bxml&MODE=legendicon&MAP.IMAGETYPE=svg","http://maps-b/cgi-bin/mapserv?map=/opt/mapserver/mapfiles/lenz.map&map.imagetype=svg&transparent=true&REQUEST=GetLegendGraphic&EXCEPTIONS=application%2Fvnd.ogc.se_xml&ICON=lenz_potnatveg_full%2C1&FORMAT=image%2Fsvg%2Bxml&MODE=legendicon&MAP.IMAGETYPE=svg"]
},
{
"scale": 1.5,
"name": "Kauri",
"icon": "http://maps-b/cgi-bin/mapserv?map=/opt/mapserver/mapfiles/lenz.map&map.imagetype=svg&transparent=true&REQUEST=GetLegendGraphic&EXCEPTIONS=application%2Fvnd.ogc.se_xml&ICON=lenz_potnatveg_full%2C1&FORMAT=image%2Fsvg%2Bxml&MODE=legendicon&MAP.IMAGETYPE=svg"
}
]
}]

and this:

"legends": []

and without the legends item altogether.

All of them work for me.

from mapfish-print.

jesseeichar avatar jesseeichar commented on July 29, 2024

HI TIm could you try the binary I uploaded? I think jonathan is more of a
user than a developer. Maybe the problem is with the binary?

On Thu, May 2, 2013 at 2:11 AM, Tim-Hinnerk Heuer
[email protected]:

OK, just to do it again and double check, I did the following:

$ cd /tmp
$ git clone git://github.com/mapfish/mapfish-print.git
$ cd mapfish-print/
$ gradle war
$ ./debugJetty
In another terminal:
$ cd /tmp/mapfish-print/src/main/webapp/

Then I copied my .yaml file and spec populated html file into that
directory and ran a print with legends (icon and icons both tried).

Tried it with this legends block:

"legends": [
{
"name": "Potential Natural Vegetation",
"classes": [
{
"name": "Unclassified",
"icons": ["
http://maps-b/cgi-bin/mapserv?map=/opt/mapserver/mapfiles/lenz.map&map.imagetype=svg&transparent=true&REQUEST=GetLegendGraphic&EXCEPTIONS=application%2Fvnd.ogc.se_xml&ICON=lenz_potnatveg_full%2C0&FORMAT=image%2Fsvg%2Bxml&MODE=legendicon&MAP.IMAGETYPE=svg
","
http://maps-b/cgi-bin/mapserv?map=/opt/mapserver/mapfiles/lenz.map&map.imagetype=svg&transparent=true&REQUEST=GetLegendGraphic&EXCEPTIONS=application%2Fvnd.ogc.se_xml&ICON=lenz_potnatveg_full%2C1&FORMAT=image%2Fsvg%2Bxml&MODE=legendicon&MAP.IMAGETYPE=svg
"]
},
{
"scale": 1.5,
"name": "Kauri",
"icon": "
http://maps-b/cgi-bin/mapserv?map=/opt/mapserver/mapfiles/lenz.map&map.imagetype=svg&transparent=true&REQUEST=GetLegendGraphic&EXCEPTIONS=application%2Fvnd.ogc.se_xml&ICON=lenz_potnatveg_full%2C1&FORMAT=image%2Fsvg%2Bxml&MODE=legendicon&MAP.IMAGETYPE=svg
"
}
]
}]

and this:

"legends": []

and without the legends item altogether.

All of them work for me.


Reply to this email directly or view it on GitHubhttps://github.com//issues/44#issuecomment-17314046
.

from mapfish-print.

jonathan-wcc avatar jonathan-wcc commented on July 29, 2024

Hi Tim - I figured Given 1.2 works and 2.0 doesn't and they're both being served from the same Jetty instance, permissions would be the same. It's running on a machine where it should have permission to do just about anything test environment - UAC off).
I did just look for the file its reporting - its not there, so I guess something deleted unless it was never created in the first place (would also explain why it can't delete it).

The POST request being sent to create.json is:

{"units":"m","srs":"EPSG:27700","layout":"A4 Landscape","dpi":150,"mapTitle":"","mapComment":"","mapFooter":"","layers":[{"baseURL":"http://wppgeog3:8082/geoserver/gwc/service/tms/","opacity":0.7,"singleTile":false,"type":"TMS","layer":"Warks_Full","maxExtent":[0,0,700000,1300000],"tileSize":[256,256],"resolutions":[2800,1400,700,350,175,87.5,43.75,21.875,10.9375,5.46875,2.734375,1.3671875,0.68359375,0.341796875,0.1708984375,0.08544921875],"format":"png"},{"baseURL":"http://wppgeog3:8082/geoserver/ows","opacity":1,"singleTile":true,"type":"WMS","layers":["OS_BD_COUNTY_WSHIRE"],"format":"image/png","styles":[""],"customParams":{"TRANSPARENT":true}},{"baseURL":"http://wppgeog3:8082/geoserver/ows","opacity":1,"singleTile":true,"type":"WMS","layers":["OS_BD_DIST_BOR_WSHIRE"],"format":"image/png","styles":[""],"customParams":{"TRANSPARENT":true}},{"baseURL":"http://wppgeog3:8082/geoserver/ows","opacity":1,"singleTile":true,"type":"WMS","layers":["OS_BD_COUNTY_SUBREG"],"format":"image/png","styles":[""],"customParams":{"TRANSPARENT":true}}],"pages":[{"center":[430000,270000],"scale":625000,"rotation":0}],"legends":[{"name":"Subregion Boundary","classes":[{"name":"","icons":["http://wppgeog3:8082/geoserver/ows?TRANSPARENT=TRUE&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetLegendGraphic&EXCEPTIONS=application%2Fvnd.ogc.se_xml&LAYER=OS_BD_COUNTY_SUBREG&FORMAT=image%2Fpng"]}]},{"name":"District Boundaries","classes":[{"name":"","icons":["http://wppgeog3:8082/geoserver/ows?TRANSPARENT=TRUE&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetLegendGraphic&EXCEPTIONS=application%2Fvnd.ogc.se_xml&LAYER=OS_BD_DIST_BOR_WSHIRE&FORMAT=image%2Fpng"]}]},{"name":"County Boundaries","classes":[{"name":"","icons":["http://wppgeog3:8082/geoserver/ows?TRANSPARENT=TRUE&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetLegendGraphic&EXCEPTIONS=application%2Fvnd.ogc.se_xml&LAYER=OS_BD_COUNTY_WSHIRE&FORMAT=image%2Fpng"]}]}]}

Using the .yaml file I posted earlier (A4 Landscape).

Jesse - Yep, I do develop some stuff, but not on Linux, and nothing to do with Java, so this is out of my domain. :-)

Using:
Windows 2008 R2 64bit
JRE6, update 43, 64bit
Jetty 8.1.10

from mapfish-print.

geekdenz avatar geekdenz commented on July 29, 2024

Hi Johnathan, can you please let me know the exact file you downloaded, so I can hopefully reproduce and fix your problem? Is it
https://oss.sonatype.org/content/repositories/snapshots/org/mapfish/print/print-servlet/2.0-SNAPSHOT/print-servlet-2.0-SNAPSHOT.war
because that is what I would assume.

from mapfish-print.

jonathan-wcc avatar jonathan-wcc commented on July 29, 2024

Hi Tim - Yep, that's the file. Thanks!

from mapfish-print.

geekdenz avatar geekdenz commented on July 29, 2024

Hi Jonathan,

I've tried almost everything possible for me now and cannot reproduce your problem. In fact, it works nicely with all scenarios I tried. I downloaded https://oss.sonatype.org/content/repositories/snapshots/org/mapfish/print/print-servlet/2.0-SNAPSHOT/print-servlet-2.0-SNAPSHOT.war and it all worked fine. I tried both Tomcat 7 and Jetty 6. I think it must be a permissions problem in your case or a misconfiguration. Permissions on Windows are weird and complicated, so I cannot help you there, sorry.

Maybe it is a problem in your configuration though. Unfortunately, we do not have a standard example for legends yet.

If you can expose the services to do your printing and give me the configuration files and everything, I could try your exact configuration and maybe help there, but this is all I can do.

Regards,
Tim

from mapfish-print.

jonathan-wcc avatar jonathan-wcc commented on July 29, 2024

Hi Tim.
That's weird. Its running as a console under my account - I have local admin rights and as mentioned UAC is off. I've never had a permissions issue on this machine because effectively, permissions are off. Also of course, the 1.2 from the same instance runs fine.

However, I have packaged up my entire Jetty directory with the two prints in the webapps and the yaml and images and stuff are in there too, along with the altered logging. Its about 58MB:
http://maps.warwickshire.gov.uk/jetty_8_print.zip

I then run C:\Jetty_8_print\bin\more_memory_startup.bat but I imagine that jetty.sh should do it for you.
Thanks again!

from mapfish-print.

geekdenz avatar geekdenz commented on July 29, 2024

It seems like the file is corrupted or missing something:

$ unzip jetty_8_print.zip
Archive: jetty_8_print.zip
End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
unzip: cannot find zipfile directory in one of jetty_8_print.zip or
jetty_8_print.zip.zip, and cannot find jetty_8_print.zip.ZIP, period.

from mapfish-print.

jesseeichar avatar jesseeichar commented on July 29, 2024

I was able to download and extract it myself. I will upload it as well to
another server.

On Sat, May 4, 2013 at 6:42 AM, Tim-Hinnerk Heuer
[email protected]:

It seems like the file is corrupted or missing something:

$ unzip jetty_8_print.zip
Archive: jetty_8_print.zip
End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
unzip: cannot find zipfile directory in one of jetty_8_print.zip or
jetty_8_print.zip.zip, and cannot find jetty_8_print.zip.ZIP, period.


Reply to this email directly or view it on GitHubhttps://github.com//issues/44#issuecomment-17427714
.

from mapfish-print.

jesseeichar avatar jesseeichar commented on July 29, 2024

Tim you can try downloading from:

http://dev.mapfish.org/jetty_8_print.zip

On Sat, May 4, 2013 at 12:16 PM, Jesse Eichar
[email protected]:

I was able to download and extract it myself. I will upload it as well to
another server.

On Sat, May 4, 2013 at 6:42 AM, Tim-Hinnerk Heuer <
[email protected]> wrote:

It seems like the file is corrupted or missing something:

$ unzip jetty_8_print.zip
Archive: jetty_8_print.zip
End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
unzip: cannot find zipfile directory in one of jetty_8_print.zip or
jetty_8_print.zip.zip, and cannot find jetty_8_print.zip.ZIP, period.


Reply to this email directly or view it on GitHubhttps://github.com//issues/44#issuecomment-17427714
.

from mapfish-print.

geekdenz avatar geekdenz commented on July 29, 2024

OK, downloaded on Windows and for some reason it does extract there, but after installing Java it now asks me to install GeoServer. Sorry, but I cannot give that level of support that will take me hours of installing things on Windows, fighting with environment variables and so on.

It works fine on Linux and obviously Mac OS. I'm sure it also works on Windows somehow. Maybe try re-installing everything or rebooting as that usually fixes everything in Windows.

from mapfish-print.

geekdenz avatar geekdenz commented on July 29, 2024

I think I know what the problem is. Let me try something Tomorrow...

from mapfish-print.

geekdenz avatar geekdenz commented on July 29, 2024

Tried with a simple instance of Jetty on Windows XP. It works fine, so my suspicion was wrong.

One thing to note:
Make sure the \tmp directory is there and writable to the jetty user. There should also be the log file.

I will need to make this more generic and actually write to the OS temp dir, but for now, creating \tmp might be the solution.

Let us know how it goes.

from mapfish-print.

geekdenz avatar geekdenz commented on July 29, 2024

Just to confirm, I was doing the right thing with the temporary directory:
https://github.com/mapfish/mapfish-print/blob/master/src/main/java/org/mapfish/print/config/layout/LegendsBlock.java
line 56.

You might need to check your configuration and that the temporary directory configured within Jetty/Java is writable to Jetty.

Can close?

from mapfish-print.

jonathan-wcc avatar jonathan-wcc commented on July 29, 2024

Hi Tim,
Thanks for all the effort you've put into this.
Ah, the GeoServer stuff is because that's what the batch-file is from (so I don't have to spend hours figuring out hwo to start Java). I figured you'd be running it on a *nix box. GeoServer isn't actually required. Sorry about that.

I tried seeing how to set temp directories in jetty, but this page says jetty itself has no temporary directories - http://docs.codehaus.org/display/JETTY/Temporary+Directories

The MFP documentation (http://mapfish.org/doc/print/installation.html#configuring-servlet-temp-directory ) assumes I know what an "init-param" is and how to set it.
I assumed its a start-up command line parameter so I tried appending "-tempdir C:/Temp/" to the Java options that are sent for startup, but it just complains "unrecognised option -tempdir Could not create Java Virtual machine".
I don't know that Java has a temp directory either. My searches all showed how to create one programmatically (i.e. http://stackoverflow.com/questions/617414/create-a-temporary-directory-in-java )
So I've left it unset.

I have global environmental variables set:
TEMP - C:\Windows\TEMP
TMP - C:\windows\TEMP

I have also confirmed that my user (which jetty is running as) has "FULL CONTROL" over the requisite directory. I confirmed this by creating/deleting stuff manually.

I downloaded a completely new/fresh Jetty 8, copied the two servlet directories into it, changed the port to 8090, and then started it using "java -jar start.jar" - exact same behaviour.

To re-iterate:

  • This user has write access to pretty much everywhere on this machine.
  • This works using the same instance with 1.2. 1.2 is using the same temp directory structure (it shows in the DEBUG level log events).
  • This only happens when printing legends. Regular printing works fine with 2.0.

Despite this being a Windows Server 2008 R2 install on an actual physical server, I also tried restarting it (restarting is rarely required with this setup I've found). No Effect.


All that said, later this week I'll be trying Tomcat, so I'll test 2.0 with this and get back to this thread then.

from mapfish-print.

geekdenz avatar geekdenz commented on July 29, 2024

As I said, I tried it on Windows XP and it works with legend. I double-checked the code (as I said above as well) that it uses the system's temporary directory for the temporary PDF file it requires for the legend. I need to write to the temporary file to find out the dimensions of text and icons, because without it, the iText PDF library doesn't give back the correct dimensions.

It should get the system's temp directory, which might be set to your user's temp directory. Have a look there. On Windows 7 it is under
%USERPROFILE%\AppData\Local\Temp
Are you starting Jetty under the same user? If you are then it cannot be a permissions problem. But I'm also pretty sure it is not a problem with the code.

Again, a fresh install of Jetty might do the trick because that worked for me as well on Windows.

I'm running out of ideas here...

from mapfish-print.

jonathan-wcc avatar jonathan-wcc commented on July 29, 2024

Hi Tim,
Well, the bad news is, I get the exact same behaviour with Tomcat (6.0.36)! 1.2 works, 2.0 doesn't. Same error message too.

It's running as the same user as me (just double-checked with Process Explorer) and therefore has my rights.

The only difference is that Tomcat seems to be using a different Temp directory:

2013-05-08 16:10:25,867 WARN [org.mapfish.print.servlet.BaseMapServlet] - Cannot delete file:C:\Tomcat\instances\print_instance\work\Catalina\localhost\print2.0\mapfish-print1555773716616471453.pdf.printout
2013-05-08 16:10:25,914 ERROR [org.mapfish.print.servlet.BaseMapServlet] - Error while generating PDF
com.lowagie.text.DocumentException: The document is not open yet; you can only add Meta information.
at com.lowagie.text.Document.add(Unknown Source)
at org.mapfish.print.config.layout.LegendsBlock$Renderer.getHeight(LegendsBlock.java:353)
at org.mapfish.print.config.layout.LegendsBlock$Renderer.render(LegendsBlock.java:190)

The file that it references above was actually in that directory (you may recall that with Jetty it wasn't to be found), and I could delete the file just fine (in fact, I just did!).
So, it's extremely unlikely to be permissions.

Maybe something is locking the file? Perhaps its trying to delete it before its finished writing or something? What changes were made between the 1.2 and 2.0 in that section of the code-base that would cause one to work and the other not to?

from mapfish-print.

jesseeichar avatar jesseeichar commented on July 29, 2024

It kind of sounds like windows has the file locked. On windows you have to
be extremely careful to release file connections because it prevents
deletion of the file or other connections to that file. On linux you won't
get similar behaviour.

Jesse

On Wed, May 8, 2013 at 6:27 PM, jonathan-wcc [email protected]:

Hi Tim,
Well, the bad news is, I get the exact same behaviour with Tomcat
(6.0.36)! 1.2 works, 2.0 doesn't. Same error message too.

It's running as the same user as me (just double-checked with Process
Explorer) and therefore has my rights.

The only difference is that Tomcat seems to be using a different Temp
directory:

2013-05-08 16:10:25,867 WARN [org.mapfish.print.servlet.BaseMapServlet] -
Cannot delete
file:C:\Tomcat\instances\print_instance\work\Catalina\localhost\print2.0\mapfish-print1555773716616471453.pdf.printout
2013-05-08 16:10:25,914 ERROR [org.mapfish.print.servlet.BaseMapServlet] -
Error while generating PDF

com.lowagie.text.DocumentException: The document is not open yet; you can
only add Meta information.
at com.lowagie.text.Document.add(Unknown Source)
at
org.mapfish.print.config.layout.LegendsBlock$Renderer.getHeight(LegendsBlock.java:353)
at
org.mapfish.print.config.layout.LegendsBlock$Renderer.render(LegendsBlock.java:190)

The file that it references above was actually in that directory (you may
recall that with Jetty it wasn't to be found), and I could delete the file
just fine (in fact, I just did!).
So, it's extremely unlikely to be permissions.

Maybe something is locking the file? Perhaps its trying to delete it
before its finished writing or something? What changes were made between
the 1.2 and 2.0 in that section of the code-base that would cause one to
work and the other not to?


Reply to this email directly or view it on GitHubhttps://github.com//issues/44#issuecomment-17617260
.

from mapfish-print.

jonathan-wcc avatar jonathan-wcc commented on July 29, 2024

Now we seem to have identified the issue, is there a timeline for a fix?

Also, GeoServer had something similar - see this comment for more info:
https://jira.codehaus.org/browse/GEOS-5536?focusedCommentId=325689&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-325689

So sounds like MapFish is trying to delete the file before its finished doing other things with the file.

from mapfish-print.

geekdenz avatar geekdenz commented on July 29, 2024

Have we identified it? Jesse had a guess to what it is. I will have to check and confirm this is the case. I will invest about an hour today to test it on my Windows 7 VM. If I don't find this issue, we will need to investigate further.

from mapfish-print.

geekdenz avatar geekdenz commented on July 29, 2024

OK, I invested another hour into this issue and cannot reproduce it.

I've tried Windows XP and Windows 7 with a local copy of the simple JRE 7 and the latest version of Jetty. In both cases the print module works as expected.

As I said: Try reinstalling Jetty or another Servlet container like Tomcat and it should work.

from mapfish-print.

jonathan-wcc avatar jonathan-wcc commented on July 29, 2024

Hi Tom,
There seems to have been some confusion. Per this comment, I tried a completely new Jetty to no avail:
#44 (comment)

Per this comment, I'm now running it under TomCat:
#44 (comment)

The issue continues to be evidenced in both circumstances. Hence concluding it wasn't a servlet specific thing but probably file locking. I'll investigate a bit further here.

from mapfish-print.

geekdenz avatar geekdenz commented on July 29, 2024

Hi Jon, It's Tim btw...

Have you tried manually deleting that .printout file? Also, that file seems to be a printout rather than a temp file to do with the legend. So, I don't think it is a problem with the legend code.

from mapfish-print.

geekdenz avatar geekdenz commented on July 29, 2024

Just reading through the comments again... It seems like you did indeed delete the file successfully.

Mh. Will need to figure out exactly what version is the one you are using to know what is on line 353 of LegendsBlock.java.

from mapfish-print.

jonathan-wcc avatar jonathan-wcc commented on July 29, 2024

Yep. I've attached a copy of the file it says it can't delete on the off chance its useful.

The version I'm using is the one built by Jesse here: https://oss.sonatype.org/content/repositories/snapshots/org/mapfish/print/print-standalone/2.0-SNAPSHOT/ - so the May 1st one.

I can arrange a web-ex for you if that would help.

from mapfish-print.

geekdenz avatar geekdenz commented on July 29, 2024

You can add me on gmail chat if you like: th.heuer AT gmail DOT com

from mapfish-print.

geekdenz avatar geekdenz commented on July 29, 2024

Hey that link... Are you using the jar version?

from mapfish-print.

jbjonesjr avatar jbjonesjr commented on July 29, 2024

Also of interest (or at least is surprising to me) the log messages that jonathan is printing out don't seem to match my current version of the code... (And not much has changed in that section in the past month).

Jon, are you sure you have the latest code? Have you tried this from the "embedded" jetty server that comes with the gradle build?

from mapfish-print.

geekdenz avatar geekdenz commented on July 29, 2024

There were a few changes between then and now. See

.

Line 353 is the one where the exception occurs, so it's where it's trying to add an element to the temp file which is when it is indeed writing to it.

from mapfish-print.

jbjonesjr avatar jbjonesjr commented on July 29, 2024

What's weird is line 190 now jumps me to somewhere around line 540, not in the mid 300's. oh well.

It might be interesting to print out some other details about the file before and after the "tempdocument" is opened. Instead of passing the filename to the filestream, instead manually create a filehandle and pass that in.

                File tempFileHandle = new File(tempFilename);
                writer = PdfWriter.getInstance(tempDocument,
                        new FileOutputStream(tempFileHandle));

That may at least let us do some more debugging/error checking on the file itself. (Instead of letting PDFWriter swallow the error.

from mapfish-print.

jonathan-wcc avatar jonathan-wcc commented on July 29, 2024

Hi Jamie, I don't know where the gradle build + jetty server is.
I'm using this version - https://oss.sonatype.org/content/repositories/snapshots/org/mapfish/print/print-servlet/2.0-SNAPSHOT/print-servlet-2.0-SNAPSHOT.war - I don't know where its built from or anything.
Cheers,
Jonathan

from mapfish-print.

jesseeichar avatar jesseeichar commented on July 29, 2024

I will make a new release... I think the datestamp should be in the
META-INF folder somewhere. I will try to see if I can add the git commit
number as well somehow.

Done. There is another snapshot online.

Now in all (or at least most) of the packages the MANIFEST.MF files
contains the hash of the current git version. (assuming the person who
builds the package has git installed and it is available via the command
line to gradle)

Jesse

Jesse

On Tue, Jun 4, 2013 at 8:43 AM, jonathan-wcc [email protected]:

Hi Jamie, I don't know where the gradle build + jetty server is.
I'm using this version -
https://oss.sonatype.org/content/repositories/snapshots/org/mapfish/print/print-servlet/2.0-SNAPSHOT/print-servlet-2.0-SNAPSHOT.war- I don't know where its built from or anything.
Cheers,
Jonathan


Reply to this email directly or view it on GitHubhttps://github.com//issues/44#issuecomment-18891839
.

from mapfish-print.

jonathan-wcc avatar jonathan-wcc commented on July 29, 2024

The crashing issue seems to have magically been fixed in the new build (Tim provided one too).

The originally reported issue was me having misconfigured something. Ooops. Can be closed now either way.

Thanks everyone!

from mapfish-print.

geekdenz avatar geekdenz commented on July 29, 2024

Glad we could sort it out.

from mapfish-print.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.