Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X
I have a Spring scheduled method in Windchill and want to call some methods, but i get the erro that there is no active method context. So I tried to call the method via RemoteMethodServer.invoke(). This actually works but i always get the following error in the log:
Solved! Go to Solution.
I solved it by calling a rest servlet.
The Rest servlet has an active method context so there is no preoblem.
Hi @dullnigAlex
I do not use invoke, I use just getDefault
RemoteMethodServer.getDefault().setUserName("----");
RemoteMethodServer.getDefault().setPassword("----");
Then I use standard Windchill methods.
PetrH
If I only get the default i get:
I've tried it with this:
@Component
public class QueueRetryMechanism implements RemoteAccess {
private static final TSLogger logger = new TSLogger(QueueRetryMechanism.class.getCanonicalName());
@Scheduled(initialDelay = 60000, fixedRate = 120000)
public void retryFailedEntries() throws IOException {
RemoteMethodServer.getDefault().setUserName("wtadmin");
RemoteMethodServer.getDefault().setPassword("wtAdm!n");
try {
ProcessingQueue queue = (ProcessingQueue) QueueHelper.manager.getQueue("IFactoryWorkerQueue", ProcessingQueue.class);
Enumeration enumeration = QueueHelper.manager.queueEntries(queue);
System.out.println(enumeration);
} catch (WTException e) {
logger.error(e);
}
}
With Component Scan and annotation driven the class is loaded
I solved it by calling a rest servlet.
The Rest servlet has an active method context so there is no preoblem.