2016-08-15 177 views
0

我正在收到maven編譯錯誤包COM.ibm.db2.jdbc.app不存在,當我試圖建立我的maven項目與db2罐和拉鍊。獲取編譯失敗的maven構建..包COM.ibm.db2.jdbc.app不存在

代碼編譯爲RAD中的db2 jars/zip。

我的nexus reposistory定義了以下文件和依賴項,我也可以在我的pom中使用它們。

<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> 

這是使用這種源代碼..

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; 
} 

更新MAVEN例外

[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運行行家與-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 

我的pom DB2 Jars/zip文件的依賴關係。這是在全球範圍內入店公司範圍內的關係定義回購

<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> 

這裏是整個雙龍

<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> 

任何人都可以請幫助我,讓我知道我在這裏失蹤。

由於 Dhiren

+0

請發佈異常堆棧跟蹤。 – 11thdimension

+0

沒有異常堆棧跟蹤這是來自maven的編譯錯誤。 – user2358826

+0

@ user2358826使用'-e'鍵運行maven – vsminkov

回答

2

應用驅動器(COM.ibm.db2.jdbc.app)長期以來被棄用;它需要安裝本地DB2 CLI驅動程序。您應該使用JCC驅動程序(com.ibm.db2.jcc)。 More info in the manual

+0

這是否意味着我應該更改它使用COM.ibm.db2.jdbc的代碼。應用程序。這與RAD工作,但不編譯與Maven構建?爲什麼它甚至找不到db2java.zip。它應該在構建期間由maven拉入 – user2358826

0

我更改了代碼來處理應用程序驅動程序。 Class dbs = Class.forName(「COM.ibm.db2.jdbc.app.DB2Connection」); 方法m = dbs.getDeclaredMethod(「setConnectOption」,Integer.TYPE,String.class);