3

I have some problems with Tomcat/GeoServer. I was able to create project in stand-alone GeoServer and all works fine.

This is my code.

<%@ page language="java" contentType="text/html; charset=UTF-8"
 pageEncoding="UTF-8"%>
  <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
<title> My first JSP </title> 
<link href="http://localhost:8080/geoserver/openlayers/theme/default/style.css"type="text/css"/>
<style type="text/css">
    div.list {background-color:#dddddd; border-right:2px dashed #717dc9; width:250px; height:400px; float:right; margin-top:-395px}
    div.ol {background-color:#ffffff; height:400px; min-width:380px; max-width:3800px; margin-right:260px; padding-right:20px;margin-top:-15px}
    div.info {background-color:#eeeeee; height:220px; margin-top:10px; width:100%}
    div.upload{background-color:#ffffff; height:190px; width:300px; float: right; margin-left:10px; margin:10px }
    div.accept{background-color:#ffffff; height:190px; width:300px; float: left; margin-left:10px; margin:10px }
    div.filelist {overflow: auto; height:330px; margin-left:10px}
    div.listtitle {margin-left:10px; background-color:#ffffff}
    /* General settings */
        body {
            font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
            font-size: small;
            }
    /* The map and the location bar */
        #map {
            clear: both;
            position: relative;
            width: 687px;
            height: 330px;
            border: 1px solid black;
            }
</style>
<script src="OpenLayers/OpenLayers.js"></script>
<script type="text/javascript">
        var lon = 150;
        var params;
        var lat = 50;
        var zoom = 6;
        var map, layer;
        var extend = new OpenLayers.Bounds(1622287.25, 383562.90625, 1623662.375, 384223.21875);
        var options = { 
                maxResolution: 5.37158203125,
                                 maxExtent: extend,
                projection:"EPSG:70066",
                units:'m'}
        function init(){
            map = new OpenLayers.Map( 'map', options);
            layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
                    "http://localhost:8080/geoserver/wms", {layers: 'cite:filedata'} );
            map.addLayer(layer);
            map.zoomToExtent(extend);
    //        <!--map.setCenter(extend.getCenterLonLat(), map.getZoomForExtent(extend));-->
            map.addControl( new OpenLayers.Control.LayerSwitcher() );

        }
   </script>
</head>
<body onload="init()">

<div class="ol"> <div id="map"></div> </div>
</body>
</html>

But when I try to put this in Tomcat nothing happens and I don't see a map. What do I need to do with Tomcat to run project which uses GeoServer?

I know my English is terrible.

  • did you copy the data directory from the jetty GeoServer to the Tomcat GeoServer? – Ian Turton Apr 26 '12 at 13:13
  • yes im cope OpenLayers directory in directory with project in tomcat. And create same layer with same parametrs in tomcat's geoserver. – Kliver Max Apr 26 '12 at 13:23
  • Also if im launch geoserver in tomcat that geoserver works fine, but project which uses geoserver dont display my map. – Kliver Max Apr 26 '12 at 13:52
1

As I can see you used projection 70066 and it looks like you faced with projection issue. Check Declared SRS and Lat/Lon Bounding Box options of your layer.

  • Tnx. That was the problem, I forgot to add my projection in tomcat's geoserver. – Kliver Max Apr 28 '12 at 7:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.