初始化EncryptionManager时出现java.security.InvalidAlgorithmParameterException

时间:2012-05-18 08:08:13

标签: java jdbc db2

DB2的身份验证类型为SERVER_ENCRYPT,但是当我尝试连接时:

Properties properties = new Properties();
properties.setProperty("securityMechanism",
Integer.toString(DB2BaseDataSource.ENCRYPTED_USER_AND_PASSWORD_SECURITY));  
properties.setProperty("user", userDRS);
properties.setProperty("password", passwordDRS);
connDRS =DriverManager.getConnection(urlDRS, properties);

我获得了

  

[ERROR] resources.DB2Util'com.ibm.db2.jcc.b.SqlException:   [jcc] [1071] [10611] [3.50.152]抓到了   初始化时java.security.InvalidAlgorithmParameterException   EncryptionManager。有关详细信息,请参阅附件Throwable。   ERRORCODE = -4223,SQLSTATE = null'


  

引起:java.security.InvalidAlgorithmParameterException:Prime   size必须是64的倍数,并且只能在512到1024之间   (包括)在   com.sun.crypto.provider.DHKeyPairGenerator.initialize(DHKeyPairGenera   tor.java:120)at   java.security.KeyPairGenerator $ Delegate.initialize(未知来源)at   java.security.KeyPairGenerator.initialize(未知来源)at   com.ibm.db2.jcc.b.ic.(ic.java:75)... 57 more

这个代码是从bat文件运行的问题,但是如果我从studio(合理的功能测试器)运行代码 - 一切都很好,我得到了一个连接。 Bat文件是:

@ECHO OFF
:start
:save_args_as_variables
set RFT_PROJECT_LOCATION="D:\RFTworkspace\PROD\IPPF\DataTransferRobo"
set RFT_SCRIPT_NAME="Main.Main"
set RFT_LOGFILE_NAME="test"
goto check_args
:check_args
if "%RFT_PROJECT_LOCATION%" == "" goto missing_args
if "%RFT_SCRIPT_NAME%" == "" goto missing_args
if "%RFT_LOGFILE_NAME%" == "" goto missing_args
goto args_ok
:args_ok
if "%4" == "silent" goto playback
echo.
echo RFT_PROJECT_LOCATION = %RFT_PROJECT_LOCATION%
echo RFT_SCRIPT_NAME = %RFT_SCRIPT_NAME%
echo RFT_LOGFILE_NAME = %RFT_LOGFILE_NAME%
echo IBM_RATIONAL_RFT_ECLIPSE_DIR = %IBM_RATIONAL_RFT_ECLIPSE_DIR%
echo IBM_RATIONAL_RFT_INSTALL_DIR = %IBM_RATIONAL_RFT_INSTALL_DIR%
echo.
echo Initializing RFT Playback...
:playback
"%IBM_RATIONAL_RFT_ECLIPSE_DIR%\jdk\jre\bin\java" 
java -classpath "%IBM_RATIONAL_RFT_INSTALL_DIR%\rational_ft.jar;%RFT_PROJECT_LOCATION%\db2jcc.jar;%RFT_PROJECT_LOCATION%\mail.jar;%RFT_PROJECT_LOCATION%\log4j-1.2.15.jar;%RFT_PROJECT_LOCATION%\log4j.xml;" com.rational.test.ft.rational_ft -datastore %RFT_PROJECT_LOCATION% -playback %RFT_SCRIPT_NAME% -log %RFT_LOGFILE_NAME%
if "%4" == "silent" goto end
echo RFT playback complete.
goto end
:missing_args
echo.
echo ERROR: Invalid syntax! Usage: 
echo RFT_PlayScript ProjectPath ScriptName LogName [silent]
goto end
:end

那么,我在bat文件中是否需要一些额外的参数,或者我可能会错过必要的东西? (代码在DB2上实现加密之前完全正常工作)

0 个答案:

没有答案