maven - Connecting to db2 from java client -


i trying connect db2 java client running application jar. jar super-jar dependencies generated shade plugin.

when run program ide(netbeans) runs fine, when run commandline fails: java -jar target/locationimporter.jar

the exception is:

exception in thread "main" java.lang.nullpointerexception     @ com.ibm.as400.access.portmapper.getserversocket(portmapper.java:216)     @ com.ibm.as400.access.as400implremote.signonconnect(as400implremote.java:2363)     @ com.ibm.as400.access.as400implremote.signon(as400implremote.java:2278)     @ com.ibm.as400.access.as400.sendsignonrequest(as400.java:3142)     @ com.ibm.as400.access.as400.promptsignon(as400.java:2706)     @ com.ibm.as400.access.as400.signon(as400.java:4035)     @ com.ibm.as400.access.as400.connectservice(as400.java:1184)     @ com.ibm.as400.access.as400jdbcconnection.setproperties(as400jdbcconnection.java:3338)     @ com.ibm.as400.access.as400jdbcdriver.prepareconnection(as400jdbcdriver.java:1419)     @ com.ibm.as400.access.as400jdbcdriver.initializeconnection(as400jdbcdriver.java:1256)     @ com.ibm.as400.access.as400jdbcdriver.connect(as400jdbcdriver.java:395)     @ java.sql.drivermanager.getconnection(unknown source)     @ java.sql.drivermanager.getconnection(unknown source)     @ dataprep.connectionsupplier.getconnection(connectionsupplier.java:18)     @ dataprep.sqlfilerunner.runscript(sqlfilerunner.java:65)     @ dataprep.sqlfilerunner.runsqlfile(sqlfilerunner.java:26)     @ dataprep.preparedatabase.main(preparedatabase.java:26) 

the code fails is:

class.forname("com.ibm.as400.access.as400jdbcdriver").newinstance(); return drivermanager.getconnection(jdbc_url, jdbc_user, jdbc_password); 

since runs in ide, know url, user , password correct.

my shade plugin configured in pom:

<plugin>     <groupid>org.apache.maven.plugins</groupid>     <artifactid>maven-shade-plugin</artifactid>     <version>2.3</version>     <configuration>         <shadedartifactattached>true</shadedartifactattached>         <shadedclassifiername>launcher</shadedclassifiername>          <finalname>locationimporter</finalname>         <createdependencyreducedpom>false</createdependencyreducedpom>         <minimizejar>true</minimizejar>     </configuration>     <executions>         <execution>             <phase>package</phase>             <goals>                 <goal>shade</goal>             </goals>         </execution>     </executions> </plugin> 

after hours of debugging colleague of mine pointed me in right direction. removing minimizejar fixes problem since shade plugin removed file "socketcontainerinet" since not directly instantiated via string-value..


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -