seenaomi.net – blog

Learning in motion

Monday 8/24/15 – happy results gradle2_ib

without comments

Continuing on where I left off Sunday with the error below:

HTTP Status 500 – javax.servlet.ServletException: java.lang.AbstractMethodError: com.mysql.jdbc.Connection.isValid(I)Z

type Exception report

message javax.servlet.ServletException: java.lang.AbstractMethodError: com.mysql.jdbc.Connection.isValid(I)Z

description The server encountered an internal error that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: javax.servlet.ServletException: java.lang.AbstractMethodError: com.mysql.jdbc.Connection.isValid(I)Z
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:555)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:461)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

 

root cause

javax.servlet.ServletException: java.lang.AbstractMethodError: com.mysql.jdbc.Connection.isValid(I)Z
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:908)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:837)
org.apache.jsp.login_jsp._jspService(login_jsp.java:116)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:438)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

 

root cause

java.lang.AbstractMethodError: com.mysql.jdbc.Connection.isValid(I)Z
org.apache.tomcat.dbcp.dbcp2.DelegatingConnection.isValid(DelegatingConnection.java:913)
org.apache.tomcat.dbcp.dbcp2.PoolableConnection.validate(PoolableConnection.java:282)
org.apache.tomcat.dbcp.dbcp2.PoolableConnectionFactory.validateConnection(PoolableConnectionFactory.java:356)
org.apache.tomcat.dbcp.dbcp2.BasicDataSource.validateConnectionFactory(BasicDataSource.java:2306)
org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:2289)
org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:2038)
org.apache.tomcat.dbcp.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1532)
com.twinfeats.interfacebook.sql.SQLUtil.getConnection(SQLUtil.java:27)
com.twinfeats.interfacebook.java.Users.loadUser(Users.java:34)
org.apache.jsp.login_jsp._jspService(login_jsp.java:99)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:438)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

 

8/24 — The above is fixed !

Solution : For some reason the mysql-connector-java-5.1.36.jar file had vanished from the gradle2>web-inf>lib folder within tomcat I copied it in there and tada success!

Well that was fun. Now I can actually work through these other errors. Goodtimes.

Also note jquery error on the home.jsp page – this error is stopping the page from pulling current public noted posts from the database and displaying on the page, the url is wrong – http://localhost:8080/gradle2_ib/book/InterfacebookServlet?start=0&count=20&username= 404 (Not Found)

^^ the above was fixed by changing the url path from being hardcoded to the former war file to now – url : “<%=request.getContextPath()%>/InterfacebookServlet”

Now I need to fix the image urls as they are not showing up on the page but the public posts are!

I will need to change all the book references to <%=request.getContextPath()%> which we learned in class but still hardcoded because I’m sure none of us thought we would be converting the builds into other project builds and the war names would be changing.

Ok so I still need to label the error alerts better however I was able to get them to stop on the index and home.jsp pages. By again changing all references to the book war in the ajax url path to :

$.ajax({

           url : “<%=request.getContextPath()%>/InterfacebookServlet”

Images however are not showing up – I will have to dig deeper to sort that out. I did change the photo url references from book to the getContextPath but that was incorrect as they are not actually referencing getting images just uploading added images via dropzone. I made tweaks to the MediaUpload.java but that was also incorrect after further thinking it through that is just a local hosting folder for the images as they get converted. Long story short I haven’t located where the url string is but I will and I will correct it.

Pushed current changes to Bitbucket

I had been trying to figure out why images weren’t showing. Wasted an hour or more before I did a test post and sure enough the image showed up – so then I wracked the code a little bit more until I looked at the DB to see how they show up there.

/book/uploads/images/1434942682905seemenaomi2.jpg   22

/book/uploads/images/1435087780262coding.jpg 23

/book/uploads/images/1435088185658binary_code.jpg 24

/gradle2_ib/uploads/images/1440477705177coding.jpg 25

So there’s that. Wondering if it’s just that way now – or if I can hardcode the DB so all images reflect the new war or if that would work or … I dunno I’ll keep working on it.

The answer is YES! I can hard code the DB to change the war name and the images then show up – woo

Final commit — changed line 341 the url in the onclick was hardcoded to prior war

changed it to <%=request.getContextPath()%> of the home.jsp file

https://bitbucket.org/gn0mster/interface-final-project/commits/all

Written by seenaomi

August 24th, 2015 at 7:44 pm

Posted in Allthecode

Leave a Reply