Support Article
Error when trying to connect to Service Java via external app
SA-678
Summary
User has implemented a Service Java rule and downloaded the JAR file.
It was observed that Java JDK is not identifying the packages imported in the JAR file.
Please advice on the configuration required to use methods present in the JAR file.
Error Messages
package com.pega.pegarules.services.client does not exist
package com.pega.pegarules.pub.services does not exist
Steps to Reproduce
1)Create a service java rule.
2)Deploy the service java rule and download the generated JAR file.
3)Call the java functions present in JAR file through a java application.
Resolution
Using Service Java:-
1. Create a Service Java rule and a package in your PRPC system.
2. Download the Proxy JAR from Service Package.
3. Deploying the JAR as Local Type:-
1. Create a Java class to invoke the required method given in the Java class of proxy JAR downloaded from Service Package.
2. Copy all the JARs provided in App-Inf/lib directory of .ear file in the PRPC distribution package shipped by Pega to any other directory.
3. Edit prbbotstrap.properties and prconfig.xml of prresources.jar to include your DB connection details.
4. Include all the below given JARs in Java classpath and compile your Java.
1. jsr94-1.0.jar copied from PRPC distribution.
2. prbootstrap.jar copied from PRPC distribution.
3. prdbcp.jar copied from PRPC distribution.
4. prresources.jar copied from PRPC distribution and modified with appropriate prbootstrap and prconfig files.
5. prserviceclient.jar given along with this document in this .zip file.
6. ServicesLocalProxy.jar downloaded from PRPC.
7. JDBC driver JAR for your database (e.x Sqljdbc4.jar for MSSQL Server).
5. After successful compilation execute your class. This starts a PRPC instance irrespective of application server and invokes Service Java.
6. Deploying the Jar as Remote type:-
1. To use this mode you need your PRPC deployed in application server.
2. Create a Java class to invoke the required method given in the Java class of proxy JAR downloaded from Service Package.
3. Include all the below given JARs in Java classpath and compile your Java.
1. jsr94-1.0.jar copied from PRPC distribution.
2. prbootstrap.jar copied from PRPC distribution.
3. prdbcp.jar copied from PRPC distribution.
4. prresources.jar copied from PRPC distribution. No need to edit configuration files.
5. prserviceclient.jar given along with this document in this .zip file.
6. ServicesProxy.jar downloaded from PRPC.
7. javax.ejb.jar given along with this document in this .zip file.
8. A JAR specific to your application server. For example wlfullclient.jar for WebLogic given along with this document in this .zip file. You need to use a different Jar if your server is WebSphere. This JAR by default contains javax.ejb.jar mentioned in above step.
9. After successful compilation execute your Java class. This invokes Service Java through Application Server.
Published June 12, 2015 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.