1 Reply Latest reply on Jun 18, 2014 10:10 AM by van.halbert

    SimpleClient Dependencies broken?

    neerajapte

      I pulled the latest (300918e32755955e04ce8dcb8f2552102e36476a) from github, got everything to build successfully and was trying to run the simpleclient as per the readme (see below). I kept getting ClassNotFoundException for the jdbc drvier (highlighted below).

      After some investigation, I realized that the dependencies were not in the runtime classpath as their scope was "provided".

      Everything works fine after I remove the "<scope>provided</scope>" under project dependencies (see diff at the end of the message below).

      Clearly, the jdbc driver must be specified as a runtime dependency. Am I missing something wrong here? Or is the pom.xml broken?

       

      -------------

      simpleclient> mvn clean install -Dvdb="webservice" -Dsql="select * from CustomersView"

      [INFO] Scanning for projects...

      [INFO]

      [INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1

      [INFO]

      [INFO] ------------------------------------------------------------------------

      [INFO] Building SimpleClient 2.0.0

      [INFO] ------------------------------------------------------------------------

      [INFO]

      [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ simpleclient ---

      [INFO] Deleting /Users/foo/code/foobar/teiid-quickstarts/simpleclient/target

      [INFO]

      [INFO] --- maven-enforcer-plugin:1.3.1:enforce (enforce-java-version) @ simpleclient ---

      [INFO]

      [INFO] --- maven-enforcer-plugin:1.3.1:enforce (enforce-maven-version) @ simpleclient ---

      [INFO]

      [INFO] --- maven-enforcer-plugin:1.3.1:enforce (enforce-plugin-versions) @ simpleclient ---

      [INFO]

      [INFO] --- maven-enforcer-plugin:1.3.1:enforce (no-managed-deps) @ simpleclient ---

      [INFO]

      [INFO] --- buildnumber-maven-plugin:1.2:create-timestamp (get-build-timestamp) @ simpleclient ---

      [INFO]

      [INFO] --- buildnumber-maven-plugin:1.2:create (get-scm-revision) @ simpleclient ---

      [INFO] Checking for local modifications: skipped.

      [INFO] Updating project files from SCM: skipped.

      [INFO] Executing: /bin/sh -c cd /Users/foo/code/foobar/teiid-quickstarts/simpleclient && git rev-parse --verify HEAD

      [INFO] Working directory: /Users/foo/code/foobar/teiid-quickstarts/simpleclient

      [INFO] Storing buildNumber: 300918e32755955e04ce8dcb8f2552102e36476a at timestamp: 1403065744942

      [INFO] Executing: /bin/sh -c cd /Users/foo/code/foobar/teiid-quickstarts/simpleclient && git rev-parse --verify HEAD

      [INFO] Working directory: /Users/foo/code/foobar/teiid-quickstarts/simpleclient

      [INFO] Storing buildScmBranch: UNKNOWN

      [INFO]

      [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ simpleclient ---

      [INFO] Using 'UTF-8' encoding to copy filtered resources.

      [INFO] skip non existing resourceDirectory /Users/foo/code/foobar/teiid-quickstarts/simpleclient/src/main/resources

      [INFO]

      [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ simpleclient ---

      [INFO] Changes detected - recompiling the module!

      [INFO] Compiling 1 source file to /Users/foo/code/foobar/teiid-quickstarts/simpleclient/target/classes

      [INFO]

      [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ simpleclient ---

      [INFO] Using 'UTF-8' encoding to copy filtered resources.

      [INFO] skip non existing resourceDirectory /Users/foo/code/foobar/teiid-quickstarts/simpleclient/src/test/resources

      [INFO]

      [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ simpleclient ---

      [INFO] No sources to compile

      [INFO]

      [INFO] --- maven-surefire-plugin:2.14.1:test (default-test) @ simpleclient ---

      [INFO] No tests to run.

      [INFO]

      [INFO] >>> exec-maven-plugin:1.2.1:java (default) @ simpleclient >>>

      [INFO]

      [INFO] --- maven-enforcer-plugin:1.3.1:enforce (enforce-java-version) @ simpleclient ---

      [INFO]

      [INFO] --- maven-enforcer-plugin:1.3.1:enforce (enforce-maven-version) @ simpleclient ---

      [INFO]

      [INFO] --- maven-enforcer-plugin:1.3.1:enforce (enforce-plugin-versions) @ simpleclient ---

      [INFO]

      [INFO] <<< exec-maven-plugin:1.2.1:java (default) @ simpleclient <<<

      [INFO]

      [INFO] --- exec-maven-plugin:1.2.1:java (default) @ simpleclient ---

      Executing using the TeiidDriver

      -----------------------------------

      ClassPath:

      /Users/foo/code/foobar/teiid-quickstarts/simpleclient/target/classes/

      -----------------------------------

      [WARNING]

      java.lang.reflect.InvocationTargetException

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:606)

        at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297)

        at java.lang.Thread.run(Thread.java:745)

      Caused by: java.lang.ClassNotFoundException: org.teiid.jdbc.TeiidDriver

        at java.net.URLClassLoader$1.run(URLClassLoader.java:366)

        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)

        at java.security.AccessController.doPrivileged(Native Method)

        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)

        at java.lang.Class.forName0(Native Method)

        at java.lang.Class.forName(Class.java:190)

        at JDBCClient.getDriverConnection(JDBCClient.java:72)

        at JDBCClient.main(JDBCClient.java:51)

        ... 6 more

      [INFO] ------------------------------------------------------------------------

      [INFO] BUILD FAILURE

      [INFO] ------------------------------------------------------------------------

      [INFO] Total time: 3.239 s

      [INFO] Finished at: 2014-06-18T09:59:06+05:30

      [INFO] Final Memory: 20M/228M

      [INFO] ------------------------------------------------------------------------

      [ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default) on project simpleclient: An exception occured while executing the Java class. null: InvocationTargetException: org.teiid.jdbc.TeiidDriver -> [Help 1]

      [ERROR]

      [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.

      [ERROR] Re-run Maven using the -X switch to enable full debug logging.

      [ERROR]

      [ERROR] For more information about the errors and possible solutions, please read the following articles:

      [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

      -------------------

       

       

      diff --git a/simpleclient/pom.xml b/simpleclient/pom.xml

      index 38f1074..817a977 100644

      --- a/simpleclient/pom.xml

      +++ b/simpleclient/pom.xml

      @@ -17,18 +17,15 @@

                      <dependency>

                   <groupId>org.jboss.teiid</groupId>

                   <artifactId>teiid</artifactId>

      -            <scope>provided</scope>

                   <classifier>jdbc</classifier>

                      </dependency>

                      <dependency>

                   <groupId>org.jboss.teiid</groupId>

                   <artifactId>teiid-common-core</artifactId>

      -            <scope>provided</scope>

                      </dependency>

                      <dependency>

                   <groupId>org.jboss.teiid</groupId>

                   <artifactId>teiid-client</artifactId>

      -            <scope>provided</scope>

                      </dependency>

              </dependencies>