我试图从我的Java程序连接到IBM中型(AS400)计算机,然后重设用户密码。使用Jt400.jar,我设法做到了。但是问题是,我需要将端口设置为专门使用端口23。我希望它按照tn5250的方式连接到AS400。从IBM网站在这里,我知道我可以利用这样做as400.connectToPort(23)。
令我感到困惑的是,当我添加该方法时,我得到了一个java.lang.RuntimeException: java.lang.NegativeArraySizeException。我曾尝试寻找什么导致此异常导致我在这里和更多的解释在这里。这是我的代码:
public void executeSetPassword(final String userName, final GuardedString password) {
if ((userName != null) && (password != null)) {
final String host = configuration.getHost();
final String remoteUser = configuration.getRemoteUser();
GuardedString passwd = configuration.getPassword();
boolean isSuccessful;
final AS400 as400 = new AS400();
try {
as400.setSystemName(host);
as400.setUserId(remoteUser);
passwd.access(new Accessor(){
@Override
public void access(char[] clearChars) {
try {
as400.setPassword(new String(clearChars));
}catch (Exception e) {
e.printStackTrace();
}
}});
as400.setGuiAvailable(false);
as400.connectToPort(23);
final CommandCall …Run Code Online (Sandbox Code Playgroud) 我正在尝试将木偶大师的文件复制到木偶代理中.用它来安装.然后删除该文件.我已经测试了脚本,直到安装部分,它工作正常.唯一的问题是删除文件时.添加几行后,我收到此错误.
Error: Failed to apply catalog: Duplicate declaration: File[/home/mypackage-4.4.0.rpm] is already declared in file /etc/puppet/manifests/site.pp:23; cannot redeclare at /etc/puppet/manifests/site.pp:31
Run Code Online (Sandbox Code Playgroud)
这是我写的pp文件:
class mypackage {
$version = '4.6.0'
if $::operatingsystem == 'CentOS' {
exec { "mypackage-uninstall":
path => ['/usr/bin','/usr/sbin/','/bin','/sbin'],
command => "/bin/rpm -e mypackage",
}
file { "mypackage-${version}.rpm":
path =>"/home/mypackage-${version}.rpm",
source => "puppet:///modules/mypackage-${version}.rpm"
}
exec { "mypackage-install":
path => ['/usr/bin','/usr/sbin','/bin','/sbin'],
command => "/bin/rpm -ivh /home/mypackage-${version}.rpm",
require => file["/home/mypackage-${version}.rpm"],
}
#this is the part that i add to delete back what has been …Run Code Online (Sandbox Code Playgroud)