Results 1 to 6 of 6
  1. #1
    abhi140 is offline Member
    Join Date
    Jul 2014
    Posts
    3
    Rep Power
    0

    Default Error in connection while uploading the war to server

    Hi,

    I am inserting and validating the data using jdbc connection . It is working fine when i am running it on local server . But when i uploaded the war in server it is giving following exception


    com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientC onnectionException: No operations allowed after connection closed.

  2. #2
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    5,114
    Rep Power
    12

    Default Re: Error in connection while uploading the war to server

    Yes, so in your remote server apparently the database behaves differently. With this little information and this little personal investigation from you, I can only make a wild guess that the DBMS is configured to close inactive threads and your application is not built to cope with that.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  3. #3
    abhi140 is offline Member
    Join Date
    Jul 2014
    Posts
    3
    Rep Power
    0

    Default Re: Error in connection while uploading the war to server

    Quote Originally Posted by gimbal2 View Post
    Yes, so in your remote server apparently the database behaves differently. With this little information and this little personal investigation from you, I can only make a wild guess that the DBMS is configured to close inactive threads and your application is not built to cope with that.
    Thanks for your reply ,

    Actually i am using connection pooling for this and the code and with context.xml file is below.


    <?xml version="1.0" encoding="UTF-8"?>
    <Context reloadable="true">
    <Resource auth="Container"
    name="jdbc/mysql"
    type="javax.sql.DataSource"
    driverClassName="com.mysql.jdbc.Driver"
    url="jdbc:mysql://198.15.112.181:3306/db"
    username=""
    password=""
    maxIdle="10"
    maxActive="200"
    maxWait="5"
    removeAbandoned="true"
    removeAbandonedTimeout="1200"
    />
    </Context>






    try {

    Context ctx = (Context) new InitialContext().lookup("java:comp/env");
    connection = ((DataSource) ctx.lookup("jdbc/mysql")).getConnection();


    }
    catch (NamingException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }


    java.sql.Statement st = connection.createStatement();
    ResultSet rs = st.executeQuery(valide);

    String uname = pb.getUsername();
    String password = pb.getPassword();

    while (rs.next())
    {
    String a = rs.getString(1);
    String b = rs.getString(2);
    if(uname.equalsIgnoreCase(a) && password.equalsIgnoreCase(b))
    {
    rs.close();
    st.close();
    st = null;
    connection.close();
    connection = null;
    return true ;
    }








    its showing exception like --



    WARNING: An attempt was made to authenticate the locked user "admin"
    com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientC onnectionException: No operations allowed after connection closed.

  4. #4
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    5,114
    Rep Power
    12

    Default Re: Error in connection while uploading the war to server

    that warning message looks like a pretty good hint as to what is wrong.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  5. #5
    abhi140 is offline Member
    Join Date
    Jul 2014
    Posts
    3
    Rep Power
    0

    Default Re: Error in connection while uploading the war to server

    When i am running it on local server its working fine but after uploading the war to server if i will try to access the database it is showing me this exception massage.


    WARNING: An attempt was made to authenticate the locked user "admin"
    com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientC onnectionException: No operations allowed after connection closed.
    at sun.reflect.NativeConstructorAccessorImpl.newInsta nce0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInsta nce(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newI nstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Construc tor.java:526)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:41 1)
    at com.mysql.jdbc.Util.getInstance(Util.java:386)
    at com.mysql.jdbc.SQLError.createSQLException(SQLErro r.java:1014)
    at com.mysql.jdbc.SQLError.createSQLException(SQLErro r.java:988)
    at com.mysql.jdbc.SQLError.createSQLException(SQLErro r.java:974)
    at com.mysql.jdbc.SQLError.createSQLException(SQLErro r.java:919)
    at com.mysql.jdbc.ConnectionImpl.throwConnectionClose dException(ConnectionImpl.java:1290)
    at com.mysql.jdbc.ConnectionImpl.checkClosed(Connecti onImpl.java:1282)
    at com.mysql.jdbc.ConnectionImpl.createStatement(Conn ectionImpl.java:2653)
    at com.mysql.jdbc.ConnectionImpl.createStatement(Conn ectionImpl.java:2635)
    at com.SangamOne.ApnaKhata.dao.LoginDao1.validateAdmi nLoginId(LoginDao1.java:43)
    at com.SangamOne.ApnaKhata.Controller.Login01ServletC ontroller.doPost(Login01ServletController.java:93)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:647)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:728)
    at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.do Filter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:222)
    at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:123)

  6. #6
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    5,114
    Rep Power
    12

    Default Re: Error in connection while uploading the war to server

    Repeating the same information over and over again is not going to get you any further. Do some investigation yourself, that's a huge part of your job. Here is a tip: Google parts of the error you are getting. you are not the first one to run into this. But what you want to do is strip off anything that is specific to you; so google this:

    "mysql WARNING: An attempt was made to authenticate the locked user"

    Notice how I add the word "mysql" first; that helps Google to narrow the search results. Probably the error is specific to Mysql enough that it is not necessary, but it is a good rule of thumb to follow.

    When I google that I get plenty of results. This one seems particularly interesting for example:

    mysql - org.apache.catalina.realm.LockOutRealm authenticate WARNING: An attempt was made to authenticate the locked user "tomcat" - Stack Overflow
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. Uploading files(upto 30MB..mayb more ) to server
    By NerdyGal in forum Networking
    Replies: 2
    Last Post: 03-20-2013, 01:38 PM
  2. Uploading File to server ( Apache.commons.net)
    By quirell in forum Networking
    Replies: 0
    Last Post: 01-14-2012, 11:19 AM
  3. Problems with uploading war file to server
    By niveksalim in forum Eclipse
    Replies: 0
    Last Post: 08-04-2011, 12:44 PM
  4. Uploading files to server via HTTP
    By dan0 in forum New To Java
    Replies: 2
    Last Post: 03-13-2009, 06:27 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •