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

Community Tip - You can change your system assigned username to something more personal in your community settings. X

problem in creation part using JAVA API?

ptc-5398818
1-Newbie

problem in creation part using JAVA API?

Hi,

I am trying to create part using java API.

Code: public static void CreatePart()

{

System.out.println("enter in part creation");

WTPart part;

try {

part = WTPart.newWTPart("01234567", "MyPartName");

} catch (WTException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

PersistenceHelper.manager.save(part);

}

But getting error while saving part in database using PersistenceHelper.manager.save(part); API

Error: The type com.ptc.windchill.annotations.metadata.ColumnType cannot be resolved. It is indirectly referenced from required .class files

PFA screenshot of error

I am new in Windchill ,plz anyone help me?

1 ACCEPTED SOLUTION

Accepted Solutions

You should include the <Windchill>/srclib/tool/Annotations.jar in your project.

View solution in original post

3 REPLIES 3

You should include the <Windchill>/srclib/tool/Annotations.jar in your project.

After addition of Annotations.jar in project the current error is removed bt still nt able to create part getting following error please help . please send basic programme of part creation, setting attribute of part.

(wt.fc.fcResource/0) wt.util.WTException: The operation: "save" failed.

Nested exception is: wt.util.WTRemoteException: Unable to invoke remote method; nested exception is:

wt.method.AuthenticationException

at wt.method.RemoteMethodServer.invoke(RemoteMethodServer.java:808)

at wt.services.ServiceFactory$ClientInvocationHandler.invoke(ServiceFactory.java:349)

at com.sun.proxy.$Proxy6.save(Unknown Source)

at Package_1.Create_Part.CreatePart(Create_Part.java:79)

at Package_1.Create_Part.main(Create_Part.java:42)

Anup,

Plesae see attached sample java file to create new WTPart. Also refer below Article for setting attributes

https://www.ptc.com/appserver/cs/view/solution.jsp?n=CS83161&posno=18&q=LWCNormalizedObject%20&nav=ptcproductgroups||windchill||Product+Group||windchill^^ptcdoctype||SFSolution||Document%20Type||Article

hope this helps !!!

Thanks,
Shreyas

Top Tags