Skip to main content
6-Contributor
February 11, 2025
Question

Exception thrown when trying to create WTPartUsage using Info*Engine API

  • February 11, 2025
  • 3 replies
  • 1381 views

Version: Windchill 12.1

 

Use Case: Using a DAO class that extends com.infoengine.connector.DataAccessObject to link 2 parts: public com.ptc.windchill.ws.GenericBusinessObject [] Link ( java.lang.String parentUfid, com.ptc.windchill.ws.GenericBusinessObject [] associations, java.lang.String [] propertyNames ) throws Exception { String [] ie$dao$names = { "parentUfid", "associations", "propertyNames", }; Object [] ie$dao$vals = { parentUfid, associations, propertyNames, }; Object ie$dao$ret = execute ( "Link", ie$dao$names, ie$dao$vals ); return (com.ptc.windchill.ws.GenericBusinessObject [])ie$dao$ret; }


Description:

Exception thrown when trying to create WTPartUsage between 2 parts.  Same call works in other WC installations (11, 12, 13, etc...) but failed in 12.1.2.  The settings are the same for all the WC servers tested.

 

2025-01-27 19:15:35,902 ERROR [ajp-nio-127.0.0.1-8010-exec-3] wt.adapter.exception aphung - WTAdapterImpl com.ptc.core.command.common.CommandException: EXCEPTION DURING SAVE[ SOURCE: @@@ BEGIN TYPE INSTANCE @@@ Identifier: WCTYPE|wt.part.WTPartUsageLink~~NEW|-8287685863323502768 @@@ BEGIN ATTRIBUTE CONTAINER @@@ @@@ ID: WCTYPE|wt.part.WTPartUsageLink~~NEW|-8287685863323502768 @@@ : ~MBA|usedBy^WCTYPE|wt.part.WTPart~~WCP|168971|-1 @@@ Content: WCTYPE|wt.part.WTPart~~WCP|168971|-1 @@@ State: NEW @@@ @@@ ID: WCTYPE|wt.part.WTPartUsageLink~~NEW|-8287685863323502768 @@@ : ~MBA|uses^WCTYPE|wt.part.WTPartMaster~~WCP|168948|-1 @@@ Content: WCTYPE|wt.part.WTPartMaster~~WCP|168948|-1 @@@ State: NEW @@@ @@@ ATTRIBUTE IDENTIFIER COUNT = 2

....

@@@ REPLACEMENTS : NONE @@@ @@@ END ATTRIBUTE CONTAINER @@@ END TYPE INSTANCE ]EXCEPTION DURING SAVE Nested exception is: com.ptc.core.command.common.CommandException: (wt.part.partResource/QUANTITY_UNIT_EMPTY_VALUE_MSG) com.ptc.core.command.common.CommandException: The unit cannot be empty Nested exception is: (wt.part.partResource/QUANTITY_UNIT_EMPTY_VALUE_MSG) com.ptc.core.command.common.CommandException: The unit cannot be empty at wt.part.PartUsesLinkValidationeHelper.validateQuantityUnitForEach(PartUsesLinkValidationeHelper.java:86) at com.ptc.core.foundation.occurrence.server.impl.SavePartUsesSubCommandDelegate.validateUsageLink(SavePartUsesSubCommandDelegate.java:646) at com.ptc.core.foundation.occurrence.server.impl.SavePartUsesSubCommandDelegate.updatePartUsageLink(SavePartUsesSubCommandDelegate.java:713) at com.ptc.core.foundation.occurrence.server.impl.SavePartUsesSubCommandDelegate.doExecution(SavePartUsesSubCommandDelegate.java:418)

...

3 replies

24-Ruby III
February 11, 2025

Article - "Getting the error "The unit cannot be empty" when adding a part to a structure in Windchill PDMLink": https://www.ptc.com/en/support/article/CS379043 

6-Contributor
February 11, 2025

This same request works in Windchill 10, 11, 12, 13.  It just does not work in Windchill 12.1.2.  I have checked the settings and they are the same in all the WC servers.  It appears that in 12.1.2, there is this validation check that does not allow this operation.

18-Opal
February 12, 2025

The error clearly state the quantity unit cannot be empty.

Are you specifying the quantity and the units?

If no, it look like doing so would fix this particular error.

6-Contributor
February 12, 2025

I understand.  If I change my code to provide quantity and unit, it does work.  If this is how it should work, then will future versions behave the same way?  Again, this same code works in WC 10, 11, 12, AND 13.  Will there be a patch to fix this in WC 13 and any future versions of WC?

6-Contributor
February 14, 2025

Again this is only an issue with Windchill 12.1.2.  Works for 10, 11, 12.1, 13.1.  I tried to create an issue, but it leads me to this community.  Is there a way to have someone from PTC/Windchill look at this?