Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: JDBC Connection Error

  1. #1
    Junior Member
    Join Date
    Oct 2017
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default JDBC Connection Error

    I nee help please. I am trying to set up a jsp app on my new laptop but I keep running into the error below which I suspect is due to the connection string. The app works perfectly well on my former laptop. The named instance of the server on my new laptop is LAPTOPNAME\MSSQLSERVER but LAPTOPNAME\SQLEXPRESS on my old laptop.

    org.apache.jasper.JasperException: An exception occurred processing [test.jsp] at line [37]

    31: String MM_myConn_DRIVER = "com.microsoft.sqlserver.jdbc.SQLServerDriver" ;
    32: String MM_myConn_USERNAME = "my_username";
    33: String MM_myConn_PASSWORD = "my_password";
    34: String MM_myConn_STRING = "jdbc:sqlserver://localhost:1433";
    35: Class.forName(MM_myConn_DRIVER);
    36: String dbURL = MM_myConn_STRING + ";user=" + MM_myConn_USERNAME + ";password=" + MM_myConn_PASSWORD;
    37: Connection conn_up_tr = DriverManager.getConnection(dbURL);

    Root Cause

    javax.servlet.ServletException: java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter
    org.apache.jasper.runtime.PageContextImpl.handlePa geException(PageContextImpl.java:667)
    org.apache.jsp.new_005fuser_jsp._jspService(new_00 5fuser_jsp.java:1183)
    org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:741)
    org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:444)
    org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:385)
    org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:329)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:741)
    org.apache.tomcat.websocket.server.WsFilter.doFilt er(WsFilter.java:53)
    org.apache.catalina.filters.SetCharacterEncodingFi lter.doFilter(SetCharacterEncodingFilter.java:108)

  2. #2
    Member
    Join Date
    Aug 2017
    Location
    Northern Ireland
    Posts
    59
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: JDBC Connection Error

    Is your new laptop using Java 9? Plenty of Google hits for "java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter", but you've already done that search yourself right?
    Tim Driven Development

  3. #3
    Junior Member
    Join Date
    Oct 2017
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: JDBC Connection Error

    Quote Originally Posted by trcooke View Post
    Is your new laptop using Java 9? Plenty of Google hits for "java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter", but you've already done that search yourself right?
    Thanks Trcooke. The laptop is running Java 9. I uninstalled it and replaced with Java 8 and all is working fine now. I don't know precisely what changes in Java 9 that was responsible for the glitch but the problem is solved.

  4. #4
    Member
    Join Date
    Aug 2017
    Location
    Northern Ireland
    Posts
    59
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: JDBC Connection Error

    From the limited searching I've done it appears that the JAXB API library has been removed from Java 9 and provided solely in the Java EE library. Hence your Java 9 JRE was unable to find the class.
    Tim Driven Development

Similar Threads

  1. Replies: 1
    Last Post: August 21st, 2014, 01:49 PM
  2. JDBC CONNECTION ERROR in eclipse
    By schlinzj in forum What's Wrong With My Code?
    Replies: 4
    Last Post: June 13th, 2014, 02:36 PM
  3. JDBC CONNECTION ERROR in eclipse
    By schlinzj in forum What's Wrong With My Code?
    Replies: 0
    Last Post: June 13th, 2014, 07:14 AM
  4. JDBC Too Many Connection Error
    By sajithgsm in forum JDBC & Databases
    Replies: 1
    Last Post: February 22nd, 2012, 05:08 AM
  5. JDBC connection error
    By nrao in forum What's Wrong With My Code?
    Replies: 7
    Last Post: November 11th, 2010, 12:43 PM