Community Tip - When posting, your subject should be specific and summarize your question. Here are some additional tips on asking a great question. X

Translate the entire conversation x

Workflow expression "cannot find symbol" of compiled custom class

Dobi
16-Pearl

Workflow expression "cannot find symbol" of compiled custom class

Version: Windchill 13.0

 

Use Case: I wrote/compiled some code to collect and send to a messaging queue a part BOM. Part of this code has two custom classes (BOM, BOMLines). The return of my method is a List but the workflow expression says it "cannot find symbol" for my BOM class.


Description:

In the workflow expression I have:

 

java.util.List<ext.comp.BOM> myBOM = ext.comp.getBOMSfromECN(cn);
ext.comp.Messages.sendToERP("BOM from ECN: " + myBom.toString());		

 

Check syntax in the workflow doesn't like the ext.comp.BOM...

 

WfExpression_88956210.java:72: error: cannot find symbol
                java.util.List<ext.ursa.BOM> myBOM = ext.ursa.getBOMSfromECN(cn);
                                          ^

 

 

On the server I have a BOM.java and BOM.class. Originally I had both of my custom classes in my main code but a compilation error said these would have to exist as standalone .java, so they do. 

 

How can I use my custom class in a workflow expression? 

 

package ext.comp;

import java.util.*;

public class BOM {
    private List<BOMLine> lines;
    private String parentPN;
    private String parentRev;

    public BOM(List<BOMLine> lines, String parentPN, String parentRev) {
        this.lines = lines;
        this.parentPN = parentPN;
        this.parentRev = parentRev;
    }
 
    public void setLines(List<BOMLine> children){
        this.lines = children;
    }
}

 

 

ACCEPTED SOLUTION

Accepted Solutions

@joe_morton  I did yes... what turned out to be the issue was more basic (Java basic). 

 

The method was not static so I needed to invoke it differently. First create a new instance and then invoke the method:

 

ext.comp.getBOMS gb = new ext.comp.getBOMS();
java.util.List<ext.comp.BOM> myBOM = gb.getBOMSfromECN(cn);

 

Alternatively, if getBOMSFromECN is a static method, then I can invoke it like I had it:

 

java.util.List<ext.comp.BOM> myBOM = ext.comp.getBOMSfromECN(cn);

 

PTC Tech Support was actually support prompt and extremely helpful in getting this sorted out.

View solution in original post

2 REPLIES 2
joe_morton
17-Peridot
(To:Dobi)

@joe_morton  I did yes... what turned out to be the issue was more basic (Java basic). 

 

The method was not static so I needed to invoke it differently. First create a new instance and then invoke the method:

 

ext.comp.getBOMS gb = new ext.comp.getBOMS();
java.util.List<ext.comp.BOM> myBOM = gb.getBOMSfromECN(cn);

 

Alternatively, if getBOMSFromECN is a static method, then I can invoke it like I had it:

 

java.util.List<ext.comp.BOM> myBOM = ext.comp.getBOMSfromECN(cn);

 

PTC Tech Support was actually support prompt and extremely helpful in getting this sorted out.

Announcements


Top Tags