2

I want to user geoserver rest api in netbeans. i create new Maven Web Application project:

enter image description here

and then edit pom.xml like following:

add repository:

<dependency>
     <groupId>it.geosolutions</groupId>
     <artifactId>geoserver-manager</artifactId>
     <version>1.5.1</version>
     <scope>provided</scope>
</dependency>

add dependency:

<dependency>
    <groupId>it.geosolutions</groupId>
    <artifactId>geoserver-manager</artifactId>
    <version>1.5.2</version>
</dependency>

and then create new index.jsp file and then add to body tag following code:

<%
    String RESTURL  = "http://localhost:1234/geoserver/rest";
    String RESTUSER = "admin";
    String RESTPW   = "geoserver";
    GeoServerRESTReader reader = new GeoServerRESTReader(RESTURL, RESTUSER, RESTPW);
    GeoServerRESTPublisher publisher = new GeoServerRESTPublisher(RESTURL, RESTUSER, RESTPW);
    boolean created = publisher.createWorkspace("myWorkspace");
%>

and then add to top of the file:

<%@ page import="it.geosolutions.geoserver.rest.GeoServerRESTPublisher" %>
<%@ page import="it.geosolutions.geoserver.rest.GeoServerRESTReader"%>

when i run this file occur following:

enter image description here

where is problem? how can i solve it?

1 Answer 1

2

For using geoserver-manager with Maven, follow this: https://github.com/geosolutions-it/geoserver-manager/wiki#working-with-maven Looking at your post, you declare a dependency instead of a repository, and the log indicates that some class is not found, which may indicate geoserver-manager is not found on your classpath.

Check your pom.xml is valid, and that geoserver-manager was downloaded and is available in your project maven dependencies.

I would then suggest you first to familiarize with the geoserver-manager using a simple java program (no need for a web application here), start familiarizing with the examples provided here https://github.com/geosolutions-it/geoserver-manager/wiki/Various-Examples#some-examples It can be the one you pasted to create a workspace.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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