cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

How to execute an I*E task from Java code.

SOLVED
pmoothedath
Newbie

How to execute an I*E task from Java code.

Hi all,

Has anybody got a small example of executing an I*E task (in folder <windhcill_home>/tasks/...) from a Java code. ? I use the following code which throws error.

String taskPath = "D:/ptc/Windchill_9.1/Windchill/tasks/searchOrg.xml";

WTProperties wtproperties = WTProperties.getLocalProperties();

String instance = wtproperties.getProperty("wt.federation.ie.VMName");

System.out.println("instance = " +instance);

Task task = new Task(taskPath);

task.addParam("instance", instance);

task.invoke();

The error I get is

java.lang.ClassNotFoundException: com.ptc.windchill.keystore.WTKeyStore

at java.net.URLClassLoader$1.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Unknown Source)

at com.infoengine.au.IEProperties.preload(IEProperties.java:245)

at com.infoengine.au.IEProperties.<init>(IEProperties.java:269)

at com.infoengine.au.NamingService.getIEProperties(NamingService.java:1398)

at com.infoengine.SAK.TaskCompiler.<init>(TaskCompiler.java:119)

at com.infoengine.SAK.Task.compile(Task.java:1827)

at com.infoengine.SAK.Task.invoke(Task.java:1736)

at ewb.test.TestClass.main(TestClass.java:91)

Exception in thread "main" java.lang.NullPointerException

at com.infoengine.procunit.adapter.Adapter.createConnection(Adapter.java:912)

at com.infoengine.procunit.adapter.Adapter.<init>(Adapter.java:160)

at com.infoengine.SAK.ObjectWebject.invoke(ObjectWebject.java:143)

at com.infoengine.compiledTasks.file.D$3a.ptc.Windchill_9$2e1.Windchill.tasks.ext.flex.searchorg$2exml.invoke(searchorg$2exml.java:73)

at com.infoengine.SAK.Task.invoke(Task.java:1783)

at ewb.test.TestClass.main(TestClass.java:91)

1 ACCEPTED SOLUTION

Accepted Solutions

Re: How to execute an I*E task from Java code.

Rama,

Are you getting the same error as above?

I think this article goes along with what Dave mentioned in letting the I*E server/Adapter from the method server handle the task processing:

http://support.ptc.com/appserver/cs/view/solution.jsp?n=CS146753

View solution in original post

5 REPLIES 5

Re: How to execute an I*E task from Java code.

Try this.

WTProperties props = WTProperties.getLocalProperties();

Task myTask = new Task("ext/myTask.xml", props.getProperty("wt.federation.ie.VMName"));

myTask.setUsername(user.getName());

myTask.addParam("param1", "param1value");

emailTask.invoke();

It looks like your task is being called though from the stack trace above, so I'm guessing its a problem with the content of your task file itself.

Re: How to execute an I*E task from Java code.

Why did you do this?

String taskPath = "D:/ptc/Windchill_9.1/Windchill/tasks/searchOrg.xml";

I always use the IE servlet via the method server.

Are you running the separate Info*Engine server?

Re: How to execute an I*E task from Java code.

Thanks David.

Do you have any code samples of calling thru IE servlet ?

And my I*E server runs within the method servers. Do you know of any configurations to have it run externally.

Re: How to execute an I*E task from Java code.

David,

Did you get any help on this topic. Am trying to do the same. Please let me know if you hve a running snippet for this.

Thanks

RK

Re: How to execute an I*E task from Java code.

Rama,

Are you getting the same error as above?

I think this article goes along with what Dave mentioned in letting the I*E server/Adapter from the method server handle the task processing:

http://support.ptc.com/appserver/cs/view/solution.jsp?n=CS146753

View solution in original post

Announcements