Preamble[indent]This post is somewhat related to
this other thread - but whereas that thread is specific about replacing the use of an EA with a CSSDK query operation, this thread is more concerned about building something that I can run from my client machine so as to avoid having to constantly run
make_toolkit.ipl and forcing the restart of the GUI services and disrupting everyone else who is using the same server...[/indent]
Environment[indent]TeamSite 7.2.0 on W2K3 with WXP client[/indent]
Getting something to build & run[indent]My first frustrations were with trying to get a factory object.
I've constructed my code thus far based on the CSSDK javadocs and [mostly] from helpful threads on these forums. The first part (in blue) worked without problems (output shown below code), but the second / middle part (in brown) had me stopped for a bit:
...
public static void main(String[] args) {
CSFactory factory = null;
String name;
Properties props = new Properties();
try {
// V: is mapped to the TS server
props.load(new FileInputStream("V:/TeamSite/cssdk/cssdk.cfg"));
props.setProperty("cssdk.cfg.path", "V:/TeamSite/cssdk/cssdk.cfg");
System.out.println("Properties loaded");
System.out.println(props.toString());
} catch (FileNotFoundException fnf) {
System.err.println("The properties file was not found " + fnf.getMessage());
return;
} catch (IOException io) {
System.err.println("Some type of I/O exception has occurred " + io.getMessage());
return;
}
// create the factory
try {
factory = CSFactory.getFactory(props);
name = factory.getClass().getName();
System.out.println("Factory of type " + name + " created");
System.out.println("Type read from properties file");
} catch (CSFactoryInitializationException fie) {
System.err.println("The factory cannot be initialized ");
fie.printStackTrace();
return;
}
CSClient currentClient = null;
try {
currentClient = factory.getClientForCurrentUser( Locale.getDefault(), "mydemo", null );
} catch (CSAuthenticationException e) {
System.err.println("CSAuth exception");
e.printStackTrace();
return;
} catch (CSRemoteException e) {
System.err.println("CSRemote exception");
e.printStackTrace();
return;
} catch (CSException e) {
System.err.println("CSException");
e.printStackTrace();
return;
}
System.out.println("current client: " + currentClient.getCurrentUser().toString());
}
...
The output initially was as follows:
H:\workspace\HL_WF\bin>java -cp ... com.****.wf.Test
Properties loaded
{ts.server.endian=little, ts.server.os=win, cssdk.cfg.path=V:/TeamSite/cssdk/cssdk.cfg, defaultTSServer=servername}
The factory cannot be initialized
com.interwoven.cssdk.factory.CSFactoryInitializationException: (No factory implementation specified)
at com.interwoven.cssdk.factory.CSFactory.getFactory(CSFactory.java:118)
at com.****.wf.Test.main(Test.java:46)
At this point, looking through some more threads in the forums, I see several posts indicating that I should be using
CSJavaFactory
instead of the base class
CSFactory
- okay - but I still ran into build problems for java.lang.NoClassDefFoundError's.
Through an iterative process, it took me a bit of searching but I finally found what is probably the "minimum" classpath for use in building / running the above boiler-plate CSSDK CLT code (IMO - that's what it is, and it should be fully documented in the manuals along with all the libraries needed, etc.). So to help others who follow in these footsteps... the following appeared to be the bare-minimum classpath required to build / run this test class: