0
votes

I've created a Dynamic Web Project which uses GWT and JPA(Hibernate) for JBoss EA 6.1+.

I'm able to deploy and start my application on JBoss EAP 6.2 and with the Eclipse Plugin JBoss Tools (Kepler)4.1.2.

But when I trigger to use my servlet, I get following error message: The requested resource (/Prototyp/com.Prototyp/service) is not available. HTTP Error 404 Code and Configuration files below.

The war->WEB-INF->web.xml

<servlet>
  <servlet-name>ReceiveDB2Service</servlet-name>
  <servlet-class>com.server.ReceiveDB2ProtokollServiceImpl</servlet-class>
  <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
  <servlet-name>ReceiveDB2Service</servlet-name>
  <url-pattern>/service</url-pattern>
</servlet-mapping>
<welcome-file-list>
  <welcome-file>Prototyp.html</welcome-file>
</welcome-file-list>

My Service Interface

@RemoteServiceRelativePath("service")
public interface ReceiveDB2ProtokollService extends RemoteService {

    public ArrayList<ProtokollDatei> getProtokollFromDB2(String idString);
}

The Service Implementation

public class ReceiveDB2ProtokollServiceImpl extends RemoteServiceServlet implements   ReceiveDB2ProtokollService {

    private static final long serialVersionUID = 8871154557738322951L;

    @PersistenceContext(unitName = "Prototyp", type = PersistenceContextType.TRANSACTION)
    private EntityManager markog04;

    @Override
    public ArrayList<ProtokollDatei> getProtokollFromDB2(String idString) {
        Query q = markog04.createNamedQuery("ProtokollDatei.findByQId");
        q.setParameter("id", 10447227393L);

        ArrayList<ProtokollDatei> protokollListe = (ArrayList<ProtokollDatei>) q.getResultList();

        return protokollListe;
    }
}

EntryPointClass, needed by GWT within the Button and onClick Event

public class Prototyp implements EntryPoint {

    private TextBox userInput = new TextBox();
    private Button searchButton = new Button("Suchen");
    private VerticalPanel vertiPanel = new VerticalPanel();

    @Override
    public void onModuleLoad() {

        final AsyncCallback<ArrayList<ProtokollDatei>> protokollCallBack = new AsyncCallback<ArrayList<ProtokollDatei>>() {

            @Override
            public void onFailure(Throwable caught) {
                vertiPanel.add(new Label("onFailure:"));
                vertiPanel.add(new Label(caught.getMessage()));
            }

            @Override
            public void onSuccess(ArrayList<ProtokollDatei> result) {
                vertiPanel.add(new Label("onSuccess " + result.size()));
            }
        };

        searchButton.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent arg0) {

                ReceiveDB2ProtokollServiceAsync service = GWT.create(ReceiveDB2ProtokollService.class);

                service.getProtokollFromDB2(userInput.getText(), protokollCallBack);
            }
        });
    }
}

Last but not least, from the persistence.xml

<persistence-unit name="Prototyp">
    <jta-data-source>java:/datasources/markog04</jta-data-source>
    <class>com.shared.ProtokollDatei</class>
</persistence-unit>

I already tried to change the url-pattern in web.xml, but than i could'nt deploy, with error "Failed to start context". My folder structure: war com.Prototyp WEB-INF deploy lib web.xml Prototyp.html

Have anyone ideas to solve this problem? Thanks in advance for answers. julian

1

1 Answers

0
votes

If it says 404, then it's 404. Your server doesn't contain teh resource

/Prototyp/com.Prototyp/service

make sure your url is correct, also make sure the server succeeded the install of the war.

This is not a complex problem, you just have to check everything is in place. Check the server work directory, create another servlet taht sais "hello" and try to call it...