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

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

Deploying Async JLink Application as Rest API

AK_9776674
9-Granite

Deploying Async JLink Application as Rest API

Hi All,

 

I have used basic asynchronous jlink (Creo 7.0.2.0) code in my rest service application(Maven Build) as shown below - 

@GET
@PatH("/getModelInfo")
public String getModelInfo() {

try {
System.loadLibrary("pfcasyncmt");
System.out.println("check 1");
AsyncConnection connection =
pfcAsyncConnection.AsyncConnection_Start("<proe command> -g:no_graphics -i:rpc_input",
null);
System.out.println("check 2");
Session session = connection.GetSession();

/* J-Link processing calls here */

//null third argument designates model is not an instance.
System.out.println("check 3");
ModelDescriptor desc = pfcModel.ModelDescriptor_CreateFromFileName(<part_file_path>);
System.out.println("check 4");
Model model = session.RetrieveModel(desc);
System.out.println(model.GetFullName());
//createItemInFusion(model.GetFullName());
// end the Pro/ENGINEER process when done
connection.End();
System.out.println("check 5");
return model.GetFullName();
} catch (jxthrowable e) {
e.printStackTrace();
return null;
}

}

 

I deployed the above code to local weblogic server (12c). But when I call the rest api, I get the below error at the line highlighted in green italics - 

org.glassfish.jersey.server.ContainerException: java.lang.UnsatisfiedLinkError: com.ptc.pfc.pfcAsyncConnection.pfcAsyncConnection.AsyncConnection_Start(Ljava/lang/String;Ljava/lang/String;)Lcom/ptc/pfc/pfcAsyncConnection/AsyncConnection;
at org.glassfish.jersey.servlet.internal.ResponseWriter.rethrow(ResponseWriter.java:278)
at org.glassfish.jersey.servlet.internal.ResponseWriter.failure(ResponseWriter.java:260)
at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:509)
at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:334)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
Truncated. see log file for complete stacktrace
Caused By: java.lang.UnsatisfiedLinkError: com.ptc.pfc.pfcAsyncConnection.pfcAsyncConnection.AsyncConnection_Start(Ljava/lang/String;Ljava/lang/String;)Lcom/ptc/pfc/pfcAsyncConnection/AsyncConnection;
at com.ptc.pfc.pfcAsyncConnection.pfcAsyncConnection.AsyncConnection_Start(Native Method)

 

Can anyone please help me with this error resolution? 

I want to be able to connect with Creo from a webservice, if this is even possible or not. Any alternative ideas are welcome.

 

Thanks

ACCEPTED SOLUTION

Accepted Solutions
sjuraj
15-Moonstone
(To:AK_9776674)

According to this 

https://rollbar.com/blog/java-unsatisfiedlinkerror-runtime-error/

I think problem is that your application cannot load pfcasyncmt library

Try to add pfcasyncmt.dll to your project
This could help https://stackoverflow.com/questions/2407395/issue-while-loading-a-dll-library-file-java-lang-unsatisfiedlinkerror-cant

View solution in original post

3 REPLIES 3
sjuraj
15-Moonstone
(To:AK_9776674)

is your app working without weblogic server (in development mode) ? 

Yes, it's working fine without weblogic server.

sjuraj
15-Moonstone
(To:AK_9776674)

According to this 

https://rollbar.com/blog/java-unsatisfiedlinkerror-runtime-error/

I think problem is that your application cannot load pfcasyncmt library

Try to add pfcasyncmt.dll to your project
This could help https://stackoverflow.com/questions/2407395/issue-while-loading-a-dll-library-file-java-lang-unsatisfiedlinkerror-cant

Announcements


Top Tags