与Double.parsedouble(s)

时间:2016-04-15 16:22:55

标签: java google-maps jsf primefaces

我想在地图中创建一个路径线,我从数据库中的表中获取经度和纬度

  

(注意:坐标的类型是String)

。 我用primefaces gmap来做这件事。This is the link of the showcase

我修改了代码:我将它与ejb相关联以从数据库获取坐标。这是我的代码

   @ManagedBean
    @ViewScoped
    public class InfoWindowView implements Serializable {
        /**
         * 
         */
        private static final long serialVersionUID = 1L;
        //private List<String> Listlat ;
        //private List<String> Listlng;
        @EJB
        GestionAnalyseLocal m;

        private MapModel advancedModel;

        private Marker marker;

        @PostConstruct
        public void init() {
            advancedModel = new DefaultMapModel();
            try {

                Analyse aly = new Analyse();// this the class persistance that create the table  in database
                do {

                String x =aly.getLatitude();
                String y =aly.getLongitude();

                LatLng coord1 = new LatLng (Double.parseDouble(y), Double.parseDouble(x));
                        advancedModel.addOverlay(new Marker(coord1, "Konyaalti", "konyaalti.png", "http://maps.google.com/mapfiles/ms/micons/blue-dot.png"));

                }while (aly.getId() == 3990);

            }
            catch (Exception e) {
                System.out.println("erreur" + e);
                e.printStackTrace();
            }




        }

        public MapModel getAdvancedModel() {
            return advancedModel;
        }

        public void onMarkerSelect(OverlaySelectEvent event) {
            marker = (Marker) event.getOverlay();
        }

        public Marker getMarker() {
            return marker;
        }
    }

这是xhtml页面:

    <ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://xmlns.jcp.org/jsf/core"
    xmlns:h="http://xmlns.jcp.org/jsf/html"
    xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
    xmlns:jsf="http://xmlns.jcp.org/jsf"
    xmlns:pt="http://xmlns.jcp.org/jsf/passthrough"
    xmlns:p="http://primefaces.org/ui">

<h:head>
    <script src="http://maps.google.com/maps/api/js?sensor=false" 
          type="text/javascript"></script>
</h:head>
<h:body>
<h:form>  
    <p:gmap id="gmap" center="36.890257,30.707417" zoom="13" type="HYBRID" model="#{infoWindowView.advancedModel}" style="width:100%;height:400px">

        <p:ajax event="overlaySelect" listener="#{infoWindowView.onMarkerSelect}" />

        <p:gmapInfoWindow id="infoWindow">
            <p:outputPanel style="text-align: center; display: block; margin: auto">

                    <p:graphicImage name="/demo/images/antalya/#{infoWindowView.marker.data}" height="150" />
                    <br />
                    <h:outputText value="#{infoWindowView.marker.title}" />

            </p:outputPanel>
        </p:gmapInfoWindow>
    </p:gmap>

    <!-- Preload for demo -->
    <p:outputPanel style="display:none">
        <p:graphicImage name="/demo/images/antalya/konyaalti.png" />
        <p:graphicImage name="/demo/images/antalya/ataturkparki.png" />
        <p:graphicImage name="/demo/images/antalya/kaleici.png" />
        <p:graphicImage name="/demo/images/antalya/karaalioglu.png" />
    </p:outputPanel>
</h:form>
</h:body>
  </ui:composition>

但我终于得到了没有标记的地图,我得到了这个错误:

    16:59:25,700 INFO  [stdout] (default task-42) erreurjava.lang.NullPointerException

16:59:25,701 ERROR [stderr] (default task-42) java.lang.NullPointerException

16:59:25,703 ERROR [stderr] (default task-42)   at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1838)

16:59:25,703 ERROR [stderr] (default task-42)   at sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:110)

16:59:25,704 ERROR [stderr] (default task-42)   at java.lang.Double.parseDouble(Double.java:538)

16:59:25,704 ERROR [stderr] (default task-42)   at beans.InfoWindowView.init(InfoWindowView.java:66)

16:59:25,705 ERROR [stderr] (default task-42)   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

16:59:25,705 ERROR [stderr] (default task-42)   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

16:59:25,706 ERROR [stderr] (default task-42)   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

16:59:25,706 ERROR [stderr] (default task-42)   at java.lang.reflect.Method.invoke(Method.java:497)

16:59:25,707 ERROR [stderr] (default task-42)   at org.jboss.weld.injection.producer.DefaultLifecycleCallbackInvoker.invokeMethods(DefaultLifecycleCallbackInvoker.java:98)

16:59:25,707 ERROR [stderr] (default task-42)   at org.jboss.weld.injection.producer.DefaultLifecycleCallbackInvoker.postConstruct(DefaultLifecycleCallbackInvoker.java:81)

16:59:25,708 ERROR [stderr] (default task-42)   at org.jboss.weld.injection.producer.BasicInjectionTarget.postConstruct(BasicInjectionTarget.java:126)

16:59:25,708 ERROR [stderr] (default task-42)   at org.jboss.as.weld.deployment.processors.WeldComponentIntegrationProcessor$3.run(WeldComponentIntegrationProcessor.java:196)

16:59:25,709 ERROR [stderr] (default task-42)   at org.jboss.as.weld.deployment.processors.WeldComponentIntegrationProcessor$AbstractInjectionTargetDelegatingInterceptor.processInvocation(WeldComponentIntegrationProcessor.java:260)

16:59:25,710 ERROR [stderr] (default task-42)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

16:59:25,710 ERROR [stderr] (default task-42)   at org.jboss.as.weld.injection.WeldInjectionInterceptor.processInvocation(WeldInjectionInterceptor.java:53)

16:59:25,710 ERROR [stderr] (default task-42)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

16:59:25,711 ERROR [stderr] (default task-42)   at org.jboss.as.ee.component.ManagedReferenceFieldInjectionInterceptorFactory$ManagedReferenceFieldInjectionInterceptor.processInvocation(ManagedReferenceFieldInjectionInterceptorFactory.java:107)

16:59:25,711 ERROR [stderr] (default task-42)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

16:59:25,712 ERROR [stderr] (default task-42)   at org.jboss.as.ee.component.AroundConstructInterceptorFactory$1.processInvocation(AroundConstructInterceptorFactory.java:28)

16:59:25,712 ERROR [stderr] (default task-42)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

16:59:25,713 ERROR [stderr] (default task-42)   at org.jboss.as.weld.injection.WeldInterceptorInjectionInterceptor.processInvocation(WeldInterceptorInjectionInterceptor.java:56)

16:59:25,713 ERROR [stderr] (default task-42)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

16:59:25,714 ERROR [stderr] (default task-42)   at org.jboss.as.weld.injection.WeldInjectionContextInterceptor.processInvocation(WeldInjectionContextInterceptor.java:43)

16:59:25,715 ERROR [stderr] (default task-42)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

16:59:25,715 ERROR [stderr] (default task-42)   at org.jboss.as.ee.concurrent.ConcurrentContextInterceptor.processInvocation(ConcurrentContextInterceptor.java:45)

16:59:25,715 ERROR [stderr] (default task-42)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

16:59:25,716 ERROR [stderr] (default task-42)   at org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:64)

16:59:25,716 ERROR [stderr] (default task-42)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

16:59:25,721 ERROR [stderr] (default task-42)   at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:356)

16:59:25,722 ERROR [stderr] (default task-42)   at org.jboss.invocation.PrivilegedWithCombinerInterceptor.processInvocation(PrivilegedWithCombinerInterceptor.java:80)

16:59:25,722 ERROR [stderr] (default task-42)   at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)

16:59:25,722 ERROR [stderr] (default task-42)   at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)

16:59:25,723 ERROR [stderr] (default task-42)   at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:161)

16:59:25,723 ERROR [stderr] (default task-42)   at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:134)

16:59:25,723 ERROR [stderr] (default task-42)   at org.jboss.as.ee.component.BasicComponent.createInstance(BasicComponent.java:99)

16:59:25,724 ERROR [stderr] (default task-42)   at org.jboss.as.ee.component.ComponentRegistry$ComponentManagedReferenceFactory.getReference(ComponentRegistry.java:171)

16:59:25,724 ERROR [stderr] (default task-42)   at org.jboss.as.ee.component.ComponentRegistry.createInstance(ComponentRegistry.java:87)

16:59:25,724 ERROR [stderr] (default task-42)   at org.jboss.as.web.common.WebInjectionContainer.newInstance(WebInjectionContainer.java:77)

16:59:25,724 ERROR [stderr] (default task-42)   at org.jboss.as.jsf.injection.JSFInjectionProvider.invokePostConstruct(JSFInjectionProvider.java:68)

16:59:25,725 ERROR [stderr] (default task-42)   at com.sun.faces.mgbean.BeanBuilder.invokePostConstruct(BeanBuilder.java:221)

16:59:25,725 ERROR [stderr] (default task-42)   at com.sun.faces.mgbean.BeanBuilder.build(BeanBuilder.java:103)

16:59:25,726 ERROR [stderr] (default task-42)   at com.sun.faces.mgbean.BeanManager.createAndPush(BeanManager.java:409)

16:59:25,726 ERROR [stderr] (default task-42)   at com.sun.faces.mgbean.BeanManager.create(BeanManager.java:269)

16:59:25,726 ERROR [stderr] (default task-42)   at com.sun.faces.el.ManagedBeanELResolver.resolveBean(ManagedBeanELResolver.java:257)

16:59:25,727 ERROR [stderr] (default task-42)   at com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:117)

16:59:25,727 ERROR [stderr] (default task-42)   at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176)

16:59:25,727 ERROR [stderr] (default task-42)   at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203)

16:59:25,730 ERROR [stderr] (default task-42)   at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:116)

16:59:25,730 ERROR [stderr] (default task-42)   at com.sun.el.parser.AstValue.getBase(AstValue.java:151)

16:59:25,730 ERROR [stderr] (default task-42)   at com.sun.el.parser.AstValue.getValue(AstValue.java:200)

16:59:25,731 ERROR [stderr] (default task-42)   at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:226)

16:59:25,731 ERROR [stderr] (default task-42)   at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:50)

16:59:25,731 ERROR [stderr] (default task-42)   at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:50)

16:59:25,732 ERROR [stderr] (default task-42)   at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109)

16:59:25,732 ERROR [stderr] (default task-42)   at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194)

16:59:25,732 ERROR [stderr] (default task-42)   at org.primefaces.component.gmap.GMap.getModel(GMap.java:117)

16:59:25,733 ERROR [stderr] (default task-42)   at org.primefaces.component.gmap.GMapRenderer.encodeOverlays(GMapRenderer.java:124)

16:59:25,733 ERROR [stderr] (default task-42)   at org.primefaces.component.gmap.GMapRenderer.encodeScript(GMapRenderer.java:87)

16:59:25,733 ERROR [stderr] (default task-42)   at org.primefaces.component.gmap.GMapRenderer.encodeEnd(GMapRenderer.java:51)

16:59:25,734 ERROR [stderr] (default task-42)   at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:919)

16:59:25,770 ERROR [stderr] (default task-42)   at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1863)

16:59:25,770 ERROR [stderr] (default task-42)   at javax.faces.render.Renderer.encodeChildren(Renderer.java:176)

16:59:25,771 ERROR [stderr] (default task-42)   at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:889)

16:59:25,771 ERROR [stderr] (default task-42)   at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1856)

16:59:25,771 ERROR [stderr] (default task-42)   at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)

16:59:25,772 ERROR [stderr] (default task-42)   at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859)

16:59:25,772 ERROR [stderr] (default task-42)   at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:456)

16:59:25,772 ERROR [stderr] (default task-42)   at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:133)

16:59:25,773 ERROR [stderr] (default task-42)   at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337)

16:59:25,773 ERROR [stderr] (default task-42)   at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:337)

16:59:25,773 ERROR [stderr] (default task-42)   at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)

16:59:25,774 ERROR [stderr] (default task-42)   at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)

16:59:25,774 ERROR [stderr] (default task-42)   at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219)

16:59:25,774 ERROR [stderr] (default task-42)   at javax.faces.webapp.FacesServlet.service(FacesServlet.java:655)

16:59:25,775 ERROR [stderr] (default task-42)   at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:86)

16:59:25,775 ERROR [stderr] (default task-42)   at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)

16:59:25,775 ERROR [stderr] (default task-42)   at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)

16:59:25,776 ERROR [stderr] (default task-42)   at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)

16:59:25,776 ERROR [stderr] (default task-42)   at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

16:59:25,777 ERROR [stderr] (default task-42)   at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)

16:59:25,777 ERROR [stderr] (default task-42)   at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)

16:59:25,777 ERROR [stderr] (default task-42)   at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

16:59:25,778 ERROR [stderr] (default task-42)   at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)

16:59:25,778 ERROR [stderr] (default task-42)   at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)

16:59:25,778 ERROR [stderr] (default task-42)   at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58)

16:59:25,779 ERROR [stderr] (default task-42)   at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:72)

16:59:25,779 ERROR [stderr] (default task-42)   at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)

16:59:25,779 ERROR [stderr] (default task-42)   at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76)

16:59:25,780 ERROR [stderr] (default task-42)   at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

16:59:25,780 ERROR [stderr] (default task-42)   at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)

16:59:25,783 ERROR [stderr] (default task-42)   at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

16:59:25,784 ERROR [stderr] (default task-42)   at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

16:59:25,784 ERROR [stderr] (default task-42)   at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:282)

16:59:25,784 ERROR [stderr] (default task-42)   at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:261)

16:59:25,785 ERROR [stderr] (default task-42)   at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:80)

16:59:25,785 ERROR [stderr] (default task-42)   at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:172)

16:59:25,785 ERROR [stderr] (default task-42)   at io.undertow.server.Connectors.executeRootHandler(Connectors.java:199)

16:59:25,786 ERROR [stderr] (default task-42)   at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:774)

16:59:25,786 ERROR [stderr] (default task-42)   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

16:59:25,787 ERROR [stderr] (default task-42)   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

16:59:25,787 ERROR [stderr] (default task-42)   at java.lang.Thread.run(Thread.java:745)

0 个答案:

没有答案