IntelliJ Glassfish5 JAX-RS Path not working





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I have a problem for days now.
I made it that my server is working and now I can't get the paths to work.



I want to run a simple Java Class



package org.eberle.rest;

import javax.ws.rs.FormParam;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;


@Path("/cab")
public class CabRequestHandler {

@POST
@Path("/add")
public Response addRequest(
@FormParam("TaxiNr") int cabNumber ,
@FormParam("StartAdresse") String startAddress,
@FormParam("EndAdresse") String endAddress){

return Response.status(200)
.entity("addRequest is called, TaxiNr : " + cabNumber + ", StartAddresse : " + startAddress + ", Endadresse" + endAddress)
.build();
}

}


I am running the deploy T4:war exploded on the custom text root in the glassfish server settings.



localhost:8081/root


This is working and it shows my index.jsp



But the next problem is, that I don't know how to configure the web.xml. I tried so many web.xml from here and the internet and they are all not working for me.
When I try to open up my path /root/cab/add it says Error 404.



Can someone help me please with a working web.xml.



Thank you very much!










share|improve this question

























  • I assume this is to run on tomcat, please share your web.xml file.

    – Bentaye
    Nov 25 '18 at 19:58


















0















I have a problem for days now.
I made it that my server is working and now I can't get the paths to work.



I want to run a simple Java Class



package org.eberle.rest;

import javax.ws.rs.FormParam;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;


@Path("/cab")
public class CabRequestHandler {

@POST
@Path("/add")
public Response addRequest(
@FormParam("TaxiNr") int cabNumber ,
@FormParam("StartAdresse") String startAddress,
@FormParam("EndAdresse") String endAddress){

return Response.status(200)
.entity("addRequest is called, TaxiNr : " + cabNumber + ", StartAddresse : " + startAddress + ", Endadresse" + endAddress)
.build();
}

}


I am running the deploy T4:war exploded on the custom text root in the glassfish server settings.



localhost:8081/root


This is working and it shows my index.jsp



But the next problem is, that I don't know how to configure the web.xml. I tried so many web.xml from here and the internet and they are all not working for me.
When I try to open up my path /root/cab/add it says Error 404.



Can someone help me please with a working web.xml.



Thank you very much!










share|improve this question

























  • I assume this is to run on tomcat, please share your web.xml file.

    – Bentaye
    Nov 25 '18 at 19:58














0












0








0








I have a problem for days now.
I made it that my server is working and now I can't get the paths to work.



I want to run a simple Java Class



package org.eberle.rest;

import javax.ws.rs.FormParam;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;


@Path("/cab")
public class CabRequestHandler {

@POST
@Path("/add")
public Response addRequest(
@FormParam("TaxiNr") int cabNumber ,
@FormParam("StartAdresse") String startAddress,
@FormParam("EndAdresse") String endAddress){

return Response.status(200)
.entity("addRequest is called, TaxiNr : " + cabNumber + ", StartAddresse : " + startAddress + ", Endadresse" + endAddress)
.build();
}

}


I am running the deploy T4:war exploded on the custom text root in the glassfish server settings.



localhost:8081/root


This is working and it shows my index.jsp



But the next problem is, that I don't know how to configure the web.xml. I tried so many web.xml from here and the internet and they are all not working for me.
When I try to open up my path /root/cab/add it says Error 404.



Can someone help me please with a working web.xml.



Thank you very much!










share|improve this question
















I have a problem for days now.
I made it that my server is working and now I can't get the paths to work.



I want to run a simple Java Class



package org.eberle.rest;

import javax.ws.rs.FormParam;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;


@Path("/cab")
public class CabRequestHandler {

@POST
@Path("/add")
public Response addRequest(
@FormParam("TaxiNr") int cabNumber ,
@FormParam("StartAdresse") String startAddress,
@FormParam("EndAdresse") String endAddress){

return Response.status(200)
.entity("addRequest is called, TaxiNr : " + cabNumber + ", StartAddresse : " + startAddress + ", Endadresse" + endAddress)
.build();
}

}


I am running the deploy T4:war exploded on the custom text root in the glassfish server settings.



localhost:8081/root


This is working and it shows my index.jsp



But the next problem is, that I don't know how to configure the web.xml. I tried so many web.xml from here and the internet and they are all not working for me.
When I try to open up my path /root/cab/add it says Error 404.



Can someone help me please with a working web.xml.



Thank you very much!







intellij-idea jersey jax-rs






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 25 '18 at 20:06









Bentaye

4,58732031




4,58732031










asked Nov 22 '18 at 11:25









Johnny WangJohnny Wang

1




1













  • I assume this is to run on tomcat, please share your web.xml file.

    – Bentaye
    Nov 25 '18 at 19:58



















  • I assume this is to run on tomcat, please share your web.xml file.

    – Bentaye
    Nov 25 '18 at 19:58

















I assume this is to run on tomcat, please share your web.xml file.

– Bentaye
Nov 25 '18 at 19:58





I assume this is to run on tomcat, please share your web.xml file.

– Bentaye
Nov 25 '18 at 19:58












1 Answer
1






active

oldest

votes


















0














Assuming /root is the context of your app, your web.xml should probably look something like this:



<?xml version="1.0" encoding="UTF-8"?>
<!-- This web.xml file is not required when using Servlet 3.0 container,
see implementation details http://jersey.java.net/nonav/documentation/latest/jax-rs.html -->
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" 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">

<servlet>

<servlet-name>Jersey Web Application</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>org.eberle.rest</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>Jersey Web Application</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>

</web-app>


This way all the calls to /root/ should be handled by Jersey



You can refer to this tutorial






share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53429921%2fintellij-glassfish5-jax-rs-path-not-working%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Assuming /root is the context of your app, your web.xml should probably look something like this:



    <?xml version="1.0" encoding="UTF-8"?>
    <!-- This web.xml file is not required when using Servlet 3.0 container,
    see implementation details http://jersey.java.net/nonav/documentation/latest/jax-rs.html -->
    <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" 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">

    <servlet>

    <servlet-name>Jersey Web Application</servlet-name>
    <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
    <init-param>
    <param-name>jersey.config.server.provider.packages</param-name>
    <param-value>org.eberle.rest</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
    </servlet>

    <servlet-mapping>
    <servlet-name>Jersey Web Application</servlet-name>
    <url-pattern>/*</url-pattern>
    </servlet-mapping>

    </web-app>


    This way all the calls to /root/ should be handled by Jersey



    You can refer to this tutorial






    share|improve this answer




























      0














      Assuming /root is the context of your app, your web.xml should probably look something like this:



      <?xml version="1.0" encoding="UTF-8"?>
      <!-- This web.xml file is not required when using Servlet 3.0 container,
      see implementation details http://jersey.java.net/nonav/documentation/latest/jax-rs.html -->
      <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" 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">

      <servlet>

      <servlet-name>Jersey Web Application</servlet-name>
      <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
      <init-param>
      <param-name>jersey.config.server.provider.packages</param-name>
      <param-value>org.eberle.rest</param-value>
      </init-param>
      <load-on-startup>1</load-on-startup>
      </servlet>

      <servlet-mapping>
      <servlet-name>Jersey Web Application</servlet-name>
      <url-pattern>/*</url-pattern>
      </servlet-mapping>

      </web-app>


      This way all the calls to /root/ should be handled by Jersey



      You can refer to this tutorial






      share|improve this answer


























        0












        0








        0







        Assuming /root is the context of your app, your web.xml should probably look something like this:



        <?xml version="1.0" encoding="UTF-8"?>
        <!-- This web.xml file is not required when using Servlet 3.0 container,
        see implementation details http://jersey.java.net/nonav/documentation/latest/jax-rs.html -->
        <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" 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">

        <servlet>

        <servlet-name>Jersey Web Application</servlet-name>
        <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
        <init-param>
        <param-name>jersey.config.server.provider.packages</param-name>
        <param-value>org.eberle.rest</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
        </servlet>

        <servlet-mapping>
        <servlet-name>Jersey Web Application</servlet-name>
        <url-pattern>/*</url-pattern>
        </servlet-mapping>

        </web-app>


        This way all the calls to /root/ should be handled by Jersey



        You can refer to this tutorial






        share|improve this answer













        Assuming /root is the context of your app, your web.xml should probably look something like this:



        <?xml version="1.0" encoding="UTF-8"?>
        <!-- This web.xml file is not required when using Servlet 3.0 container,
        see implementation details http://jersey.java.net/nonav/documentation/latest/jax-rs.html -->
        <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" 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">

        <servlet>

        <servlet-name>Jersey Web Application</servlet-name>
        <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
        <init-param>
        <param-name>jersey.config.server.provider.packages</param-name>
        <param-value>org.eberle.rest</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
        </servlet>

        <servlet-mapping>
        <servlet-name>Jersey Web Application</servlet-name>
        <url-pattern>/*</url-pattern>
        </servlet-mapping>

        </web-app>


        This way all the calls to /root/ should be handled by Jersey



        You can refer to this tutorial







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 25 '18 at 20:04









        BentayeBentaye

        4,58732031




        4,58732031
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53429921%2fintellij-glassfish5-jax-rs-path-not-working%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

            ComboBox Display Member on multiple fields

            Is it possible to collect Nectar points via Trainline?