Вопрос

I have a small GWT project ongoing and I keep getting this error everytime i run it in developement mode.

HTTP ERROR: 503

Problem accessing /Segnalazioni_Degrado.html. Reason: 
SERVICE_UNAVAILABLE


--------------------------------------------------------------------------------
Powered by Jetty://

These are the service classes I've created: DataLayerService, DataLayerServiceAsync, DataLayerImpl

package com.tesi.client;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.List;

import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

@RemoteServiceRelativePath("dataLayer")
    public interface DataLayerService extends RemoteService {

    List<Segnalazione> getListaSegnalazioniAttivePerMappa();

} 

.

package com.tesi.client;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.List;

import com.google.gwt.user.client.rpc.AsyncCallback;

public interface DataLayerServiceAsync {

void getListaSegnalazioniAttivePerMappa(AsyncCallback<List<Segnalazione>> callback);



}

.

package com.tesi.server;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import com.tesi.client.DataLayerService;
import com.tesi.client.Segnalazione;

public class DataLayerServiceImpl extends RemoteServiceServlet implements
    DataLayerService {

@Override
public List<Segnalazione> getListaSegnalazioniAttivePerMappa() {
    // TODO Auto-generated method stub
    List<Segnalazione> listaSegnalazioniAttive= new ArrayList<Segnalazione>();
    try {
        Connection con = ConnectionPool.getInstance().getConnection();
        Statement stmt = con.createStatement();
        ResultSet segnalazioniAttive = stmt
                .executeQuery("SELECT * FROM SEGNALAZIONI_ATTIVE");
        while(segnalazioniAttive.next()) {

            //popolo gli oggetti segnalazione
            Segnalazione s = new Segnalazione();
            s.setCategoria(segnalazioniAttive.getString("categoria"));
            s.setData(segnalazioniAttive.getDate("data"));
            s.setDescrizione(segnalazioniAttive.getString("descrizione"));
            s.setIndirizzo(segnalazioniAttive.getString("indirizzo"));
            s.setNum_civico(segnalazioniAttive.getInt("numero_civico"));

            listaSegnalazioniAttive.add(s);
        }
    } catch (Exception ex) {

    }
    return listaSegnalazioniAttive;
}

}

.

And this is the way I've modified the web.xml file

 <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
              http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         version="2.5"
         xmlns="http://java.sun.com/xml/ns/javaee">

  <!-- Servlets -->
  <servlet>
    <servlet-name>greetServlet</servlet-name>
    <servlet-class>com.tesi.server.GreetingServiceImpl</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>greetServlet</servlet-name>
    <url-pattern>/segnalazioni_degrado/greet</url-pattern>
  </servlet-mapping>

  <servlet>
    <servlet-name>dataLayerServlet</servlet-name>
    <servlet-class>com.tesi.server.DataLayerServiceImpl</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>dataLayerServlet</servlet-name>
    <url-pattern>/segnalazioni_degrado/dataLayer</url-pattern>
  </servlet-mapping>


  <!-- Default page to serve -->
  <welcome-file-list>
    <welcome-file>Segnalazioni_Degrado.html</welcome-file>
  </welcome-file-list>

</web-app>

Have you got any clue how to solve it?

Это было полезно?

Решение

Sorry everyone, it was a stupid mistake. I simply had to remove the GreetServlet from web.xml as that is just an example servlet.

Thank you anyway.

Другие советы

Try changing this

@RemoteServiceRelativePath("dataLayer")

into this

@RemoteServiceRelativePath("/segnalazioni_degrado/dataLayer")

If this does not work, please post the server error log

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top