2

I am facing some troubles while trying to create an IFSFile using IFSFile object from JT400.jar. The problem that I am facing is when the process that calls the JAVA is called by a BATCH user(without login enabled into AS400 machine).

Exception given

Password is *NONE.:XXXXXX com.ibm.as400.access.AS400SecurityException: Password is *NONE.:XXXXXX at com.ibm.as400.access.AS400ImplRemote.returnSecurityException(AS400ImplRemote.java:2219) at com.ibm.as400.access.CurrentUser.getUserInfo(CurrentUser.java:79) at com.ibm.as400.access.AS400ImplRemote.getPassword(AS400ImplRemote.java:1411) at com.ibm.as400.access.AS400ImplRemote.signon(AS400ImplRemote.java:2507) at com.ibm.as400.access.AS400.sendSignonRequest(AS400.java:3351) at com.ibm.as400.access.AS400.promptSignon(AS400.java:2938) at com.ibm.as400.access.AS400.signon(AS400.java:4246) at com.ibm.as400.access.AS400.connectService(AS400.java:1336) at com.ibm.as400.access.IFSFile.chooseImpl(IFSFile.java:630) at com.ibm.as400.access.IFSFile.copyTo(IFSFile.java:729) at com.ibm.as400.access.IFSFile.copyTo(IFSFile.java:699)

Code used:

    AS400 as400 = new AS400("localhost");

    //Obtain the template path
    String templatePath ="/HOME/XXX/auth.txt";

    IFSFile templateAuth = new IFSFile(as400,templatePath); 
    templateAuth.copyTo(fileXML + ".xml");

I have check some opened threads but no results obtained. (find below the threads commented)

JT400 Read File From IFS with user without password

Java IFSFile on Iseries testing over PC

There is any option to generate an IFSFile when the process is called by a BATCH user(note that when the process is called by a user with login enabled, the process is working as expected)

I need something similar to what is done when a JDBCAppender is created, JDBCAppender object allows setUser(null) and setPassword(null) to enable batch users to write into a table.

Thanks all!

jmarkmurphy
  • 11,030
  • 31
  • 59
  • 1
    I dont't think that works. The AS400 object represents a socket connection to IBM i, and it needs to log in to a host server. JDBC and ODBC use different processes. If you need it to work like JDBC, why don't you use JDBC? You could potentially write a stored procedure in RPG to write the file, then call it via JDBC. – jmarkmurphy Nov 28 '17 at 12:09

1 Answers1

1

I have recently had a similar problem when trying to use CommandCall whilst running under a profile with PASSWORD is *NONE. I (eventually) solved it by using the native Java toolbox at /QIBM/ProdData/Java400/jt400ntv.jar (which happens to be a symbolic link). I didn't have to make any code changes:

    AS400 as400 = new AS400();
    CommandCall cc = new CommandCall(as400);
    String wrkenvvar_cmd = MessageFormat.format("ADDENVVAR ENVVAR('JAVA_HOME') VALUE(''{0}'') REPLACE(*YES)",path);
    boolean ok = cc.run(wrkenvvar_cmd);

I hope that helps.

M. A. Wheadon
  • 101
  • 1
  • 8