Skip to content
Advertisement

Getting compile failure for maven build.. package COM.ibm.db2.jdbc.app does not exist

I am getting maven compile error package COM.ibm.db2.jdbc.app does not exist when I am trying to build my maven project with db2 jars and zips.

The code compiles for db2 jars/zip in RAD.

My nexus reposistory has the following files and dependencies defined and I am able to use them in my pom as well.

<dependency>
  <groupId>com.ibm.db2</groupId>
  <artifactId>db2jcc4</artifactId>
  <version>9.5.7</version>
</dependency> 
<dependency>
 <groupId>com.ibm.db2</groupId>
 <artifactId>db2jcc_license_cu</artifactId>
 <version>9.5.7</version>
</dependency>
<dependency>
 <groupId>com.ibm.db2</groupId>
 <artifactId>db2java</artifactId>
 <version>9.5.7</version>
 <type>zip</type>
<scope>compile</scope>
</dependency>

This is the source code which uses this ..

private boolean executeConnectionPackage(Connection spConnection, String csSpDbPackage)
{
    try
    {
        COM.ibm.db2.jdbc.app.DB2Connection Db2connection = null;// (COM.ibm.db2.jdbc.app.DB2Connection)spConnection;
        Db2connection.setConnectOption(1276, csSpDbPackage); // SQL_ATTR_CURRENT_PACKAGE_SET
        Log.logNormal("Change Package:" + csSpDbPackage);
    }
    catch (Exception ex)
    {
        Log.logNormal("Problem with change Package:" + csSpDbPackage + " ex:" + ex.getMessage());
        return false;
    }
    return true;
}

UPDATE for MAVEN EXCEPTION

    [INFO] -------------------------------------------------------------
    [ERROR] COMPILATION ERROR : 
    [INFO] -------------------------------------------------------------
    [ERROR] /C:/Development/eclipse//workspace/ExecuteCRuntime/src/spServer/StoredProcedure.java:[31,1] package COM.ibm.db2.jdbc.app does not exist
    [ERROR] /C:/Development/eclipse//workspace/ExecuteCRuntime/src/spServer/StoredProcedure.java:[181,45] package COM.ibm.db2.jdbc.app does not exist
    [INFO] 2 errors 
    [INFO] -------------------------------------------------------------
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project ExecuteCRuntime: Compilation failure: Compilation failure:

UPDATE running maven with -e

[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project ExecuteCRuntime: Compilation failure
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.compiler.CompilationFailureException: Compilation failure
    at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:911)
    at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
    ... 20 more

My pom Dependency for DB2 Jars/zip file . This is defined in globally accesible company wide nexus repo

    <dependency>
  <groupId>com.ibm.db2</groupId>
  <artifactId>db2jcc4</artifactId>
  <version>9.5.7</version>
</dependency> 
<dependency>
 <groupId>com.ibm.db2</groupId>
 <artifactId>db2jcc_license_cu</artifactId>
 <version>9.5.7</version>
</dependency>
<dependency>
 <groupId>com.ibm.db2</groupId>
 <artifactId>db2java</artifactId>
 <version>9.5.7</version>
 <type>zip</type>
<scope>compile</scope>
</dependency>

Here is the FULL Pom

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>ExecuteCRuntime</groupId>
  <artifactId>ExecuteCRuntime</artifactId>
  <version>0.0.1-SNAPSHOT</version>

  <dependencies>

  <!-- https://mvnrepository.com/artifact/log4j/log4j -->
<dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>1.2.17</version>
</dependency>
  <!-- https://mvnrepository.com/artifact/ant/ant -->
  <!-- 
<dependency>
    <groupId>ant</groupId>
    <artifactId>ant</artifactId>
    <version>1.7.0</version>
</dependency>
 -->
   <!-- https://mvnrepository.com/artifact/commons-codec/commons-codec -->
<dependency>
    <groupId>commons-codec</groupId>
    <artifactId>commons-codec</artifactId>
    <version>1.10</version>
</dependency>
  <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-io -->
<dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-io</artifactId>
    <version>1.3.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-logging/commons-logging -->
<dependency>
    <groupId>commons-logging</groupId>
    <artifactId>commons-logging</artifactId>
    <version>1.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-net/commons-net -->
<dependency>
    <groupId>commons-net</groupId>
    <artifactId>commons-net</artifactId>
    <version>1.4.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.sleepycat/je -->
<!-- https://mvnrepository.com/artifact/com.sleepycat/je -->
<dependency>
  <groupId>com.projectdarkstar.ext.berkeleydb</groupId>
  <artifactId>je</artifactId>
  <version>3.2.23</version>
</dependency>

<!-- https://mvnrepository.com/artifact/com.sun.media/jai_codec -->


<dependency>
  <groupId>com.ibm.db2</groupId>
  <artifactId>db2jcc4</artifactId>
  <version>9.5.7</version>
</dependency> 
        <dependency>
            <groupId>com.ibm.db2</groupId>
            <artifactId>db2jcc_license_cu</artifactId>
            <version>9.5.7</version>
        </dependency>
        <dependency>
            <groupId>com.ibm.db2</groupId>
            <artifactId>db2java</artifactId>
            <version>9.5.7</version>
            <type>zip</type>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>javax.activation</groupId>
            <artifactId>activation</artifactId>
            <version>1.1.1</version>
        </dependency>
  <!-- https://mvnrepository.com/artifact/junit/junit -->
<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.12</version>
</dependency>
  <!-- https://mvnrepository.com/artifact/xml-apis/xml-apis -->
<dependency>
    <groupId>xml-apis</groupId>
    <artifactId>xml-apis</artifactId>
    <version>2.0.2</version>
</dependency>
 <!-- https://mvnrepository.com/artifact/xalan/serializer -->
<dependency>
    <groupId>xalan</groupId>
    <artifactId>serializer</artifactId>
    <version>2.7.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <version>3.1.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.mail/javax.mail-api -->
<dependency>
    <groupId>javax.mail</groupId>
    <artifactId>javax.mail-api</artifactId>
    <version>1.5.5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/xerces/xercesImpl -->
<dependency>
    <groupId>xerces</groupId>
    <artifactId>xercesImpl</artifactId>
    <version>2.8.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.oracle/ojdbc14 -->
<dependency>
  <groupId>com.oracle</groupId>
  <artifactId>ojdbc</artifactId>
  <version>1.4</version>
</dependency>

  </dependencies>
  <build>
    <sourceDirectory>src</sourceDirectory>
    <resources>
      <resource>
        <directory>src</directory>
        <excludes>
          <exclude>**/*.java</exclude>
        </excludes>
      </resource>
    </resources>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.3</version>

        <configuration>
        <!-- <compilerArgument>-XDignore.symbol.file</compilerArgument> -->
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
    </plugins>

  </build>
</project>

Can anyone please help me and let me know what I am missing here.

Thanks Dhiren

Advertisement

Answer

The app driver (COM.ibm.db2.jdbc.app) has long been deprecated; it requires the native DB2 CLI driver to be installed. You should be using the JCC driver (com.ibm.db2.jcc). More info in the manual.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement