Why am I getting a http 500 response?HTTP GET request in JavaScript?What is a serialVersionUID and why should I use it?HTTP GET with request bodyHTTP status code for update and delete?How to use java.net.URLConnection to fire and handle HTTP requestsWhy is subtracting these two times (in 1927) giving a strange result?Why don't Java's +=, -=, *=, /= compound assignment operators require casting?Why is char[] preferred over String for passwords?Why is processing a sorted array faster than processing an unsorted array?Why is printing “B” dramatically slower than printing “#”?

What does "T.O." mean?

Graph with cropped letters

What is self hosted version control system?

Is this bible in Koine Greek?

Would webs catch fire if Fire Bolt is used on a creature inside of them?

Fast symmetric key cryptography class

Decrypt T-SQL log backup header and read LSN

Misc bottom backet and crankset questions

how can I enforce the prohibition on love potions?

Can the Wish spell be used to allow someone to be able to cast all of their spells at will?

Log user out after change of IP address?

How are side-channel attacks executed? What does an attacker need to execute a side channel attack?

How do I prevent against authentication side-channel attacks?

Is there a Ukrainian transcript of Trump's controversial July 25 call to President Zelensky?

How should I conceal gaps between laminate flooring and wall trim?

Is the "Watchmen" TV series a continuation of the movie or the comics?

If I am just replacing the car engine, do I need to replace the odometer as well?

Totally Blind Chess

Would the US government of the 1960’s be able to feasibly recreate a modern laptop?

What does "2 fingers to Scotland" mean in Peter Grant's statement about Johnson not listening to the SNP's Westminster leader speeches?

What is the equivalent of "if you say so" in German?

Is putting money in a 401(k) plan risky?

How do you link two checking accounts from two different banks in two different countries?

Is Basalt Monolith a 1-card infinite combo with no payoff?



Why am I getting a http 500 response?


HTTP GET request in JavaScript?What is a serialVersionUID and why should I use it?HTTP GET with request bodyHTTP status code for update and delete?How to use java.net.URLConnection to fire and handle HTTP requestsWhy is subtracting these two times (in 1927) giving a strange result?Why don't Java's +=, -=, *=, /= compound assignment operators require casting?Why is char[] preferred over String for passwords?Why is processing a sorted array faster than processing an unsorted array?Why is printing “B” dramatically slower than printing “#”?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty
margin-bottom:0;









0

















I am attempting to retrieve values in my database through using 'ID' for my path parameter. However I am getting a HTTP 500 response in the URi(http://localhost:8080/JAX_RS/rest/details/123) when attempting to retrieve those values. Below is my DAO class. I can also provide my Resources class if needed. Any feedback would be appreciated.



DetailsDAO


package dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

public class DetailsDAO

private Connection con = null;

public DetailsDAO()
try
System.out.println("Loading db driver...");
//Class.forName("org.apache.derby.jdbc.ClientDriver");
System.out.println("Driver loaded...");
con = DriverManager.getConnection(
"jdbc:derby://localhost:1527/SOA4_DB",
"sean",
"sean");
catch (SQLException ex)
System.out.println("Exception!");
ex.printStackTrace();




public static void main(String[] args)
DetailsDAO dao = new DetailsDAO(); // connect to db
List<Details> detailsList = dao.getAllDetails();
for (Details d : detailsList)
System.out.println(d);


public List<Details> getAllDetails()
List<Details> detailsList = new ArrayList<>();

try
// SQL in here
PreparedStatement ps = con.prepareStatement(
"SELECT * FROM APP.DETAILS"
);
ResultSet rs = ps.executeQuery();
while (rs.next())
Details d = new Details
(rs.getInt("ID"),
rs.getString("NAME"),
rs.getInt("AGE"),
rs.getTimestamp("TIMESTAMP"));
detailsList.add(d);

catch (SQLException ex)
System.err.println("nSQLException");
ex.printStackTrace();


return detailsList;


public Details getDetails(int id)
Details details = null;

try
// SQL in here
PreparedStatement pstmt = con.prepareStatement(
"SELECT ID, NAME, AGE, TIMESTAMP, "
+ "FROM APP.DETAILS "
+ "WHERE (ID = ?)");
pstmt.setInt(1, id);

ResultSet rs = pstmt.executeQuery();

// move the cursor to the start
if(!rs.next()) // !F == T
return null;


// we have at least one record
details = new Details
(rs.getInt("ID"),
rs.getString("NAME"),
rs.getInt("AGE"),
rs.getTimestamp("TIMESTAMP"));

catch (SQLException ex)
Logger.getLogger(DetailsDAO.class.getName()).log(Level.SEVERE, null, ex);
System.err.println("nSQLException");
ex.printStackTrace();


return details;











share|improve this question























  • 2





    Is there an exception and/or a stacktrace generated on the server?

    – Not a JD
    Mar 28 at 22:22











  • @NotaJD exception javax.servlet.ServletException: java.lang.NullPointerException root cause java.lang.NullPointerException

    – jconboy
    Mar 28 at 22:59

















0

















I am attempting to retrieve values in my database through using 'ID' for my path parameter. However I am getting a HTTP 500 response in the URi(http://localhost:8080/JAX_RS/rest/details/123) when attempting to retrieve those values. Below is my DAO class. I can also provide my Resources class if needed. Any feedback would be appreciated.



DetailsDAO


package dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

public class DetailsDAO

private Connection con = null;

public DetailsDAO()
try
System.out.println("Loading db driver...");
//Class.forName("org.apache.derby.jdbc.ClientDriver");
System.out.println("Driver loaded...");
con = DriverManager.getConnection(
"jdbc:derby://localhost:1527/SOA4_DB",
"sean",
"sean");
catch (SQLException ex)
System.out.println("Exception!");
ex.printStackTrace();




public static void main(String[] args)
DetailsDAO dao = new DetailsDAO(); // connect to db
List<Details> detailsList = dao.getAllDetails();
for (Details d : detailsList)
System.out.println(d);


public List<Details> getAllDetails()
List<Details> detailsList = new ArrayList<>();

try
// SQL in here
PreparedStatement ps = con.prepareStatement(
"SELECT * FROM APP.DETAILS"
);
ResultSet rs = ps.executeQuery();
while (rs.next())
Details d = new Details
(rs.getInt("ID"),
rs.getString("NAME"),
rs.getInt("AGE"),
rs.getTimestamp("TIMESTAMP"));
detailsList.add(d);

catch (SQLException ex)
System.err.println("nSQLException");
ex.printStackTrace();


return detailsList;


public Details getDetails(int id)
Details details = null;

try
// SQL in here
PreparedStatement pstmt = con.prepareStatement(
"SELECT ID, NAME, AGE, TIMESTAMP, "
+ "FROM APP.DETAILS "
+ "WHERE (ID = ?)");
pstmt.setInt(1, id);

ResultSet rs = pstmt.executeQuery();

// move the cursor to the start
if(!rs.next()) // !F == T
return null;


// we have at least one record
details = new Details
(rs.getInt("ID"),
rs.getString("NAME"),
rs.getInt("AGE"),
rs.getTimestamp("TIMESTAMP"));

catch (SQLException ex)
Logger.getLogger(DetailsDAO.class.getName()).log(Level.SEVERE, null, ex);
System.err.println("nSQLException");
ex.printStackTrace();


return details;











share|improve this question























  • 2





    Is there an exception and/or a stacktrace generated on the server?

    – Not a JD
    Mar 28 at 22:22











  • @NotaJD exception javax.servlet.ServletException: java.lang.NullPointerException root cause java.lang.NullPointerException

    – jconboy
    Mar 28 at 22:59













0












0








0








I am attempting to retrieve values in my database through using 'ID' for my path parameter. However I am getting a HTTP 500 response in the URi(http://localhost:8080/JAX_RS/rest/details/123) when attempting to retrieve those values. Below is my DAO class. I can also provide my Resources class if needed. Any feedback would be appreciated.



DetailsDAO


package dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

public class DetailsDAO

private Connection con = null;

public DetailsDAO()
try
System.out.println("Loading db driver...");
//Class.forName("org.apache.derby.jdbc.ClientDriver");
System.out.println("Driver loaded...");
con = DriverManager.getConnection(
"jdbc:derby://localhost:1527/SOA4_DB",
"sean",
"sean");
catch (SQLException ex)
System.out.println("Exception!");
ex.printStackTrace();




public static void main(String[] args)
DetailsDAO dao = new DetailsDAO(); // connect to db
List<Details> detailsList = dao.getAllDetails();
for (Details d : detailsList)
System.out.println(d);


public List<Details> getAllDetails()
List<Details> detailsList = new ArrayList<>();

try
// SQL in here
PreparedStatement ps = con.prepareStatement(
"SELECT * FROM APP.DETAILS"
);
ResultSet rs = ps.executeQuery();
while (rs.next())
Details d = new Details
(rs.getInt("ID"),
rs.getString("NAME"),
rs.getInt("AGE"),
rs.getTimestamp("TIMESTAMP"));
detailsList.add(d);

catch (SQLException ex)
System.err.println("nSQLException");
ex.printStackTrace();


return detailsList;


public Details getDetails(int id)
Details details = null;

try
// SQL in here
PreparedStatement pstmt = con.prepareStatement(
"SELECT ID, NAME, AGE, TIMESTAMP, "
+ "FROM APP.DETAILS "
+ "WHERE (ID = ?)");
pstmt.setInt(1, id);

ResultSet rs = pstmt.executeQuery();

// move the cursor to the start
if(!rs.next()) // !F == T
return null;


// we have at least one record
details = new Details
(rs.getInt("ID"),
rs.getString("NAME"),
rs.getInt("AGE"),
rs.getTimestamp("TIMESTAMP"));

catch (SQLException ex)
Logger.getLogger(DetailsDAO.class.getName()).log(Level.SEVERE, null, ex);
System.err.println("nSQLException");
ex.printStackTrace();


return details;











share|improve this question

















I am attempting to retrieve values in my database through using 'ID' for my path parameter. However I am getting a HTTP 500 response in the URi(http://localhost:8080/JAX_RS/rest/details/123) when attempting to retrieve those values. Below is my DAO class. I can also provide my Resources class if needed. Any feedback would be appreciated.



DetailsDAO


package dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

public class DetailsDAO

private Connection con = null;

public DetailsDAO()
try
System.out.println("Loading db driver...");
//Class.forName("org.apache.derby.jdbc.ClientDriver");
System.out.println("Driver loaded...");
con = DriverManager.getConnection(
"jdbc:derby://localhost:1527/SOA4_DB",
"sean",
"sean");
catch (SQLException ex)
System.out.println("Exception!");
ex.printStackTrace();




public static void main(String[] args)
DetailsDAO dao = new DetailsDAO(); // connect to db
List<Details> detailsList = dao.getAllDetails();
for (Details d : detailsList)
System.out.println(d);


public List<Details> getAllDetails()
List<Details> detailsList = new ArrayList<>();

try
// SQL in here
PreparedStatement ps = con.prepareStatement(
"SELECT * FROM APP.DETAILS"
);
ResultSet rs = ps.executeQuery();
while (rs.next())
Details d = new Details
(rs.getInt("ID"),
rs.getString("NAME"),
rs.getInt("AGE"),
rs.getTimestamp("TIMESTAMP"));
detailsList.add(d);

catch (SQLException ex)
System.err.println("nSQLException");
ex.printStackTrace();


return detailsList;


public Details getDetails(int id)
Details details = null;

try
// SQL in here
PreparedStatement pstmt = con.prepareStatement(
"SELECT ID, NAME, AGE, TIMESTAMP, "
+ "FROM APP.DETAILS "
+ "WHERE (ID = ?)");
pstmt.setInt(1, id);

ResultSet rs = pstmt.executeQuery();

// move the cursor to the start
if(!rs.next()) // !F == T
return null;


// we have at least one record
details = new Details
(rs.getInt("ID"),
rs.getString("NAME"),
rs.getInt("AGE"),
rs.getTimestamp("TIMESTAMP"));

catch (SQLException ex)
Logger.getLogger(DetailsDAO.class.getName()).log(Level.SEVERE, null, ex);
System.err.println("nSQLException");
ex.printStackTrace();


return details;








java http get localhost derby






share|improve this question
















share|improve this question













share|improve this question




share|improve this question








edited Mar 28 at 21:49







jconboy

















asked Mar 28 at 21:29









jconboyjconboy

156 bronze badges




156 bronze badges










  • 2





    Is there an exception and/or a stacktrace generated on the server?

    – Not a JD
    Mar 28 at 22:22











  • @NotaJD exception javax.servlet.ServletException: java.lang.NullPointerException root cause java.lang.NullPointerException

    – jconboy
    Mar 28 at 22:59












  • 2





    Is there an exception and/or a stacktrace generated on the server?

    – Not a JD
    Mar 28 at 22:22











  • @NotaJD exception javax.servlet.ServletException: java.lang.NullPointerException root cause java.lang.NullPointerException

    – jconboy
    Mar 28 at 22:59







2




2





Is there an exception and/or a stacktrace generated on the server?

– Not a JD
Mar 28 at 22:22





Is there an exception and/or a stacktrace generated on the server?

– Not a JD
Mar 28 at 22:22













@NotaJD exception javax.servlet.ServletException: java.lang.NullPointerException root cause java.lang.NullPointerException

– jconboy
Mar 28 at 22:59





@NotaJD exception javax.servlet.ServletException: java.lang.NullPointerException root cause java.lang.NullPointerException

– jconboy
Mar 28 at 22:59












1 Answer
1






active

oldest

votes


















1


















You have extra comma after TIMESTAMP in query



PreparedStatement pstmt = con.prepareStatement(
"SELECT ID, NAME, AGE, TIMESTAMP, "
+ "FROM APP.DETAILS "
+ "WHERE (ID = ?)");





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/4.0/"u003ecc by-sa 4.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%2f55407128%2fwhy-am-i-getting-a-http-500-response%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









    1


















    You have extra comma after TIMESTAMP in query



    PreparedStatement pstmt = con.prepareStatement(
    "SELECT ID, NAME, AGE, TIMESTAMP, "
    + "FROM APP.DETAILS "
    + "WHERE (ID = ?)");





    share|improve this answer






























      1


















      You have extra comma after TIMESTAMP in query



      PreparedStatement pstmt = con.prepareStatement(
      "SELECT ID, NAME, AGE, TIMESTAMP, "
      + "FROM APP.DETAILS "
      + "WHERE (ID = ?)");





      share|improve this answer




























        1














        1










        1









        You have extra comma after TIMESTAMP in query



        PreparedStatement pstmt = con.prepareStatement(
        "SELECT ID, NAME, AGE, TIMESTAMP, "
        + "FROM APP.DETAILS "
        + "WHERE (ID = ?)");





        share|improve this answer














        You have extra comma after TIMESTAMP in query



        PreparedStatement pstmt = con.prepareStatement(
        "SELECT ID, NAME, AGE, TIMESTAMP, "
        + "FROM APP.DETAILS "
        + "WHERE (ID = ?)");






        share|improve this answer













        share|improve this answer




        share|improve this answer










        answered Mar 28 at 22:45









        Bor LazeBor Laze

        2,1968 silver badges18 bronze badges




        2,1968 silver badges18 bronze badges

































            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%2f55407128%2fwhy-am-i-getting-a-http-500-response%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

            Obelisk of Theodosius Contents History Description Notes Bibliography Further reading External links Navigation menuAge of spirituality : late antique and early Christian art, third to seventh centuryOver 60 picturesObelisks of the World41°00′21.24″N 28°58′31.43″E / 41.0059000°N 28.9753972°E / 41.0059000; 28.97539727724550-7235741376235741376

            밀양 대씨 역사 각주 함께 보기 둘러보기 메뉴밀양 대씨

            1973년 목차 사건 문화 탄생 사망 노벨상 달력 둘러보기 메뉴