Hi All,
I'm trying to run sample ODWEK code from a windows environment and the following exception is occuring:
ODException: com.ibm.edms.od.ODException: Could not initialize ICU
id = 9
msg = Could not initialize ICU
com.ibm.edms.od.ODException: Could not initialize ICU
at com.ibm.edms.od.ODServer.initialize(ODServer.java:146)
at oDSample.ODSample.main(ODSample.java:56)
Please note that all the library and DLL related paths have been added in the environment CLASSPATH & PATH variables. Let me know in case you have faced a similar issue earlier. Here's my java code:
/**
*
*/
package oDSample;
import com.ibm.edms.od.ODConfig;
import com.ibm.edms.od.ODException;
import com.ibm.edms.od.ODServer;
/**
* @author
*
*/
public class ODSample {
/**
* @param args
*/
public static void main(String[] args) {
ODServer odServer;
ODConfig odConfig;
//String str;
int j;
// ----------
// If too few parameters, display syntax and get out
// ----------
// if ( argv.length < 3 )
//{
//System.out.println( "usage: java TcServerMisc <server> <userid> <password> " );
//return;
//}
try
{
// ----------
// Set the stage
// ----------
System.out.println( "This testcase should:" );
System.out.println( " Use ODServer methods setServerName, setUserId, and setPassword" );
System.out.println( " to prepare for logon" );
System.out.println( " Set the application name" );
System.out.println( " Server name" );
System.out.println( " User Id" );
System.out.println( " Password" );
System.out.println( " Connect Type" );
System.out.println( " Set and display the port" );
System.out.println( " Set the connect type" );
System.out.println( " Logoff" );
System.out.println( "" );
System.out.println( "Ensure that all information is correct." );
System.out.println( "" );
System.out.println( "-----------------------------------------------" );
System.out.println( "" );
// ----------
//Setup ODConfig object using defaults and initialize ODServer.
// ----------
odConfig = new ODConfig();
odServer = new ODServer(odConfig);
odServer.initialize( "ODSample.java" );
System.out.println( "Logging on to server ..." );
// ----------
// Logon to specified server
// ----------
//odServer.logon( );
odServer.logon("server", "admin", "------");
// ----------
// Test miscellaneous methods
// ----------
System.out.println( "Setting application name to ODSample.java..." );
System.out.println( "Server Name: " + odServer.getServerName( ) );
System.out.println( "User Id: " + odServer.getUserId( ) );
System.out.println( "Password: " + odServer.getPassword( ) );
j = odServer.getPort( );
System.out.println( "Setting port to " + j + "..." );
odServer.setPort( j );
System.out.println( "Port: " + j );
// ----------
// Cleanup
// ----------
System.out.println( "Logging off..." );
odServer.logoff( );
odServer.terminate( );
System.out.println( "" );
System.out.println( "---------------------------------------------------" );
System.out.println( "" );
System.out.println( "Testcase completed - analyze if required" );
System.out.println( "" );
}
catch ( ODException e )
{
System.out.println( "ODException: " + e );
System.out.println( " id = " + e.getErrorId( ) );
System.out.println( " msg = " + e.getErrorMsg( ) );
e.printStackTrace( );
}
catch ( Exception e2 )
{
System.out.println( "exception: " + e2 );
e2.printStackTrace( );
}
}
}
Thanks in advance,
Sandeep Veldi
I guess it's because of the way you are using ODConfig, but I am not sure.
Here is what I used.
odConfig = new ODConfig(
ODWEKProperties.getProperty("AfpViewer"), // AfpViewer
ODWEKProperties.getProperty("LineViewer"), // LineViewer
ODWEKProperties.getProperty("MetaViewer"), // MetaViewer
Long.parseLong(ODWEKProperties.getProperty("MaxHits")), // MaxHits
ODWEKProperties.getProperty("AppletDir"), // AppletDir
ODWEKProperties.getProperty("Language"), // Language
ODWEKProperties.getProperty("TempDir"), // TempDir
ODWEKProperties.getProperty("TraceDir"), // TraceDir
Integer.parseInt(ODWEKProperties.getProperty("TraceLevel")) // trace
);
odServer = null;
try{
odServer = new ODServer(odConfig);
Pankaj,
Thanks for your response. I think the ODWEKProperties is deprecated in v8.5 of ODWEK. Here's a snapshot from the documentation:
public class ODConfig
extends java.lang.Object
The ODConfig Java object will be the preferred method in which to configure the system parameters and the arswww.ini will be deprecated with version 8.4 of ODWEK. Until then, both the ODConfig Java object and the arswww.ini file will be supported.
There are eight system parameters needed for a working ODServer instance. These can be set to default values through the ODConfig default constructor:
try{
ODConfig cfg = new ODConfig();
ODServer srvr = new ODServer(cfg);
srvr.initialize(null, "MyCustomApp");
cfg.printConfig();
}
catch(ODException e){
System.out.println("Exception " + e);
}
This sample code will configure the following default parameters:
AfpViewOpt PLUGIN
LineViewOpt APPLET
MaxHits 200 This is used to set a global maxhits that can be returned from a search. This will not override the Admin settings. Also can be set per folder using ODFolder.setMaxHits
MetaViewOpt NATVIE
AppletDir /applets
Language ENU
TempDir The temp path as defined by the Java System.getProperty("java.io.tmpdir") method.
TraceDir The temp path as defined by the Java System.getProperty("java.io.tmpdir") method.
TraceLevel 0
For information on these parameters please refer to Chapter 7: Specifying the arswww.ini file in the OnDemand Web Enablement Kit Implementation Guide.
These eight parameters can also be explicitly set via the following sample code which utilizes a different ODConfig constructor:
try{
ODConfig cfg = new ODConfig(ODConstant.PLUGIN, //AfpViewer
ODConstant.APPLET, //LineViewer
null, //MetaViewer
500, //MaxHits
"c:\\applets", //AppletDir
"ENU", //Language
"c:\\temp", //TempDir
"c:\\temp\\trace", //TraceDir
1); //TraceLevel
ODServer srvr = new ODServer(cfg);
srvr.initialize("MyCustomApp");
cfg.printConfig();
}
catch(ODException e){
System.out.println("Exception " + e);
I tried using the ODWEKProperties class and I'm seeing an error that it doesn't exist.
Thanks
Sandeep Veldi
Sorry to bump an old thread, but I'm having the exact same problem. Is there a known solution to this?
Thanks
Hello Mohamad,
Well before answering your question, the best would be that you explain a bit better your problem.
I mean by that:
- What version of ODWEK are you using?
- Which environment are you using?
- Do you have a code sample that should work, and doesn't that we can have a look and analyze it?
- Is the error message exactly the same as the one in this thread?
If not, then we might not help at all.
Sincerely yours,
Alessandro
Hi,
OD Server: 7.1.2.11
ODWEK: It says the dll file version is 8.4.1.0
Code:
ODServer odConnection = new ODServer(new ODConfig());
odConnection.setConnectType(ODConstant.CONNECT_TYPE_TCPIP);
odConnection.setServerName(server);
odConnection.setUserId(username);
odConnection.setPassword(password);
odConnection.setPort(port);
odConnection.initialize("ODConnection" + unusedConnections.size());
odConnection.logon();
Yes, the exception is the same one:
The program throws an exception when it reaches initialize():
Caused by: com.ibm.edms.od.ODException: Could not initialize ICU
at com.ibm.edms.od.ODServer.initialize(ODServer.java:140) ~[ODApi.jar:na]
at com.msdw.ondemand.connection.OdConnectionPool.createOdConnection(OdConnectionPool.java:43) ~[build/:na]
at com.msdw.ondemand.connection.OdConnectionPool.afterPropertiesSet(OdConnectionPool.java:29) ~[build/:na]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514) ~[org.springframework.beans.jar:3.1.1.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452) ~[org.springframework.beans.jar:3.1.1.RELEASE]
... 38 common frames omitted
Thanks
I forgot to mention that on Linux it works perfectly but on Windows it throws that exception.
Hello,
sorry to answer quite late, but have made sure that all the dll are correctly visible from the java perspective? in the classpath or in the path or copy the dll in the same directory as your code.
Sincerely yours,
Alessandro