Manifest.MF issue with MSSQLSERVER 2008 and Groovy

2019-03-05 19:18发布

问题:

I have created a simple Groovy project in GGTS IDE that connects to Oracle and SQLServer. The Program runs fine within the IDE but when I run the program through the command line I seem to get some sort of enconding error in MANIFEST.MF?. See the stacktrace below:

Command Line

groovy -cp lib\ojdbc14_g.jar lib\sqljdbc4.jar src\Starter.groovy

Result

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
C:\workspace-ggts-3.1.0.RELEASE\Test\lib\sqljdbc4.jar: 1: unexpected char: 0x3 @ line 1, column 3.
   PK♥ h?I@            ¶   META-INF/MANIFEST.MF¡|GôΓ┌▓εⁿD∞ ░=x/êsä      8◄o ï∟B▲
ë╔
     ^

1 error

In the past to connect to MSSQLServer I have used the following jars:

  • msbase.jar
  • msutil.jar
  • mssqlserver.jar

This time though, when I looked for jdbc jars for 2008 I got the sqljdbc4.jar. Again it works from within the IDE but not from command line. I have singled out the problem to be in the sqljdbc4.jar because I commented all the code related to that and the program ran fine with just the oracle jar references.

  1. Anybody know why this is happening?
  2. What jars are you using to connect to sqlserver 2008 from the command line with groovy?

Thanks.

回答1:

You need semi-colons between classpath entries (assuming you are on Windows)

groovy -cp lib\ojdbc14_g.jar;lib\sqljdbc4.jar src\Starter.groovy

Or colons if you're on Linux/Mac

groovy -cp lib/ojdbc14_g.jar:lib/sqljdbc4.jar src/Starter.groovy