cluster results using factoextra package fviz_dend() to draw a wrong result - cluster-analysis

Here is my data spe.ch.method:
spe.ch.method <-
structure(list(merge = structure(c(-7L, -38L, -19L, -6L, -13L,
-2L, -8L, -23L, -36L, -10L, -29L, -25L, -16L, -3L, -35L, -22L,
-32L, 4L, 12L, -9L, 16L, -14L, 10L, 3L, -26L, 18L, -21L, 20L,
24L, 15L, 9L, 25L, 27L, 22L, 33L, 35L, 34L, -4L, -24L, -33L,
-37L, -17L, -20L, -1L, -18L, 1L, -12L, -5L, 6L, 5L, -34L, 11L,
-11L, -15L, 14L, 7L, 2L, -27L, 13L, 19L, 21L, -30L, 8L, -31L,
26L, 17L, 23L, -28L, 31L, 28L, 30L, 29L, 32L, 36L), .Dim = c(37L,
2L)), height = c(0.00636619772367553, 0.00636619772367597, 0.00954929658551418,
0.0127323954473515, 0.0127323954473516, 0.0159154943091897, 0.0222816920328652,
0.0222816920328652, 0.0294042077558286, 0.0381971863420549, 0.0477464829275686,
0.0679972304353541, 0.0771860453590509, 0.101859163578813, 0.108428016099619,
0.130507053335355, 0.155971844230057, 0.207072752716134, 0.222727472454222,
0.231558136077153, 0.244422476970328, 0.284589332450292, 0.368020665934361,
0.410114423448918, 0.448816939519144, 0.46521909140276, 0.611154981472878,
0.781981287058179, 0.9474918022082, 1.04498838881851, 1.14095631913861,
1.71533296271409, 2.22787742308588, 2.23744457877555, 4.11682456910057,
8.82355004501468, 16.2866428471926), order = c(14L, 16L, 13L,
17L, 35L, 29L, 5L, 10L, 12L, 25L, 2L, 20L, 8L, 1L, 21L, 31L,
9L, 38L, 24L, 6L, 37L, 3L, 34L, 23L, 18L, 19L, 33L, 22L, 11L,
27L, 32L, 15L, 26L, 30L, 36L, 7L, 4L, 28L), labels = c("CB1",
"CB2", "CB3", "CB4", "CB5", "CB6", "CB7", "CB8", "CB9", "CB10",
"CB11", "CB12", "CB13", "CB14", "CB15", "CB16", "CB17", "CB18",
"CB19", "CB20", "CC1", "CC2", "CC3", "CC4", "CC5", "CC6", "CC7",
"CC8", "CC9", "CC10", "CC11", "CC12", "CC13", "CC14", "CC15",
"CC16", "CC17", "CC18"), method = "ward.D2", call = hclust(d = spe.ch,
method = clstrMethod), dist.method = "euclidean"), class = "hclust")
And here is example data res.hc:
res.hc <-
structure(list(merge = structure(c(-15L, -13L, -14L, -23L, -36L,
-20L, -37L, -19L, -46L, -41L, -26L, -1L, -35L, -24L, -21L, -12L,
5L, -43L, -34L, -4L, -10L, -7L, -11L, -22L, -17L, 12L, -33L,
-5L, -3L, -25L, 10L, 8L, -6L, -39L, -8L, 18L, 17L, -9L, 22L,
25L, 31L, 26L, 33L, 35L, 40L, -2L, 41L, 43L, 47L, -29L, -32L,
-16L, -49L, 3L, -31L, -47L, 1L, -50L, -48L, -27L, -18L, -38L,
-40L, -30L, 11L, 13L, 2L, -45L, 9L, -42L, 4L, -44L, 6L, 20L,
21L, 14L, -28L, 24L, 7L, 19L, 16L, 28L, 15L, 34L, 29L, 23L, 36L,
37L, 30L, 32L, 27L, 38L, 39L, 44L, 42L, 45L, 46L, 48L), .Dim = c(49L,
2L)), height = c(0.205853857157348, 0.350218756601623, 0.42877117242016,
0.494083187830451, 0.530325907996572, 0.535389255696797, 0.593534342646989,
0.645715762772523, 0.703830908172413, 0.71088117569639, 0.738993588868799,
0.772222449786047, 0.778129827091505, 0.786567350290742, 0.797764154308547,
0.828693622706567, 0.841289957946828, 0.845769739265785, 0.982485681621528,
0.997103491446316, 1.01222520768599, 1.03545970319198, 1.07097197299987,
1.08009876392544, 1.09186240041721, 1.13143510536774, 1.18268909786155,
1.19682607716751, 1.21173556211688, 1.25027523499501, 1.27168083812686,
1.33295040067908, 1.39885947095838, 1.46683777170002, 1.62304947693353,
1.64485743320623, 1.6585735917931, 1.85379841079867, 1.86498009205068,
2.26302421304787, 2.29522869690842, 2.33746531357676, 2.44585996576722,
2.47488073347208, 3.08834296946717, 3.2554325818601, 4.40054164699477,
4.42007357714693, 6.07664156265458), order = c(41L, 48L, 34L,
45L, 19L, 15L, 29L, 12L, 26L, 27L, 17L, 4L, 46L, 50L, 25L, 37L,
47L, 8L, 39L, 21L, 30L, 7L, 23L, 49L, 36L, 14L, 16L, 35L, 38L,
11L, 44L, 6L, 5L, 28L, 9L, 43L, 13L, 32L, 3L, 22L, 20L, 31L,
2L, 1L, 18L, 10L, 42L, 33L, 24L, 40L), labels = c("Alabama",
"Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut",
"Delaware", "Florida", "Georgia", "Hawaii", "Idaho", "Illinois",
"Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine",
"Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi",
"Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire",
"New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota",
"Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island",
"South Carolina", "South Dakota", "Tennessee", "Texas", "Utah",
"Vermont", "Virginia", "Washington", "West Virginia", "Wisconsin",
"Wyoming"), method = "complete", call = hclust(d = dist(df)),
dist.method = "euclidean"), class = "hclust")
When I run as below:
fviz_dend(spe.ch.method, #or data is res.hc
cex = 0.5,
k =2
,rect = TRUE,
,rect_fill= TRUE
,rect_border = c("red","blue")
)
There are two results. One using data of res.hc is ok.
But another one using data of spe.ch.method is an error and without image output. Error: Aesthetics must be either length 1 or the same as the data (4): color and fill.
Hope someone help me. Thank you very much.

Related

Persistent Drawer not working with material-ui v5

I'm trying the Persistent Drawer example as it is in the documentation https://next.material-ui.com/components/drawers/#persistent-drawer, but it's not compiling.
/Users/alex/Dev/wnav-react2/src/App.tsx
TypeScript error in /Users/alex/Dev/wnav-react2/src/App.tsx(24,15):
Property 'open' does not exist on type '{ theme?: Theme | undefined; as?: ElementType<any> | undefined; sx?: SxProps<Theme> | undefined; } & ClassAttributes<HTMLElement> & HTMLAttributes<...> & { ...; }'. TS2339
22 |
23 | const Main = styled('main', { shouldForwardProp: (prop) => prop !== 'open' })(
> 24 | ({ theme, open }) => ({
| ^
25 | flexGrow: 1,
26 | padding: theme.spacing(3),
27 | transition: theme.transitions.create('margin', {
Any clue what could be the error?
package.json:
"#emotion/react": "^11.4.1",
"#emotion/styled": "^11.3.0",
"#material-ui/core": "^5.0.0-beta.4",
"#material-ui/icons": "^5.0.0-beta.4",
"#testing-library/jest-dom": "^5.11.4",
"#testing-library/react": "^11.1.0",
"#testing-library/user-event": "^12.1.10",
"#types/jest": "^26.0.15",
"#types/node": "^12.0.0",
"#types/react": "^17.0.0",
"#types/react-dom": "^17.0.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-scripts": "4.0.3",
"typescript": "^4.1.2",
"web-vitals": "^1.0.1"
try
yarn add #mui/material #mui/icons-material #mui/styles

Mapfish & Geoserver & Leaflet

I'm using Geoserver 2.13.2 with leaflet0.7.2, I have deployed Geoserver Tomcat 9.0 and followed all steps mentioned in this and I have installed mapfish v3.
I'm trying to print a map and wms layers and I'm using the this plugin.
But when I start printing I got following problem:
Error while generating PDF:
com.itextpdf.text.DocumentException: org.mapfish.print.InvalidJsonValueException: spec.layers[0].baseURL has an invalid value: http://a.tile.openstreetmap.org/ (spec.layers[0].baseURL has an invalid value: http://a.tile.openstreetmap.org/)
at com.itextpdf.text.pdf.PdfDocument.add(PdfDocument.java:821)
at com.itextpdf.text.Document.add(Document.java:277)
at org.mapfish.print.config.layout.Page$1.add(Page.java:76)
at org.mapfish.print.config.layout.MapBlock.render(MapBlock.java:81)
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:31)
at org.mapfish.print.output.PdfOutputFactory.print(PdfOutputFactory.java:58)
at org.mapfish.print.MapPrinter.print(MapPrinter.java:176)
at org.mapfish.print.servlet.MapPrinterServlet.doCreatePDFFile(MapPrinterServlet.java:370)
at org.mapfish.print.servlet.MapPrinterServlet.createAndGetPDF(MapPrinterServlet.java:166)
at org.mapfish.print.servlet.MapPrinterServlet.doGet(MapPrinterServlet.java:97)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:634)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
at org.springframework.web.servlet.mvc.ServletWrappingController.handleRequestInternal(ServletWrappingController.java:165)
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:177)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:52)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:998)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:890)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:634)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:875)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.geoserver.filters.ThreadLocalsCleanupFilter.doFilter(ThreadLocalsCleanupFilter.java:26)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.geoserver.filters.SpringDelegatingFilter$Chain.doFilter(SpringDelegatingFilter.java:69)
at org.geoserver.wms.animate.AnimatorFilter.doFilter(AnimatorFilter.java:73)
at org.geoserver.filters.SpringDelegatingFilter$Chain.doFilter(SpringDelegatingFilter.java:66)
at org.geoserver.filters.SpringDelegatingFilter.doFilter(SpringDelegatingFilter.java:41)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.geoserver.platform.AdvancedDispatchFilter.doFilter(AdvancedDispatchFilter.java:37)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:320)
at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:70)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:74)
at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:70)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:119)
at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:74)
at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.geoserver.security.filter.GeoServerAnonymousAuthenticationFilter.doFilter(GeoServerAnonymousAuthenticationFilter.java:51)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:70)
at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilterInternal(BasicAuthenticationFilter.java:158)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:74)
at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)
at org.geoserver.security.filter.GeoServerBasicAuthenticationFilter.doFilter(GeoServerBasicAuthenticationFilter.java:81)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:70)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)
at org.geoserver.security.filter.GeoServerSecurityContextPersistenceFilter$1.doFilter(GeoServerSecurityContextPersistenceFilter.java:52)
at org.geoserver.security.filter.GeoServerCompositeFilter$NestedFilterChain.doFilter(GeoServerCompositeFilter.java:74)
at org.geoserver.security.filter.GeoServerCompositeFilter.doFilter(GeoServerCompositeFilter.java:91)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:334)
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:215)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:178)
at org.geoserver.security.GeoServerSecurityFilterChainProxy.doFilter(GeoServerSecurityFilterChainProxy.java:142)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:357)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:270)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.geoserver.filters.LoggingFilter.doFilter(LoggingFilter.java:101)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.geoserver.filters.XFrameOptionsFilter.doFilter(XFrameOptionsFilter.java:79)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.geoserver.filters.GZIPFilter.doFilter(GZIPFilter.java:47)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.geoserver.filters.SessionDebugFilter.doFilter(SessionDebugFilter.java:46)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.geoserver.filters.FlushSafeFilter.doFilter(FlushSafeFilter.java:42)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:688)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:373)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1594)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)
Caused by: org.mapfish.print.InvalidJsonValueException: spec.layers[0].baseURL has an invalid value: http://a.tile.openstreetmap.org/ (spec.layers[0].baseURL has an invalid value: http://a.tile.openstreetmap.org/)
at org.mapfish.print.map.readers.HTTPMapReader.checkSecurity(HTTPMapReader.java:136)
at org.mapfish.print.map.readers.HTTPMapReader.<init>(HTTPMapReader.java:76)
at org.mapfish.print.map.readers.TileableMapReader.<init>(TileableMapReader.java:42)
at org.mapfish.print.map.readers.OsmMapReader.<init>(OsmMapReader.java:50)
at org.mapfish.print.map.readers.OsmMapReader$Factory.create(OsmMapReader.java:43)
at org.mapfish.print.map.readers.MapReaderFactoryFinder.create(MapReaderFactoryFinder.java:36)
at org.mapfish.print.map.MapChunkDrawer.renderImpl(MapChunkDrawer.java:120)
at org.mapfish.print.ChunkDrawer.render(ChunkDrawer.java:55)
at org.mapfish.print.ChunkDrawer.tableLayout(ChunkDrawer.java:49)
at com.itextpdf.text.pdf.PdfPTable.writeSelectedRows(PdfPTable.java:855)
at com.itextpdf.text.pdf.ColumnText.goComposite(ColumnText.java:1978)
at com.itextpdf.text.pdf.ColumnText.go(ColumnText.java:999)
at com.itextpdf.text.pdf.ColumnText.go(ColumnText.java:993)
at com.itextpdf.text.pdf.ColumnText.go(ColumnText.java:981)
at com.itextpdf.text.pdf.PdfPRow.writeCells(PdfPRow.java:583)
at com.itextpdf.text.pdf.PdfPTable.writeSelectedRows(PdfPTable.java:831)
at com.itextpdf.text.pdf.PdfPTable.writeSelectedRows(PdfPTable.java:964)
at com.itextpdf.text.pdf.ColumnText.goComposite(ColumnText.java:1986)
at com.itextpdf.text.pdf.ColumnText.go(ColumnText.java:999)
at com.itextpdf.text.pdf.ColumnText.go(ColumnText.java:993)
at com.itextpdf.text.pdf.ColumnText.go(ColumnText.java:981)
at com.itextpdf.text.pdf.PdfDocument.addPTable(PdfDocument.java:2717)
at com.itextpdf.text.pdf.PdfDocument.add(PdfDocument.java:759)
... 111 more
Caused by: org.mapfish.print.InvalidJsonValueException: spec.layers[0].baseURL has an invalid value: http://a.tile.openstreetmap.org/
at org.mapfish.print.map.readers.HTTPMapReader.checkSecurity(HTTPMapReader.java:133)
... 133 more
Here is the config.yml file:
#===========================================================================
# allowed DPIs
#===========================================================================
dpis: [75, 150, 300,254,72]
#===========================================================================
# the allowed scales
#===========================================================================
scales:
- 25000
- 50000
- 100000
- 200000
- 500000
- 1000000
- 2000000
- 4000000
#===========================================================================
# the list of allowed hosts
#===========================================================================
hosts:
- !localMatch
dummy: true
- !ipMatch
ip: www.camptocamp.org
- !dnsMatch
host: demo.opengeo.org
port: 80
- !dnsMatch
host: terraservice.net
port: 80
- !dnsMatch
host: sigma.openplans.org
- !dnsMatch
host: demo.mapfish.org
layouts:
Legal:
mainPage:
pageSize: LEGAL
items:
- !map
spacingAfter: 30
width: 440
height: 483
#===========================================================================
A4 portrait:
#===========================================================================
metaData:
# title: '${mapTitle}'
author: 'MapFish print module'
subject: 'Simple layout'
keywords: 'map,print'
creator: 'MapFish'
titlePage:
pageSize: A4
items:
- !text
spacingAfter: 150
- !text
font: Helvetica
fontSize: 40
spacingAfter: 100
align: center
text: '${layout}'
- !image
maxWidth: 160
maxHeight: 160
spacingAfter: 100
align: center
url: http://trac.mapfish.org/trac/mapfish/attachment/ticket/3/logo_v8_sphere.svg?format=raw
footer: &commonFooter
height: 30
items:
- !columns
config:
cells:
- paddingBottom: 5
items:
- !text
backgroundColor: #FF0000
align: left
text: a red box
- !text
align: right
text: 'Page ${pageNum}'
- !image
align: center
maxWidth: 100
maxHeight: 30
spacingAfter: 200
url: 'http://geoserver.org/img/geoserver-logo.png'
#-------------------------------------------------------------------------
mainPage:
pageSize: A4
rotation: true
# header:
# height: 50
# items:
# - !text
# font: Helvetica
# fontSize: 30
# align: right
# text: '${layout}'
items:
- !text
text: '${mapTitle}'
fontSize: 30
spacingAfter: 30
- !map
spacingAfter: 30
width: 440
height: 483
- !columns
# columns can have an absolute position. In that case, they need the 3 following fields:
absoluteX: 410
absoluteY: 310
width: 100
items:
- !scalebar
type: bar
maxSize: 100
barBgColor: white
fontSize: 8
align: right
- !text
text: '${comment}'
spacingAfter: 30
- !attributes
source: data
spacingAfter: 30
columnDefs:
id:
columnWeight: 2
header: !text
text: ID
backgroundColor: #A0A0A0
cell: !text
text: '${id}'
name:
columnWeight: 5
header: !text
text: Name
backgroundColor: #A0A0A0
cell: !columns
config:
cells:
- backgroundColor: '${nameBackgroundColor}'
borderWidth: 1
borderColor: '${nameBorderColor}'
items:
- !text
text: '${name}'
icon:
columnWeight: 2
header: !text
text: Symbol
backgroundColor: #A0A0A0
cell: !image
align: center
maxWidth: 15
maxHeight: 15
url: 'http://www.mapfish.org/svn/mapfish/trunk/MapFish/client/mfbase/mapfish/img/${icon}.png'
- !text
font: Helvetica
fontSize: 9
align: right
text: '1:${scale} ${now MM.dd.yyyy}'
footer: *commonFooter
What do I need to do for printing to work??

SCP Plugin configuration using Groovy script

I am facing issues when configuring the Jenkins SCP plugin using Groovy scripts. I tried several approaches, but I did not succeed to add SCP site entries to the Jenkins configuration.
I tried the following:
import be.certipost.hudson.plugin.*
import jenkins.model.*
import hudson.model.*
import hudson.utils.*
import hudson.util.CopyOnWriteList
import org.kohsuke.stapler.StaplerRequest
import org.kohsuke.stapler.QueryParameter;
// Get the Jenkins instance.
def instance = Jenkins.getInstance()
// Get the Git plugin descriptor.
pluginURL = "be.certipost.hudson.plugin.SCPRepositoryPublisher"
def desc = instance.getDescriptor(pluginURL)
// Create a new SCPSite.
scpsite = new SCPSite('hostname', '22', 'username', 'password', 'rootRepositoryPath')
// Store it to an arraylist.
ArrayList<SCPSite> siteList = new ArrayList<SCPSite>();
siteList.add(scpsite)
// Also try to store it in a CopyOnWriteList.
lossitios = new CopyOnWriteList<SCPSite>()
lossitios.add(scpsite)
Each approach fails with an exception, either the replaceBy() method is not accessible, either I get an UnsupportedOperationException.
// Update the configuration (both approaches fail)
//desc.sites.replaceBy(siteList)
desc.sites.replaceBy(lossitios)
desc.save()
I also tried by using an approach I found here (https://github.com/jenkinsci/slack-plugin/issues/23):
scp = instance.getExtensionList(
be.certipost.hudson.plugin.SCPRepositoryPublisher.DescriptorImpl.class
)[0]
def params = [
hostname = "hostname",
port = 22,
username = "username",
password = "password",
rootRepositoryPath = "rootRepositoryPath",
]
def req = [
getParameter: { name -> params[name] }
] as org.kohsuke.stapler.StaplerRequest
desc.configure(req, null)
desc.save()
EDIT
The exception I get when I use the replaceBy() method is:
groovy.lang.MissingMethodException: No signature of method: [Lbe.certipost.hudson.plugin.SCPSite;.replaceBy() is applicable for argument types: (java.util.ArrayList) values: [[be.certipost.hudson.plugin.SCPSite#44605afb]]
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:55)
at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:46)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at Script1.run(Script1.groovy:36)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:580)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:618)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:589)
at hudson.util.RemotingDiagnostics$Script.call(RemotingDiagnostics.java:142)
at hudson.util.RemotingDiagnostics$Script.call(RemotingDiagnostics.java:114)
at hudson.remoting.LocalChannel.call(LocalChannel.java:45)
at hudson.util.RemotingDiagnostics.executeGroovy(RemotingDiagnostics.java:111)
at jenkins.model.Jenkins._doScript(Jenkins.java:3566)
at jenkins.model.Jenkins.doScript(Jenkins.java:3538)
at sun.reflect.GeneratedMethodAccessor275.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:298)
at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:161)
at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:96)
at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:121)
at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649)
at org.kohsuke.stapler.Stapler.service(Stapler.java:238)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:686)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1494)
at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:132)
at hudson.plugins.greenballs.GreenBallFilter.doFilter(GreenBallFilter.java:59)
at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:129)
at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:200)
at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:178)
at net.bull.javamelody.PluginMonitoringFilter.doFilter(PluginMonitoringFilter.java:85)
at org.jvnet.hudson.plugins.monitoring.HudsonMonitoringFilter.doFilter(HudsonMonitoringFilter.java:99)
at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:129)
at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:123)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:49)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76)
at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1474)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:499)
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:1086)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:428)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
at org.eclipse.jetty.server.Server.handle(Server.java:370)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489)
at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:960)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1021)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865)
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:668)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
The exception I get when using the desc.configure() approach is:
java.lang.UnsupportedOperationException
at org.codehaus.groovy.runtime.ConvertedMap.invokeCustom(ConvertedMap.java:49)
at org.codehaus.groovy.runtime.ConversionHandler.invoke(ConversionHandler.java:82)
at com.sun.proxy.$Proxy59.bindParametersToList(Unknown Source)
at be.certipost.hudson.plugin.SCPRepositoryPublisher$DescriptorImpl.configure(SCPRepositoryPublisher.java:298)
at be.certipost.hudson.plugin.SCPRepositoryPublisher$DescriptorImpl$configure.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
at Script1.run(Script1.groovy:53)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:580)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:618)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:589)
at hudson.util.RemotingDiagnostics$Script.call(RemotingDiagnostics.java:142)
at hudson.util.RemotingDiagnostics$Script.call(RemotingDiagnostics.java:114)
at hudson.remoting.LocalChannel.call(LocalChannel.java:45)
at hudson.util.RemotingDiagnostics.executeGroovy(RemotingDiagnostics.java:111)
at jenkins.model.Jenkins._doScript(Jenkins.java:3566)
at jenkins.model.Jenkins.doScript(Jenkins.java:3538)
at sun.reflect.GeneratedMethodAccessor275.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:298)
at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:161)
at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:96)
at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:121)
at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649)
at org.kohsuke.stapler.Stapler.service(Stapler.java:238)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:686)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1494)
at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:132)
at hudson.plugins.greenballs.GreenBallFilter.doFilter(GreenBallFilter.java:59)
at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:129)
at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:200)
at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:178)
at net.bull.javamelody.PluginMonitoringFilter.doFilter(PluginMonitoringFilter.java:85)
at org.jvnet.hudson.plugins.monitoring.HudsonMonitoringFilter.doFilter(HudsonMonitoringFilter.java:99)
at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:129)
at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:123)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:49)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76)
at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1482)
at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1474)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:499)
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:1086)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:428)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
at org.eclipse.jetty.server.Server.handle(Server.java:370)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489)
at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:960)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1021)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865)
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:668)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Where Script1.run(Script1.groovy:53) is my call to desc.configure(req, null).
Recently had to solve this, the problem is in the request you are creating. If you look at the source code for he plugin at https://github.com/jenkinsci/scp-plugin/blob/7ce951d1a3861c6837d71f87cbb553feb7b6c222/src/main/java/be/certipost/hudson/plugin/SCPRepositoryPublisher.java#L318
#Override
public boolean configure(StaplerRequest req, JSONObject formData) {
sites.replaceBy(req.bindJSONToList(SCPSite.class,
formData.get("sites")));
save();
return true;
}
The call on the StaplerRequest object that you need to provide is the bindJSONToList, and secondly you also need to provide a JSONObject that can have '.get("sites")' called on it.
Following code solves both of these (probably some improvements possible since I just threw this together to get past the same issue):
import be.certipost.hudson.plugin.*;
import org.kohsuke.stapler.StaplerRequest;
import net.sf.json.JSONObject;
def instance = Jenkins.getInstance()
pluginURL = "be.certipost.hudson.plugin.SCPRepositoryPublisher"
def desc = instance.getDescriptor(pluginURL)
params = [
sites: [
// one site per line as an array of options
// displayname, hostname, port, username, password, keyfile, path
["site-name", "hostname", "22", "username", "password", null, "/root/path"]
]
]
scp_sites = params['sites'].collect { it -> it as SCPSite }
// notice the only call we are providing as for the the request
// object is bindJSONToList, and we don't care about the
// original arguments since just returning predefined data
def req = [
bindJSONToList: { klazz, data -> scp_sites }
] as org.kohsuke.stapler.StaplerRequest
desc.configure(req, params as JSONObject)
desc.save()

Hibernate search hanging with large amount of entities

I have database of geonames (more than 8 000 000) entities, which are indexed by hibernate search.
I also have users and geonames associated with them. When I try to search for users, webapp hangs and not responding anymore and shutting down Tomcat doesn't terminates it's Java process.
According to logs, transaction starts and doesn't finish. And what is strange: on laptop with same Postgresql version this works fine but hangs on virtualbox server with same 4 GB RAM.
Also while hanging there were enough free memory space, so the problem is not in that. What could be the reason of it?
My configuration:
postgresql 9.3.4
postgis 2.1.1
hibernate search 4.2
Laptop:
arch-linux x64,
virtualbox server:
ubuntu server 12.10
update: I realized that it creashes on spatial sorting, but there's no same error with another entity having the same assosiations with geonames. Here's error log:
org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.OutOfMemoryError: Java heap space
at org.springframework.web.servlet.DispatcherServlet.triggerAfterCompletionWithError(DispatcherServlet.java:1259)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:945)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:183)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1008)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.OutOfMemoryError: Java heap space
at org.apache.lucene.util.collections.IntToDoubleMap.(IntToDoubleMap.java:226)
at org.apache.lucene.util.collections.IntToDoubleMap.grow(IntToDoubleMap.java:418)
at org.apache.lucene.util.collections.IntToDoubleMap.put(IntToDoubleMap.java:492)
at org.hibernate.search.spatial.impl.DistanceComparator.setNextReader(DistanceComparator.java:78)
at org.apache.lucene.search.TopFieldCollector$OneComparatorNonScoringCollector.setNextReader(TopFieldCollector.java:95)
at org.hibernate.search.query.collector.impl.MapFieldCacheCollectorImpl.setNextReader(MapFieldCacheCollectorImpl.java:64)
at org.hibernate.search.query.collector.impl.TwoWayTransformingFieldCacheCollector.setNextReader(TwoWayTransformingFieldCacheCollector.java:59)
at org.apache.lucene.search.IndexSearcher.search(IndexSearcher.java:576)
at org.hibernate.search.query.engine.impl.QueryHits.updateTopDocs(QueryHits.java:243)
at org.hibernate.search.query.engine.impl.QueryHits.(QueryHits.java:144)
at org.hibernate.search.query.engine.impl.HSQueryImpl.getQueryHits(HSQueryImpl.java:457)
at org.hibernate.search.query.engine.impl.HSQueryImpl.queryEntityInfos(HSQueryImpl.java:254)
at org.hibernate.search.query.hibernate.impl.FullTextQueryImpl.list(FullTextQueryImpl.java:209)
at ru.budetsdelano.startup.server.dao.impl.UserServiceImpl.findPerformers(UserServiceImpl.java:304)
at ru.budetsdelano.startup.server.dao.impl.UserServiceImpl$$FastClassByCGLIB$$a2118199.invoke()
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:698)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:631)
at ru.budetsdelano.startup.server.dao.impl.UserServiceImpl$$EnhancerByCGLIB$$4966a48e.findPerformers()
at ru.budetsdelano.startup.server.controller.json.JsonSearchForPerformersController.searchFreePerformers(JsonSearchForPerformersController.java:70)
at ru.budetsdelano.startup.server.controller.json.JsonSearchForPerformersController$$FastClassByCGLIB$$edd7b285.invoke()
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:698)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
update: here is search method:
FullTextSession fullTextSession = Search.getFullTextSession(sessionFactory.getCurrentSession());
QueryBuilder queryBuilder =fullTextSession.getSearchFactory().buildQueryBuilder().forEntity(User.class).get();
org.apache.lucene.search.Query spatialQuery =queryBuilder.spatial().onCoordinates("pl").within(50000, Unit.KM).ofLatitude(latitude).andLongitude(longtitude).createQuery();
org.apache.lucene.search.Query isPerformerQuery = queryBuilder.keyword().onField("performer").matching(true).createQuery();
org.apache.lucene.search.Query nameQuery = ((!keywords.equals("") && (keywords != null))) ? queryBuilder.phrase().withSlop(10).onField("name").sentence(keywords).createQuery() : null;
org.apache.lucene.search.Query geonameIdQuery = geonameid != null ? queryBuilder.keyword().onField("city.geonameid").matching(geonameid).createQuery(): null ;
org.apache.lucene.search.Query profileQuery = (profile != null)? queryBuilder.keyword().onField("profiles_string").matching(profile).createQuery() : null;
org.apache.lucene.search.Query minimalBudgetQuery = queryBuilder.range().onField("minimal_budget").from(minimalBudget != null ? minimalBudget : 0L).to(maximumBudget != null ? maximumBudget :Long.MAX_VALUE).createQuery();
org.apache.lucene.search.Query minimalRatingQuery = minimalRating!= null ? queryBuilder.range().onField("task_rate").from(Double.valueOf(minimalRating)).to(Double.valueOf(5)).createQuery() : null;
org.apache.lucene.search.Query isOnlineQuery = (onlineOnly == true) ? queryBuilder.keyword().onField("online").matching(true).createQuery() : null;
org.apache.lucene.search.Query freeOnlyQuery = (freeOnly == true) ? queryBuilder.keyword().onField("active_tasks_count").matching(0).createQuery() : null;
BooleanJunction total = queryBuilder.bool().must(isPerformerQuery).must(minimalBudgetQuery).must(spatialQuery);
if (profileQuery != null) {
total = total.must(profileQuery);
}
if (nameQuery != null) {
total = total.must(nameQuery);
}
if (isOnlineQuery != null) {
total = total.must(isOnlineQuery);
}
if (freeOnlyQuery != null) {
total = total.must(freeOnlyQuery);
}
if (geonameIdQuery!=null) {
total = total.must(geonameIdQuery);
}
else if (minimalRatingQuery != null) {
total = total.must(minimalRatingQuery);
}
org.apache.lucene.search.Query totalQuery = total.createQuery();
FullTextQuery fullTextQuery = fullTextSession.createFullTextQuery(totalQuery);
//fullTextQuery.setSpatialParameters(latitude,longtitude,"place");
if (orderType == User.OrderType.distance) {
Sort distanceSort = new Sort(new DistanceSortField(latitude,longtitude,"pl"));
fullTextQuery.setSort(distanceSort);
}
else if (orderType == User.OrderType.minimal_budget) {
SortField sortField = new SortField("minimal_budget",SortField.LONG,reverse);
fullTextQuery.setSort(new Sort(sortField));
}
else if (orderType == User.OrderType.rating) {
SortField sortField = new SortField("task_rate",SortField.DOUBLE,reverse);
fullTextQuery.setSort(new Sort(sortField));
}
fullTextQuery.setFirstResult(from);
fullTextQuery.setMaxResults(quantity);
return (List)fullTextQuery.list();

iPhone weather forecast application

I am working with an iphone application in xcode that uses the google weather api. But when i connects to the api then its giving me the following output
2010-04-28 12:19:56.903 weather[176:20b] urlstring: http://www.google.com/ig/api?weather=Kolkata
2010-04-28 12:19:57.214 weather[176:20b] Receiving data... 2010-04-28 12:19:57.215 weather[176:20b] responsedata: <3c3f786d 6c207665 7273696f 6e3d2231 2e30223f 3e3c786d 6c5f6170 695f7265 706c7920 76657273 696f6e3d 2231223e 3c776561 74686572 206d6f64 756c655f 69643d22 30222074 61625f69 643d2230 22206d6f 62696c65 5f726f77 3d223022 206d6f62 696c655f 7a697070 65643d22 31222072 6f773d22 30222073 65637469 6f6e3d22 3022203e 3c666f72 65636173 745f696e 666f726d 6174696f 6e3e3c63 69747920 64617461 3d224b6f 6c6b6174 612c2057 65737420 42656e67 616c222f 3e3c706f 7374616c 5f636f64 65206461 74613d22 4b6f6c6b 61746122 2f3e3c6c 61746974 7564655f 65362064 6174613d 22222f3e 3c6c6f6e 67697475 64655f65 36206461 74613d22 222f3e3c 666f7265 63617374 5f646174 65206461 74613d22 32303130 2d30342d 3238222f 3e3c6375 7272656e 745f6461 74655f74 696d6520 64617461 3d223230 31302d30 342d3238 2030363a 32303a30 30202b30 30303022 2f3e3c75 6e69745f 73797374 656d2064 6174613d 22555322 2f3e3c2f 666f7265 63617374 5f696e66 6f726d61 74696f6e 3e3c6375 7272656e 745f636f 6e646974 696f6e73 3e3c636f 6e646974 696f6e20 64617461 3d224861 7a65222f 3e3c7465 6d705f66 20646174 613d2239 37222f3e 3c74656d 705f6320 64617461 3d223336 222f3e3c 68756d69 64697479 20646174 613d2248 756d6964 6974793a 20363025 222f3e3c 69636f6e 20646174 613d222f 69672f69 6d616765 732f7765 61746865 722f6861 7a652e67 6966222f 3e3c7769 6e645f63 6f6e6469 74696f6e 20646174 613d2257 696e643a 20532061 74203133 206d7068 222f3e3c 2f637572 72656e74 5f636f6e 64697469 6f6e733e 3c666f72 65636173 745f636f 6e646974 696f6e73 3e3c6461 795f6f66 5f776565 6b206461 74613d22 57656422 2f3e3c6c 6f772064 6174613d 22383222 2f3e3c68 69676820 64617461 3d223931 222f3e3c 69636f6e 20646174 613d222f 69672f69 6d616765 732f7765 61746865 722f6368 616e6365 5f6f665f 7261696e 2e676966 222f3e3c 636f6e64 6974696f 6e206461 74613d22 4368616e 6365206f 66205261 696e222f 3e3c2f66 6f726563 6173745f 636f6e64 6974696f 6e733e3c 666f7265 63617374 5f636f6e 64697469 6f6e733e 3c646179 5f6f665f 7765656b 20646174 613d2254 6875222f 3e3c6c6f 77206461 74613d22 3832222f 3e3c6869 67682064 6174613d 22393622 2f3e3c69 636f6e20 64617461 3d222f69 672f696d 61676573 2f776561 74686572 2f726169 6e2e6769 66222f3e 3c636f6e 64697469 6f6e2064 6174613d 22526169 6e222f3e 3c2f666f 72656361 73745f63 6f6e6469 74696f6e 733e3c66 6f726563 6173745f 636f6e64 6974696f 6e733e3c 6461795f 6f665f77 65656b20 64617461 3d224672 69222f3e 3c6c6f77 20646174 613d2238 32222f3e 3c686967 68206461 74613d22 3936222f 3e3c6963 6f6e2064 6174613d 222f6967 2f696d61 6765732f 77656174 6865722f 73756e6e 792e6769 66222f3e 3c636f6e 64697469 6f6e2064 6174613d 22436c65 6172222f 3e3c2f66 6f726563> 2010-04-28 12:19:57.217 weather[176:20b] Receiving data... 2010-04-28 12:19:57.217 weather[176:20b] responsedata: <3c3f786d 6c207665 7273696f 6e3d2231 2e30223f 3e3c786d 6c5f6170 695f7265 706c7920 76657273 696f6e3d 2231223e 3c776561 74686572 206d6f64 756c655f 69643d22 30222074 61625f69 643d2230 22206d6f 62696c65 5f726f77 3d223022 206d6f62 696c655f 7a697070 65643d22 31222072 6f773d22 30222073 65637469 6f6e3d22 3022203e 3c666f72 65636173 745f696e 666f726d 6174696f 6e3e3c63 69747920 64617461 3d224b6f 6c6b6174 612c2057 65737420 42656e67 616c222f 3e3c706f 7374616c 5f636f64 65206461 74613d22 4b6f6c6b 61746122 2f3e3c6c 61746974 7564655f 65362064 6174613d 22222f3e 3c6c6f6e 67697475 64655f65 36206461 74613d22 222f3e3c 666f7265 63617374 5f646174 65206461 74613d22 32303130 2d30342d 3238222f 3e3c6375 7272656e 745f6461 74655f74 696d6520 64617461 3d223230 31302d30 342d3238 2030363a 32303a30 30202b30 30303022 2f3e3c75 6e69745f 73797374 656d2064 6174613d 22555322 2f3e3c2f 666f7265 63617374 5f696e66 6f726d61 74696f6e 3e3c6375 7272656e 745f636f 6e646974 696f6e73 3e3c636f 6e646974 696f6e20 64617461 3d224861 7a65222f 3e3c7465 6d705f66 20646174 613d2239 37222f3e 3c74656d 705f6320 64617461 3d223336 222f3e3c 68756d69 64697479 20646174 613d2248 756d6964 6974793a 20363025 222f3e3c 69636f6e 20646174 613d222f 69672f69 6d616765 732f7765 61746865 722f6861 7a652e67 6966222f 3e3c7769 6e645f63 6f6e6469 74696f6e 20646174 613d2257 696e643a 20532061 74203133 206d7068 222f3e3c 2f637572 72656e74 5f636f6e 64697469 6f6e733e 3c666f72 65636173 745f636f 6e646974 696f6e73 3e3c6461 795f6f66 5f776565 6b206461 74613d22 57656422 2f3e3c6c 6f772064 6174613d 22383222 2f3e3c68 69676820 64617461 3d223931 222f3e3c 69636f6e 20646174 613d222f 69672f69 6d616765 732f7765 61746865 722f6368 616e6365 5f6f665f 7261696e 2e676966 222f3e3c 636f6e64 6974696f 6e206461 74613d22 4368616e 6365206f 66205261 696e222f 3e3c2f66 6f726563 6173745f 636f6e64 6974696f 6e733e3c 666f7265 63617374 5f636f6e 64697469 6f6e733e 3c646179 5f6f665f 7765656b 20646174 613d2254 6875222f 3e3c6c6f 77206461 74613d22 3832222f 3e3c6869 67682064 6174613d 22393622 2f3e3c69 636f6e20 64617461 3d222f69 672f696d 61676573 2f776561 74686572 2f726169 6e2e6769 66222f3e 3c636f6e 64697469 6f6e2064 6174613d 22526169 6e222f3e 3c2f666f 72656361 73745f63 6f6e6469 74696f6e 733e3c66 6f726563 6173745f 636f6e64 6974696f 6e733e3c 6461795f 6f665f77 65656b20 64617461 3d224672 69222f3e 3c6c6f77 20646174 613d2238 32222f3e 3c686967 68206461 74613d22 3936222f 3e3c6963 6f6e2064 6174613d 222f6967 2f696d61 6765732f 77656174 6865722f 73756e6e 792e6769 66222f3e 3c636f6e 64697469 6f6e2064 6174613d 22436c65 6172222f 3e3c2f66 6f726563 6173745f 636f6e64 6974696f 6e733e3c 666f7265 63617374 5f636f6e 64697469 6f6e733e 3c646179 5f6f665f 7765656b 20646174 613d2253 6174222f 3e3c6c6f 77206461 74613d22 3738222f 3e3c6869 67682064 6174613d 22393822 2f3e3c69 636f6e20 64617461 3d222f69 672f696d 61676573 2f776561 74686572 2f6d6f73 746c795f 73756e6e 792e6769 66222f3e 3c636f6e 64697469 6f6e2064 6174613d 224d6f73 746c7920 53756e6e 79222f3e 3c2f666f 72656361 73745f63 6f6e6469 74696f6e 733e3c2f 77656174 6865723e 3c2f786d 6c5f6170 695f7265 706c793e> 2010-04-28 12:19:57.219 weather[176:20b] Finished loading...
My Code looks like this
- (void)viewDidLoad
{
NSString *currentLocation=#"Kolkata";
NSString *URLString = [NSString stringWithFormat:#"http://www.google.com/ig/api?weather=%#", currentLocation];
NSLog(#"urlstring: %#", URLString);
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:URLString] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:60.0];
NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
if (theConnection)
{
responseData = [[NSMutableData alloc] retain];
}
[super viewDidLoad];
}
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
[responseData setLength:0];
}
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
NSLog(#"Receiving data...");
[responseData appendData:data];
NSLog(#"responsedata: %#",responseData);
}
- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{
NSLog(#"Reverse Geocode request to Google failed!");
}
- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
NSLog(#"Finished loading...");
[connection release];
}
I can't figure it out how to read this data.
Looking for your's valuable suggetion. I am using this url(http://www.google.com/ig/api?weather=kolkata)
Thanks in advance
I suspect that this is because you are using NSData. Try converting that to NSString or just use an NSString returning method like stringWithContentsOfURL:encoding:error: