CTP : How to configure JAVA class file in CTP
I have a Virtual Asset which has a extensiontool chained using Java Language to send response back to client.
I also have the java project inside the same SOAtest project. I added the classPath to the system properties and class loader , it works fine.
But when i deployed the asset to SOAVirtualizeServer , I could not find the extensiontool. However, i added extensiontool from CTP itself and added class file (VirtualAssets/SystemJars/Test.class) under the systemjars.
Now, when i selected Language as JAVA and provided the class file as (Test.class) since it is under system jars. But am getting error saying "ClassFileNotFound"
Can someone please help me how do I use JAVA class file in CTP ?
Best Answer
-
Good morning,
To clarify your use case, did you upload the same .pva file to the server in CTP or are you re-creating the .pva file in CTP?
For example, this is how the Virtual Asset looks like in my SOAVirt Desktop (Right-Click>View Image):And this is how the same Virtual Asset looks like in CTP:
Notice that I am able to see the method in the Extension Tool for both the SOAVirt Desktop and CTP. The JAR file is shown under /VirtualAssets/system_jars. The Text Data Bank will not be shown in CTP because it is not currently available in CTP. However, it will still be executed at runtime if it's the same .pva file from the Desktop.
I am able to hit the Virtual Asset endpoint and get the expected response. Please verify that you see the same on your end.
5
Answers
-
We need this very quick for a project. Can someone please help on this ?
0 -
1.) *Inside CTP - First make sure that you use the fully qualified name for the class in the text field. For example if you were going to use String you would enter "java.lang.String".
2.) Inside SOAVirt desktop client - If part one doesn't work make sure that under Preferences > Parasoft > System Properties that the class folder is specified by clicking add folder and choosing the folder that contains the class. If the class has any external dependencies be sure to also load those as well. Last make sure to click the reload button to make sure everything under System properties is synced
0 -
Thanks @humphrey
I did tried in SOAVirtand it worked fine. But I faced issues while using the class file jn CTP.
For the 1st point you mentioned, yes now I used the full class path and now am able to see methods.
However , am not getring return value though i chained a textdatabank and mapped the variable in my responder response.
The same structure works jn SOAVirt.Can you please tell me how do I capture from extension tool to responder response using Java class file inside CTP?
0 -
One thing we noticed is that the path you mentioned is wrong it should be /VirtualAssets/system_jars/
see https://docs.parasoft.com/pages/viewpage.action?pageId=73223405#AdditionalPreferenceSettings-systemPropertiesSystemPropertiesSettings0 -
@humphrey
Yes mentioned correct path and able to see java methods from the dropdown.
But when I deployed to CTP and tried to invoke the responder, i am not getting any response. It is returning only blank response.I am wondering how the same setup is working in SOATest Tool and not working in CTP
Can you please suggest ?
0 -
@OmarR
Yes, now am able to see and got the response. Actually , when we deploy the jar file to CTP under system_jars it seems like virtual server needs a restart and only then methods are visible.But however, this helped me a lot. Thank you so much
0 -
Glad you got it to work. Restarting the tool will reload the jars and make the methods available. Alternatively, you can make a REST API call to the SOAVirt server to reload the jars without having to restart the server.
POST - http://[soavirt_server_host]:[soavirt_server_port]/soavirt/api/v5/preferences/systemProperties/reload
You can access the API documentation using the following URL:
http://[soavirt_server_host]:[soavirt_server_port]/soavirt/api#/preferences/preferencesPOST_systemProperties_reload0 -
As of CTP 2020.2, jar files and classes are now reloaded from a user-initiated server refresh in CTP. There is no need to restart the soavirt server to view the latest methods for jars added under /VirtualAssets/system_jars.
0