Why my MySQL JDBC Connect fail??

Dear friends:
I have following code:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class JdbcExample2 {
  public static void main(String args[]) {
    Connection con = null;
    try {
      Class.forName("com.mysql.jdbc.Driver").newInstance();
      //jdbc:mysql://host_name:port/dbname
//     con = DriverManager.getConnection("jdbc:MySQL:///test","admin", "admin");
      con = DriverManager.getConnection("jdbc:MySQL://localhost:3306/test","admin", "admin");
      if(!con.isClosed())
        System.out.println("Successfully connected to " +
          "MySQL server using TCP/IP...");
    } catch(Exception e) {
      System.err.println("Exception: " + e.getMessage());
    } finally {
      try {
        if(con != null)
          con.close();
      } catch(SQLException e) {}
}But when I run , I got following error:
Exception: com.mysql.jdbc.Driver
My question is:
[1]. when I connect to MySQL Server through mySQL Client, I got
Enter password: *****
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 18 to server version: 4.1.21-community-nt
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
how Can I determine MySQL Server name?? I forgot when I install, maybe MySQL is my SQL Server name
[2]. Do I need to creat a user DSN name or System DSN name for MySQL Server?? which one is best??
How to do it??
[3]. How to make above simple JDBC program runnable??
Thanks
sunny
Message was edited by:
sunnymanman

Thanks, see new errors:
C:\Project\java>java Jdbc11
Copyright 2004, R.G.Baldwin
java.sql.SQLException: Access denied for user 'admin'@'localhost' (using password: YES)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:946)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2941)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:868)
at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3340)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1238)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:2743)
at com.mysql.jdbc.Connection.<init>(Connection.java:1553)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at Jdbc11.main(Jdbc11.java:23)
C:\Project\java>
any idea??
here Jdbc11.java:23 is:
Connection con = DriverManager.getConnection(
url,"admin", "YES");
my userID/Password = admin/admin;
sunny
Message was edited by:
sunnymanman

Similar Messages

  • MySQL -- JDBC Connection help !!!

    Hi everybody...Well I have MySQL Server and Java, I get the JDBC and tried this:
    import java.sql.*;
    public class JdbcE {
    public static void main(String args[]) {
    Connection con = null;
    try {
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    con = DriverManager.getConnection("jdbc:mysql://localhost/test", "user", "pass");
    if(!con.isClosed())
    System.out.println("Successfully connected to MySQL server...");
    } catch(Exception e) {
    System.err.println("Exception: " + e.getMessage());
    } finally {
    try {
    if(con != null)
    con.close();
    } catch(SQLException e) {}
    And with that code all works fine...but when I change the Host from LOCALHOST to [ROUTER IP] like this:
    con = DriverManager.getConnection("jdbc:mysql://182.185.145.12/test", "user", "pass");
    I got this exception:
    Exception: Communications link failure due to underlying exception:
    ** BEGIN NESTED EXCEPTION **
    java.net.SocketException
    MESSAGE: java.net.ConnectException: Connection timed out: connect
    STACKTRACE:
    java.net.SocketException: java.net.ConnectException: Connection timed out: conne
    ct
    at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.ja
    va:156)
    at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:276)
    at com.mysql.jdbc.Connection.createNewIO(Connection.java:2666)
    at com.mysql.jdbc.Connection.<init>(Connection.java:1531)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java
    :266)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at JdbcE.main(JdbcE.java:11)
    ** END NESTED EXCEPTION **
    Last packet sent to the server was 16 ms ago.
    I don't know how to solve it...
    I have a 2wire 1700HG router, maybe it would be a problem of the firewall can anyone help me to solve this problem??

    Well I sorry...I am very new in this kind of things...I just know that I have a 2wire 1700HG, I have installed MySQL Server, Java and mysql-connector-java...
    When I try this in the connection statement:
    con = DriverManager.getConnection("jdbc:mysql://localhost/test", "user", "test");
    Everything works fine...but when I try this to connect from a remote PC
    con = DriverManager.getConnection("jdbc:mysql://189.145.185.182/test", "user", "test");
    This error comes out on screen:
    Exception: Communications link failure due to underlying exception:
    ** BEGIN NESTED EXCEPTION **
    java.net.SocketException
    MESSAGE: java.net.ConnectException: Connection timed out: connect
    STACKTRACE:
    java.net.SocketException: java.net.ConnectException: Connection timed out: conne
    ct
    at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.ja
    va:156)
    at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:276)
    at com.mysql.jdbc.Connection.createNewIO(Connection.java:2666)
    at com.mysql.jdbc.Connection.<init>(Connection.java:1531)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java
    :266)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at JdbcE.main(JdbcE.java:11)
    ** END NESTED EXCEPTION **
    Last packet sent to the server was 16 ms ago.
    I don't know what can I do :S please help!! :D

  • MySQL - JDBC Connectivity

    Hello,
    I built a small web app that reads and writes to a MySQL db via a servlet. This application worked fine on my dev box, but when I moved it to a staging machine it would not connect to the MySQL server on the staging box. After much frustration and not being able to figure up from down, I wrote another test app that did nothing but connect to a MySQL db and return success/fail message. I got the same behavior from this app -- it will connect to a local MySQL db on my dev system (WinXP), on another linux box but not on the staging server.
    Now, the kicker is that if I run either of these applications on one of the other systems, and set the db URL to the staging server instance of MySQL, I can connect and update/read the database there. So, it's just something wrong with my configuration in my deployment on the staging server that prevents the apps from connecting to the MySQL server locally on that one system.
    The exception that is returned from a failed connection is "Communication link failure." I can't find anything useful about my case through searches.
    AFAICS, the installations of MySQL on the two linux systems are identical -- both canned installs for Ubuntu 7.1 via package manager. Yet, one works, the other doesn't.
    Test system: MySQL 5.0.45-Debian_1ubuntu3.3-log (works), Tomcat 6.0.16 (also tested with 6.0.14)
    Staging: MySQL 5.0.45-Debian_1ubuntu3.3-log (doesn't work), Tomcat 5.5
    OS on both: Linux 2.6.22-15-generic/Ubuntu 7.1
    I guess the summary is,
    dbUrl="jdbc:mysql://ellen:3306/fundraiser" will work for db connectivity if I am running the application on any system other than ellen. (Also, note that I tried deploying with a substitution of "localhost" for "ellen" in the URL and it did not work.)
    I'm hoping somebody can point me in the right direction, as I'm out of ideas for troubleshooting.
    Thanks.
    mp

    Hello,
    Following is the output from getStackTrace().
    Thanks.
    mp
    sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
    com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074)
    com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2104)
    com.mysql.jdbc.ConnectionImpl.(ConnectionImpl.java:729)
    com.mysql.jdbc.JDBC4Connection.(JDBC4Connection.java:46)
    sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
    com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:302)
    com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:283)
    java.sql.DriverManager.getConnection(DriverManager.java:582)
    java.sql.DriverManager.getConnection(DriverManager.java:185)
    net.homelinux.servlet.JdbcTest.processRequest(JdbcTest.java:55)
    net.homelinux.servlet.JdbcTest.doGet(JdbcTest.java:92)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    sun.reflect.GeneratedMethodAccessor77.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:244)
    java.security.AccessController.doPrivileged(Native Method)
    javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
    org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:276)
    org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162)
    org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:262)
    org.apache.catalina.core.ApplicationFilterChain.access$0(ApplicationFilterChain.java:192)
    org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:171)
    java.security.AccessController.doPrivileged(Native Method)
    org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:167)
    org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
    org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
    org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
    org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
    org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
    org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
    org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
    org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
    java.lang.Thread.run(Thread.java:619)

  • MySql JDBC connection classdef not found

    Hello there i am currently trying to connect a mysql database to my project. I am using Jbuilder5 enterprise . Currently i have tables setup using MySQL and i can connect to them using the database pilot. Yet when i try to access the database using java code i get a classdefnot found at event dispatch. Can anyone tell me where i am going wrong?

    No, don't put that JAR or any other in that directory. That's for language extensions (e.g., packages that begin with "javax") only.
    The MySQL JAR should be closer to your class files, IMO. Then you have to add it to the CLASSPATH according to JBuilder's conventions.
    I use a standard directory structure for all my apps. At the top level is a directory for the application. Under a directory named "source" where I put all the code that comes out of the version control system. Under that I'll have different directories (e.g., "java" for Java source files, "lib" for 3rd party JARs like your MySQL JDBC JAR, etc.)
    I create another directory "build" under the application directory where all the generated stuff goes, like .class files, javadocs, JUnit reports, etc.
    This lets me use a common Ant build file to build my apps and keeps everything together. I just all all the JARs in my "lib" directory when I compile the code. I'd recommend organizing your apps this way, too.
    MOD

  • Why do I get connection failed when logging in on app store on wireless, but Wired LAN works fine?

    I've been having the same issue as many other people. On OSX Lion with latest updates as of 3/20/2012. Tried deleting .plist files, checking keychain access and even reset keychain. I still get the error of Connection Failed when trying to download updates or a new app from the app store.
    I also can't connect to the iTunes "Account" area. It produces an error that the request failed (-1200)
    I finally decided to try a wired connection instead of my wireless. Now it works great! So I removed my wireless network and re-added it. Back to square one. Work around for now is fine, but I should be able to use this over wireless, too!
    I just now tested connecting to a different wireless network (EVO Hotspot) and it worked fine. So it's something specific to my office wireless network. Nothing changed on our firewall (I'm the administrator). It just stopped working.
    Anthony

    Hi ...
    Perhaps there's something that you haven't tried here >  Troubleshooting Wi-Fi issues in OS X Lion

  • Why do I get "Connection failed" when trying to connect to Lion?

    One of our two Macs is running Snow Leopard, the other, Lion. I can connect from Lion to Snow Leopard OK, but not the other direction: when I try, I get "Connection Failed." I can connect as guest however. Ive run Disk Warrior on both machines. No change in behavior. Any one else experiencing this?

    Solution is here: https://discussions.apple.com/thread/3197723
    Go to System Preferences > Sharing > Options...
    Unshare your home folder and then you can connect. Apparently Lion shares your home folder by default.
    Worked for me.

  • BI JDBC Connection fails to connect to SQL Server 2000

    Hello SDNs,
    I have configured my JDBC connector to connect to MS SQL Server 2000(Third party in my case) using the document How to Configure UD connect on the J2EE server for JDBC Access to External Drivers.
    I have given the following properties for my JDBC connector:
    Driver Name : com.microsoft.jdbc.sqlserver.SQLServerDriver
    URL : jdbc:microsoft:sqlserver://servername:1433;database=<databasename>
    When i test the connection using the url: http://hostname:50000/TestJDBC_Web/TestJDBCPage.jsp
    Here is the Error:
    <b>Details:
    com.sap.ip.bi.sdk.exception.BIConnectionFailedException: Cannot open the connection at com.sap.ip.bi.sdk.dac.connector.jdbc.JdbcConnectionFactory.getConnectionEx(JdbcConnectionFactory.java:238) at com.sap.ip.bi.sdk.trialarea.connector.servlet.model.JDBCModel.getConnection(JDBCModel.java:797) at com.sap.ip.bi.sdk.trialarea.connector.servlet.model.JDBCModel.getTables(JDBCModel.java:132) at
    com.sap.ip.bi.sdk.dac.connector.jdbc.JdbcManagedConnection.(JdbcManagedConnection.java:118) ... 23 more Caused by: java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver Found in negative cache -
    Loader Info -
    ClassLoader name: [connector:default] Parent loader name: [Frame ClassLoader] References: common:service:http;service:servlet_jsp service:ejb common:service:iiop;service:naming;service:p4;service:ts service:jmsconnector library:jsse library:servlet common:library:IAIKSecurity;library:activation;library:mail;library:tcsecssl library:ejb20 library:j2eeca library:jms library:opensql common:library:com.sap.security.api.sda;library:com.sap.security.core.sda;library:security.class;library:webservices_lib;service:adminadapter;service:basicadmin;service:com.sap.security.core.ume.service;service:configuration;service:connector;service:dbpool;service:deploy;service:jmx;service:jmx_notification;service:keystore;service:security;service:userstore interface:resourcecontext_api interface:webservices interface:cross interface:ejbserialization common:library:bimmrcore;library:bimmrdb sap.com/cafcore sap.com/cafruntimeear library:tcconnconnectorframework library:sapxmltoolkit sap.com/com.sap.ip.bi.sdk.dac.connector.xmla.x library:com.sap.mw.jco library:com.sap.aii.proxy.framework library:com.sap.aii.util.misc library:com.sap.ip.bi.sdk.dac.connector.odbodll library:BI_JDBC library:bimmrcwm_1.0_library library:bimmrjmi library:com.sap.ip.bi.sdk library:MSSQL Resources: H:\usr\sap\BD2\DVEBMGS00\j2ee\cluster\server0\apps\sap.com\com.sap.ip.bi.sdk.dac.connector.xmla\connector\connectors\bi_sdk_xmla.rar\bi_sdk_xmla.jar H:\usr\sap\BD2\DVEBMGS00\j2ee\cluster\server0\apps\sap.com\cafbwadapterassembly\connector\connectors\sap.com_cafbwadapterassembly.rar\lib\java\sap.comcafbwadapter~caf.bw.adapter.jar H:\usr\sap\BD2\DVEBMGS00\j2ee\cluster\server0\apps\sap.com\com.sap.ip.bi.sdk.dac.connector.sapq\connector\connectors\bi_sdk_sapq.rar\bi_sdk_sapq.jar H:\usr\sap\BD2\DVEBMGS00\j2ee\cluster\server0\apps\sap.com\com.sap.ip.bi.sdk.dac.connector.jdbc\connector\connectors\bi_sdk_jdbc.rar\bi_sdk_jdbc.jar Loading model: {parent,references,local} -
    at com.sap.engine.frame.core.load.ReferencedLoader.loadClass(ReferencedLoader.java:360) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:141) at com.sap.ip.bi.sdk.dac.connector.jdbc.impl.Connection.connectDB(Connection.java:365) ... 25 more</b>
    Please let me know if any changes are required in Driver name and URL.
    Your inputs will be highly appreciated.
    Thanks,
    Sireesha.B
    Message was edited by:
            sireesha Borra

    Hi Sireesha,
    Some insights.....while using JDBC connector .
    For JDK 1.1 environments, access to the "current working directory" mustbe granted.
    For Java 2 environments, access to the temporary directory specified by the VM configuration must be granted. The following is an example of permissions being granted in the file java.security.policy for the C:\TEMP directory:
    // permissions granted to all domains grant { // Permission to create and delete temporary files. // Adjust the temporary directory for your environment. permission java.io.FilePermission "C:
    TEMP
    -", "read,write,delete"; };
    Note 777304 - Problems with JDBC drivers when using BI UDI
    Related notes -
    834385 - 'Invalid operation: result set closed' Exception
    834384 - Problems with selection in InfoPackage in UD Connect
    777306 - MSSQL problem when using BI UDI
    777305 - Problems with Unicode when using BI UDI
    Fyi-
    http://dev.mysql.com/downloads/index.html
    Regards,
    Anil

  • MySQL JDBC connection error

    Hi!
    I am trying to conect to MySql database form a jsp page, but I get error. I am using the following:
    1. MySql dababase installed in C:/mysql
    2. Tomcat installed in c:/tomcat
    3. JDBC driver "mm.mysql-2.0.14-bin.jar" installed in c:\tomcat\lib
    Here is my code:
    <%@ page import="java.sql.*" %>
    <%
    String connectionURL = "jdbc:mysql://localhost:3306/gixpro1?user=username&password=pwd";
    Connection connection = null;
    Statement statement = null;
    ResultSet rs = null;
    %>
    <html><body>
    <%
    Class.forName("org.gjt.mm.mysql.Driver").newInstance();
    connection = DriverManager.getConnection(connectionURL, "", "");
    statement = connection.createStatement();
    rs = statement.executeQuery("SELECT * FROM gixpro1");
    while (rs.next()) {
    out.println(rs.getString("name")+"<br>");
    rs.close();
    %>
    </body></html>
    Here is my error:
    Internal Servlet Error:
    javax.servlet.ServletException: org.gjt.mm.mysql.Driver
    at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:462)
    at jsp.test_4._jspService(test_4.java:89)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java)
    at org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java:570)
    at org.apache.tomcat.core.Handler.invoke(Handler.java:322)
    at org.apache.tomcat.core.Handler.service(Handler.java:235)
    at org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:481)
    at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:917)
    at org.apache.tomcat.core.ContextManager.service(ContextManager.java:833)
    at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Http10Interceptor.java:176)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:533)
    at java.lang.Thread.run(Thread.java:484)
    Root cause:
    java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver
    at org.apache.tomcat.util.depend.DependClassLoader12Impl.loadClassInternal1(DependClassLoader12.java:240)
    at org.apache.tomcat.util.depend.DependClassLoader12Impl$1.run(DependClassLoader12.java:109)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.apache.tomcat.util.depend.DependClassLoader12Impl.loadClass(DependClassLoader12.java:107)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:120)
    at jsp.test_4._jspService(test_4.java:68)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java)
    at org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java:570)
    at org.apache.tomcat.core.Handler.invoke(Handler.java:322)
    at org.apache.tomcat.core.Handler.service(Handler.java:235)
    at org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:481)
    at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:917)
    at org.apache.tomcat.core.ContextManager.service(ContextManager.java:833)
    at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Http10Interceptor.java:176)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:533)
    at java.lang.Thread.run(Thread.java:484) at org.apache.tomcat.util.depend.DependClassLoader12Impl$1.run(DependClassLoader12.java:109)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.apache.tomcat.util.depend.DependClassLoader12Impl.loadClass(DependClassLoader12.java:107)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:120)
    at jsp.test_3._jspService(test_3.java:69)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java)
    at org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java:570)
    at org.apache.tomcat.core.Handler.invoke(Handler.java:322)
    at org.apache.tomcat.core.Handler.service(Handler.java:235)
    at org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:481)
    at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:917)
    at org.apache.tomcat.core.ContextManager.service(ContextManager.java:833)
    at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(Http10Interceptor.java:176)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:533)
    at java.lang.Thread.run(Thread.java:484)

    Hi!
    I also have the same problem (I also test the sample in this case but still got the same error. When I use a standard java client then I can acess mySQL database without any problem, this just occurs when trying to access the database from a JSP page.
    CLASSPATH=
    C:\Program\RDBMS\mySQL\mysql-connector-java-2.0.14\mysql-connector-java-2.0.14-bin.jar
    Please need som advice on this.
    Regards
    Tobbe
    See errormessage below
    javax.servlet.ServletException: org.gjt.mm.mysql.Driver
    at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:463)
    at org.apache.jsp.TestMySQL$jsp._jspService(TestMySQL$jsp.java:91)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    root cause
    java.lang.ClassNotFoundException: org.gjt.mm.mysql.Driver
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1320)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1169)

  • JDBC connection fails with "java.rmi.NoSuchObjectException" message

    When connecting a JDBC client to a FireSIGHT Management Center, the following error message appears:
    SEVERE: java.rmi.NoSuchObjectException
            at java.net.PlainSocketImpl.socketConnect(Native Method)
            at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
            at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
            at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
            at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:391)
            at java.net.Socket.connect(Socket.java:579)
            at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:618)
            at sun.security.ssl.SSLSocketImpl.<init>(SSLSocketImpl.java:407)
            at sun.security.ssl.SSLSocketFactoryImpl.createSocket(SSLSocketFactoryImpl.java:88)
            at InstallCert.main(InstallCert.java:81)

    Cause
    Without the Server Hostname field filled in, a FireSIGHT Management Center (also known as Defense Center) tells the JDBC client that it has an address of localhost, or 127.0.0.1, which causes the connection to fail.
    Solution
    Step 1: Log in to your FireSIGHT Management Center where the JDBC is trying to connect to.
    Step 2: Navigate to System > Local > Configuration.
    Step 3: When the page loads, select Database on the left pane.
    Step 4: Ensure that the Server Hostname field is filled out with the Fully Qualified Domain Name, or the IP address of the FireSIGHT Management Center.

  • Java.io.EOFException at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1956)

    Hi,All
    Need Help regarding the exception.
    As i tried so many way to solve this problem but cound'nt find out the solution.!!! If i restart the server then this error is resolved but for the some time.,after 4-5 hour again i need to restart the server.
    so please help me out from this problem!!!!!!
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    javax.servlet.ServletException: #{cityf.OrderToConsumerCity}: javax.faces.el.EvaluationException: org.hibernate.exception.JDBCConnectionException: could not execute query
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:225)
         org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:127)
         org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277)
    root cause
    javax.faces.FacesException: #{cityf.OrderToConsumerCity}: javax.faces.el.EvaluationException: org.hibernate.exception.JDBCConnectionException: could not execute query
         com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:98)
         javax.faces.component.UICommand.broadcast(UICommand.java:332)
         org.ajax4jsf.framework.ajax.AjaxViewRoot.processEvents(AjaxViewRoot.java:180)
         org.ajax4jsf.framework.ajax.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:158)
         org.ajax4jsf.framework.ajax.AjaxViewRoot.processApplication(AjaxViewRoot.java:346)
         com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:95)
         com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:245)
         com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:110)
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:213)
         org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:127)
         org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277)
    root cause
    javax.faces.el.EvaluationException: org.hibernate.exception.JDBCConnectionException: could not execute query
         com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:150)
         com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:92)
         javax.faces.component.UICommand.broadcast(UICommand.java:332)
         org.ajax4jsf.framework.ajax.AjaxViewRoot.processEvents(AjaxViewRoot.java:180)
         org.ajax4jsf.framework.ajax.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:158)
         org.ajax4jsf.framework.ajax.AjaxViewRoot.processApplication(AjaxViewRoot.java:346)
         com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:95)
         com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:245)
         com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:110)
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:213)
         org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:127)
         org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277)
    root cause
    org.hibernate.exception.JDBCConnectionException: could not execute query
         org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:74)
         org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
         org.hibernate.loader.Loader.doList(Loader.java:2223)
         org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
         org.hibernate.loader.Loader.list(Loader.java:2099)
         org.hibernate.hql.classic.QueryTranslatorImpl.list(QueryTranslatorImpl.java:912)
         org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
         org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
         org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
         com.etelic.dao.ConsumerDAOHibernate.getCityList(ConsumerDAOHibernate.java:153)
         com.etelic.controller.City.OrderToConsumerCity(City.java:286)
         sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         java.lang.reflect.Method.invoke(Unknown Source)
         com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:146)
         com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:92)
         javax.faces.component.UICommand.broadcast(UICommand.java:332)
         org.ajax4jsf.framework.ajax.AjaxViewRoot.processEvents(AjaxViewRoot.java:180)
         org.ajax4jsf.framework.ajax.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:158)
         org.ajax4jsf.framework.ajax.AjaxViewRoot.processApplication(AjaxViewRoot.java:346)
         com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:95)
         com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:245)
         com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:110)
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:213)
         org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:127)
         org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277)
    root cause
    com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: No operations allowed after connection closed.Connection was implicitly closed due to underlying exception/error:
    ** BEGIN NESTED EXCEPTION **
    com.mysql.jdbc.CommunicationsException
    MESSAGE: Communications link failure due to underlying exception:
    ** BEGIN NESTED EXCEPTION **
    java.io.EOFException
    STACKTRACE:
    java.io.EOFException
         at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1956)
         at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2368)
         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2867)
         at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1616)
         at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1708)
         at com.mysql.jdbc.Connection.execSQL(Connection.java:3255)
         at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1293)
         at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1428)
         at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)
         at org.hibernate.loader.Loader.getResultSet(Loader.java:1787)
         at org.hibernate.loader.Loader.doQuery(Loader.java:674)
         at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
         at org.hibernate.loader.Loader.doList(Loader.java:2220)
         at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
         at org.hibernate.loader.Loader.list(Loader.java:2099)
         at org.hibernate.hql.classic.QueryTranslatorImpl.list(QueryTranslatorImpl.java:912)
         at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
         at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
         at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
         at com.etelic.dao.ConsumerDAOHibernate.getDelhiLocalityListByPincode(ConsumerDAOHibernate.java:116)
         at com.etelic.bo.ConsumerBO.getDelhiLocalityListByPincode(ConsumerBO.java:44)
         at com.etelic.manager.ConsumerManager.getDelhiLocalityList(ConsumerManager.java:38)
         at com.etelic.controller.ConsumerSearchParametersInput.search(ConsumerSearchParametersInput.java:275)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:146)
         at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:92)
         at javax.faces.component.UICommand.broadcast(UICommand.java:332)
         at org.ajax4jsf.framework.ajax.AjaxViewRoot.processEvents(AjaxViewRoot.java:180)
         at org.ajax4jsf.framework.ajax.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:158)
         at org.ajax4jsf.framework.ajax.AjaxViewRoot.processApplication(AjaxViewRoot.java:346)
         at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:95)
         at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:245)
         at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:110)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:213)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:127)
         at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
         at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
         at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
         at java.lang.Thread.run(Unknown Source)
    ** END NESTED EXCEPTION **
    Last packet sent to the server was 15 ms ago.
    STACKTRACE:
    com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:
    ** BEGIN NESTED EXCEPTION **
    java.io.EOFException
    STACKTRACE:
    *java.io.EOFException*
    *     at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1956)*     at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2368)
         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2867)
         at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1616)
         at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1708)
         at com.mysql.jdbc.Connection.execSQL(Connection.java:3255)
         at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1293)
         at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1428)
         at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)
         at org.hibernate.loader.Loader.getResultSet(Loader.java:1787)
         at org.hibernate.loader.Loader.doQuery(Loader.java:674)
         at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
         at org.hibernate.loader.Loader.doList(Loader.java:2220)
         at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
         at org.hibernate.loader.Loader.list(Loader.java:2099)
         at org.hibernate.hql.classic.QueryTranslatorImpl.list(QueryTranslatorImpl.java:912)
         at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
         at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
         at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
         at com.etelic.dao.ConsumerDAOHibernate.getDelhiLocalityListByPincode(ConsumerDAOHibernate.java:116)
         at com.etelic.bo.ConsumerBO.getDelhiLocalityListByPincode(ConsumerBO.java:44)
         at com.etelic.manager.ConsumerManager.getDelhiLocalityList(ConsumerManager.java:38)
         at com.etelic.controller.ConsumerSearchParametersInput.search(ConsumerSearchParametersInput.java:275)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:146)
         at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:92)
         at javax.faces.component.UICommand.broadcast(UICommand.java:332)
         at org.ajax4jsf.framework.ajax.AjaxViewRoot.processEvents(AjaxViewRoot.java:180)
         at org.ajax4jsf.framework.ajax.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:158)
         at org.ajax4jsf.framework.ajax.AjaxViewRoot.processApplication(AjaxViewRoot.java:346)
         at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:95)
         at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:245)
         at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:110)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:213)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:127)
         at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
         at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
         at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
         at java.lang.Thread.run(Unknown Source)
    ** END NESTED EXCEPTION **
    Last packet sent to the server was 15 ms ago.
         at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2579)
         at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2867)
         at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1616)
         at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1708)
         at com.mysql.jdbc.Connection.execSQL(Connection.java:3255)
         at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1293)
         at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1428)
         at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)
         at org.hibernate.loader.Loader.getResultSet(Loader.java:1787)
         at org.hibernate.loader.Loader.doQuery(Loader.java:674)
         at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
         at org.hibernate.loader.Loader.doList(Loader.java:2220)
         at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
         at org.hibernate.loader.Loader.list(Loader.java:2099)
         at org.hibernate.hql.classic.QueryTranslatorImpl.list(QueryTranslatorImpl.java:912)
         at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
         at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
         at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
         at com.etelic.dao.ConsumerDAOHibernate.getDelhiLocalityListByPincode(ConsumerDAOHibernate.java:116)
         at com.etelic.bo.ConsumerBO.getDelhiLocalityListByPincode(ConsumerBO.java:44)
         at com.etelic.manager.ConsumerManager.getDelhiLocalityList(ConsumerManager.java:38)
         at com.etelic.controller.ConsumerSearchParametersInput.search(ConsumerSearchParametersInput.java:275)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         at java.lang.reflect.Method.invoke(Unknown Source)
         at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:146)
         at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:92)
         at javax.faces.component.UICommand.broadcast(UICommand.java:332)
         at org.ajax4jsf.framework.ajax.AjaxViewRoot.processEvents(AjaxViewRoot.java:180)
         at org.ajax4jsf.framework.ajax.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:158)
         at org.ajax4jsf.framework.ajax.AjaxViewRoot.processApplication(AjaxViewRoot.java:346)
         at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:95)
         at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:245)
         at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:110)
         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:213)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:127)
         at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
         at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
         at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
         at java.lang.Thread.run(Unknown Source)
    ** END NESTED EXCEPTION **
         com.mysql.jdbc.SQLError.createSQLException(SQLError.java:888)
         com.mysql.jdbc.Connection.checkClosed(Connection.java:1931)
         com.mysql.jdbc.Connection.prepareStatement(Connection.java:4720)
         com.mysql.jdbc.Connection.prepareStatement(Connection.java:4686)
         org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:505)
         org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:423)
         org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139)
         org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1547)
         org.hibernate.loader.Loader.doQuery(Loader.java:673)
         org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
         org.hibernate.loader.Loader.doList(Loader.java:2220)
         org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
         org.hibernate.loader.Loader.list(Loader.java:2099)
         org.hibernate.hql.classic.QueryTranslatorImpl.list(QueryTranslatorImpl.java:912)
         org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
         org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
         org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
         com.etelic.dao.ConsumerDAOHibernate.getCityList(ConsumerDAOHibernate.java:153)
         com.etelic.controller.City.OrderToConsumerCity(City.java:286)
         sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
         java.lang.reflect.Method.invoke(Unknown Source)
         com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:146)
         com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:92)
         javax.faces.component.UICommand.broadcast(UICommand.java:332)
         org.ajax4jsf.framework.ajax.AjaxViewRoot.processEvents(AjaxViewRoot.java:180)
         org.ajax4jsf.framework.ajax.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:158)
         org.ajax4jsf.framework.ajax.AjaxViewRoot.processApplication(AjaxViewRoot.java:346)
         com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:95)
         com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:245)
         com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:110)
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:213)
         org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:127)
         org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277)
    note The full stack trace of the root cause is available in the Apache Tomcat/6.0.14 logs.
    Apache Tomcat/6.0.14-Thanks and regards
    Praveen Soni

    Hey BalusC
    As i already obtain a new session object from sessionfactory,for one or more transactions at once(!),
    For reference see below code:
    package com.dao>hibenateUtil;
    import java.util.*;
    import com.ConsumerRecord;
    public class ConsumerDAOHibernate implements IConsumerDAO {
         public Long getNumberMatchingQuery(ConsumerRecord upr){
             String query = new String();
            String queryStart = "select count(*) FROM person in CLASS com.ConsumerRecord";
            query += queryStart;
            org.hibernate.Query q = HibernateUtil.getSession().createQuery(query);
            return (Long)q.uniqueResult();
        public Long getNumberMatchingCity(ConsumerRecord upr){
             String query = new String();
            String queryStart = "select count(*) FROM city in CLASS com.ConsumerRecord";
            query += queryStart;
            org.hibernate.Query q = HibernateUtil.getSession().createQuery(query);
            return (Long)q.uniqueResult();
    Hibernate Util:-package com.dao;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import org.apache.log4j.Logger;
    import org.hibernate.Session;
    import org.hibernate.SessionFactory;
    import org.hibernate.cfg.Configuration;
    public class HibernateUtil {
        private static final SessionFactory sessionFactory;
        private static Session  session = null;
        private static Logger logger = Logger.getLogger(HibernateUtil.class.getName());
        static {
            try {
                /** TODO: change to IOC w/ datasource */
                Configuration conf = new Configuration();
                sessionFactory = conf.configure().buildSessionFactory();
            } catch (Throwable ex) {
                // Make sure you log the exception, as it might be swallowed
                System.err.println("Initial SessionFactory creation failed." + ex);
                throw new ExceptionInInitializerError(ex);
        public static Session getSession() {
            if(session == null){
                try {
                    session = sessionFactory.openSession();   
                    logger.debug("****************************new session being created**************************************");
                               //sessionFactory.
                } catch (Throwable ex) {
                    // Make sure you log the exception, as it might be swallowed
                    System.err.println("Initial SessionFactory creation failed." + ex);
                    throw new ExceptionInInitializerError(ex);
            return session;
        }

  • Com.mysql.jdbc.MysqlDataTruncation: Data truncation

    Hi, i have these error
    com.mysql.jdbc.MysqlDataTruncation: Data truncation: Out of range value adjusted for column 'longtitude' at row 1
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2932)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1616)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1708)
    at com.mysql.jdbc.Connection.execSQL(Connection.java:3255)
    at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1293)
    at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1566)
    at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1480)
    at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1465)
    at dao.PlacemarkDAO.add(PlacemarkDAO.java:52)
    at web.AddPlacemarkServlet.processRequest(AddPlacemarkServlet.java:70)
    at web.AddPlacemarkServlet.doGet(AddPlacemarkServlet.java:86)
    in my database, i have declare longtitude as double(255,30) but i still dont know why got error data truncation? Can anyone please guide me?

    hmm, i have sloved the error already. I have make my longtitude double(40,20).

  • Java Connector via MySQL [ Cannot Connect ]

    I downloaded the MySql connector and extracted the connector and placed it at this directory,
    C:\Program Files\Java\jdk1.5.0_06\jre\lib\ext
    I also set the classpath as such by adding
    ClassPath = .;C:\Program Files\Java\jdk1.5.0_06\jre\lib\ext\mysql-connector-java-3.1.12-bin.jar.Actually , I followed the tutorial at
    http://www.stardeveloper.com/articles/display.html?article=2003090201&page=4.
    I then executed this program below.
    import java.sql.*;
    public class Connect {
      public static void main(String args[]) {
        Connection con = null;
        try {
         Class.forName("com.mysql.jdbc.Driver").newInstance();
         con = DriverManager.getConnection("jdbc:mysql:///enron", "root", "horizon");
          if(!con.isClosed())
            System.out.println("Successfully connected to MySQL server...");
        } catch(Exception e) {
          System.err.println("Captured Exception: " + e.getMessage());
        } finally {
          try {
            if(con != null)
              con.close();
          } catch(SQLException e) {}
    However i was unable to connect..This is wat happened as below..
    C:\>java Connect
    Captured Exception: Communications link failure due to underlying exception:
    ** BEGIN NESTED EXCEPTION **
    java.net.UnknownHostException
    MESSAGE: localhost: localhost
    STACKTRACE:
    java.net.UnknownHostException: localhost: localhost
            at java.net.InetAddress.getAllByName0(Unknown Source)
            at java.net.InetAddress.getAllByName0(Unknown Source)
            at java.net.InetAddress.getAllByName(Unknown Source)
            at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:137)
            at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:284)
            at com.mysql.jdbc.Connection.createNewIO(Connection.java:2555)
            at com.mysql.jdbc.Connection.<init>(Connection.java:1485)
            at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
            at java.sql.DriverManager.getConnection(Unknown Source)
            at java.sql.DriverManager.getConnection(Unknown Source)
            at Connect.main(Connect.java:7)
    ** END NESTED EXCEPTION **
    Last packet sent to the server was 31 ms ago.
    Any Help watsoever is greatly appreciated.
    Thanks in advance.
    Cheers.

    Hi thanks for the reply.
    Although , I am though a bit baffled by your reply.
    Where is it that you want me to add the URL.Not add the URL - change the one you have. Read the docs for the connector and follow that.
    And where else should i place that jar file.I put it in my CLASSPATH, close to where the source for my project is. (That means not in one place, but several places. I duplicate the JAR file for every app that needs it.)
    Cos I follow the tutorial at...
    http://www.stardeveloper.com/articles/display.html?art
    icle=2003090201&page=4.
    Unless You are saying that the above site is wrong..
    If thats the case, can you point out another
    alternative site which can guide me along .No time to read that site, nor do I have the interest.
    The Sun Java tutorial is sufficient for using JDBC. As far as how you package and deploy apps, that's another matter. You should be using the class name and URL that your JDBC driver docs suggest.
    %

  • Cronjob: ssh connection fails

    Hi Forums,
    I have a bash script which does some tasks on a remote server via ssh. The connection uses a private/public key without a passphrase as this seems to be the only way to connect via ssh in a cronjob. If I execute the script manually, then it works and connects to the remote server. If the script is run as cronjob, then it doesn't work and this error message appears in the crond log:
    CMDOUT (ssh: Could not resolve hostname ###HOSTSNAME###: Name or service not known)
    The network connection is set up manually (not by DHCP) in the rc.conf and a nameserver entry in the resolv.conf. Could this be the reason or why else could the connection fail when executed as a cronjob?
    Last edited by clownfish (2012-06-27 16:42:12)

    Cron doesn't use your existing shell environment unless you tell it to.
    You should use something like keychain, ssh-agent, or gpg-agent. This allows you to maintain the security of having a passphrase while allowing you to source those keys for use in scripts and cronjobs. That way you just type in the passphrase once (at boot time, or another time of your choosing).
    I use this snippet in .bashrc to ask to for passphrases if they aren't already cached:
    ### SSH and GPG KEY HANDLING ###
    keys="logo_rsa web_rsa github_rsa"
    if [ "$(hostname)" != 'homeserver' ];then
    keys="$keys id_rsa"
    fi
    type -P keychain &>/dev/null || { echo "I require keychain but it's not installed. Aborting." >&2; }
    eval $(keychain -q --eval $(echo "$keys"))
    Then to use in a cronjob or script, source the keys much the same way:
    # Source SSH keys
    type -P keychain &>/dev/null || { echo "I require keychain but it's not installed. Aborting." >&2; exit 1; }
    eval `keychain --noask --eval --agents ssh id_rsa` || exit 1
    You can do this same thing with just ssh-agent or gpg-agent --- just takes a few more lines of code. Some googling and man page reading will lead you in the right direction
    Scott
    Last edited by firecat53 (2012-06-27 15:36:04)

  • Mysql not connecting

    Hi all
    I have downloaded the J connector, both 5.0.8 and 5.1.13 but they both gives me problems.
    if i try:
    private static String url="jdbc:mysql://localhost:3306/mydb;create=true"; private static Connection conn=null; private Statement stm=null; public static void main(String[] args){ createConnection(); } private static void createConnection(){ try{ Class.forName("com.mysql.jdbc.Driver").newInstance(); //connect conn=DriverManager.getConnection(url); System.out.println("Connected!"); } catch(Exception except){ except.printStackTrace(); } }
    i get the following:
    com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:
    ** BEGIN NESTED EXCEPTION **
    java.net.ConnectException
    MESSAGE: Connection refused
    STACKTRACE:
    java.net.ConnectException: Connection refused
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:433)
    at java.net.Socket.connect(Socket.java:529)
    at java.net.Socket.connect(Socket.java:477)
    at java.net.Socket.<init>(Socket.java:374)
    at java.net.Socket.<init>(Socket.java:216)
    at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:256)
    at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:271)
    at com.mysql.jdbc.Connection.createNewIO(Connection.java:2771)
    at com.mysql.jdbc.Connection.<init>(Connection.java:1555)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
    at java.sql.DriverManager.getConnection(DriverManager.java:525)
    at java.sql.DriverManager.getConnection(DriverManager.java:193)
    at conn.Conn.createConnection(Conn.java:28)
    at conn.Conn.main(Conn.java:18)

         private static String url="jdbc:mysql://localhost:3306/mydb;create=true";
    java.net.ConnectException
    MESSAGE: Connection refusedMySQL is not running in 'localhost' on port 3306.

  • How to fix jdbc connection when  SQLstate 08S01

    I have an application that connects to and insert into a remote database which runs on a server I connect to over the internet. I tested it on local server (localhost) and it works fine, but when I put my server IP (72.52.155.111) or web domain I can' t connect. I'm not sure what should I write instead localhost: webdomain or something else ?
    Java code...
    conn =   DriverManager.getConnection("jdbc:mysql://72.52.155.111:3306/fritaor_apartmani" ,"fritaor_root","10000000");
    ...Error code:
    SQLException: Communications link failure due to underlying exception:
    ** BEGIN NESTED EXCEPTION **
    java.net.SocketException
    MESSAGE: java.net.ConnectException: Connection timed out: connect
    STACKTRACE:
    java.net.SocketException: java.net.ConnectException: Connection timed out: conne
    ct
            at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.ja
    va:156)
            at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:276)
            at com.mysql.jdbc.Connection.createNewIO(Connection.java:2666)
            at com.mysql.jdbc.Connection.<init>(Connection.java:1531)
            at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java
    :266)
            at java.sql.DriverManager.getConnection(Unknown Source)
            at java.sql.DriverManager.getConnection(Unknown Source)
            at Mysql.save(Mysql.java:57)
            at Contact.run(Contact.java:299)
            at Testing.main(Testing.java:21)
    ** END NESTED EXCEPTION **
    Last packet sent to the server was 47 ms ago.
    SQLState: 08S01
    VendorError: 0

    Try to connect to the server in another way (such as telnet). See if you can connect to port 3306. If not, the port is blocked or there's nobody listening (is there a mysql server running on the host?).

Maybe you are looking for