Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    java.lang.ClassNotFoundException: net.sourceforge.jtds.jdbc.Driver

    Hi All,

    I am trying to connect my smartgwt application to MsSql server 2012 using jtds driver.

    I have downloaded jtds-1.3.1.jar and added it to my application build path (I am using Eclipse Neon.1a Release (4.6.1))

    I am trying to initiate the connection as follows:

    Code:
          try
            {
                Class.forName(DB_CONNECTION_DRIVER);
            }
            catch (ClassNotFoundException e)
            {
                errorFlag = true;
                catchEvent = e.toString();
            }
            catch (java.lang.Exception __e)
            {
                errorFlag = true;
                catchEvent = __e.toString();
            }
    where DB_CONNECTION_DRIVER = ""net.sourceforge.jtds.jdbc.Driver"

    However, this is always generating java.lang.ClassNotFoundException: net.sourceforge.jtds.jdbc.Driver

    Appreciate your help.

    Shady

    #2
    Hi shady.hanna,

    are you using SmartGWT with a server component (Pro, Power, EE, EE Eval) or without (LGPL)?
    In the former case, DB connect configuration is done in the server.properties file.
    In the latter case, it is just a Java Servlet accessing MSSQL and your question will most likely be answered faster in Stack Overflow.

    Besides of this suggestion, I can't help either.

    Best regards
    Blama

    Comment


      #3
      Hi Blama,

      Thanks for your prompt answer. I am using SmartGwt and trying to connect to MsSql database from a servlet defined in my xml file.

      Is there anything I should do other than adding jtds jar file to my classpath?

      Any idea why it is not able to locate the Driver class in my jar file?

      Thanks again.

      Comment


        #4
        Hi shady.hanna,

        I don't see what you are using from your answer - Which servlet are you hitting? An own one or one subclassing e.g. IDACall?
        If an own one (which would mean using SmartGWT LGPL), then this is a question for the SO forum, not this one.

        Also make sure to read the Quick Start Guide, as it discusses the possible backend options in detail.

        Besides of that I'm using Oracle and Tomcat as web server. Here I have to copy the JDBC driver jar to my server (either C:\Program Files\Apache Software Foundation\apache-tomcat-8.0.30\lib if you run one or more webapps accessing the DB) or C:\Program Files\Apache Software Foundation\apache-tomcat-8.0.30\webapps\myapp\WEB-INF\lib (if you run only one webapp accessing the DB).

        Something similar will apply to MSSQL or a different application server.

        Best regards
        Blama

        Comment


          #5
          Hi Blama,

          Thanks for the help. I have finally managed to fix the issue by adding the jar file to WEB-INF\lib as you suggested.

          I am able to successfully RPC call the server with a successful response.

          However, the issue now is when executing the statement:

          Code:
          connection = DriverManager.getConnection(dbConnectionURL,username, password);
          SEVERE: javax.servlet.ServletContext log: Exception while dispatching incoming RPC call
          com.google.gwt.user.client.rpc.SerializationException: Type 'java.security.AccessControlException' was not included in the set of types which can be serialized by this SerializationPolicy or its Class object could not be loaded. For security purposes, this type will not be serialized.: instance = java.security.AccessControlException: access denied ("java.io.FilePermission" "C:\Users\Shady\AppData\Local\Temp" "read")
          at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serialize(ServerSerializationStreamWriter.java:667)
          at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:130)
          at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter$ValueWriter$8.write(ServerSerializationStreamWriter.java:153)
          at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeValue(ServerSerializationStreamWriter.java:587)


          Based on some online research, to fix this issue I have to add an empty contructor to my client Java class and it has to implement Serializable.

          Tried both options, neither worked.

          Appreciate your support.

          Comment


            #6
            Hi,

            sorry, I can't help here as I use the SmartGWT server component.
            This sounds more like a general GWT RPC problem. I know that this is technique is mentioned in the Quick Start Guide. Besides of this I suspect that SO will be the better place to ask in this case.

            Best regards
            Blama

            Comment


              #7
              Thanks Blama

              The problem was finally fixed by disabling Google App Engine from Eclipse!

              Comment

              Working...
              X