Creating a correlation set WebSphere Integration Developer
2 Comments Published July 21st, 2008 in Websphere Process Server / Integration DeveloperThis is something I was planning to post for a long time. Due to some or other exceptions I was getting, I couldn’t make it till today. Today’s post is about creating a correlation set in WebSphere Integration Developer. In my example I used a new module for creating the correlation set.
A correlation set is used for associating an external message with the correct process instance. To create a process that is using a correlation set first create an interface with two operations. In my case I am planning for a business process with two receive activities. My interface looks like the one shown below.
Now create a new process using the interface we created in previous step. Use the sayHello method as the operation for this process. Make sure that you have made this process as a long running process and add a second receive to this process. Finally after adding all the elements the business process would look like this.
Don’t worry about the error messages. Set the TestInterface as the partner for the second receive activity also. Select printName as the method name. Now most of the errors will be disappeared. However still there will be some errors present and it is because we don’t have a correlation set defined for the second receive activity. So now it is the time to define a correlation set. To create a correlation set for the business process follow the below steps.
1. Click on ‘Add correlation set’ icon next to Correlation sets from the tray.
2. Enter the name you want and select it.
3. Click on Details from properties window.
4. Now create a correlation property.
4.1. Click on Add
4.2. From th ‘Select Property’ window, click on New.
4.3. Enter a name for your property.
4.4. Click Browse and select the type of your property.
4.5. Create an Alias by clicking on New button next to Aliases label.
4.6. From ‘Create Property Alias’ window, select the interface and the operation.
4.7. Repeat it from the second operation also.
4.8 Click on OK
5. The correlation set is ready now. The next step is to associate the correlation set to the receive activities.
6. Click on Correlation from the first Receive activities’ properties area.
7. Click on Add. The correlation property will be added. Select initiation property as Yes and direction as Receive.
8. Click on second receive activity and add the correlation property. Here set the initiation property value as Join.
8. Build the project. Now all the errors will be disappeared from the module.
If you enjoyed this post, make sure you subscribe to my RSS feed!
CWWBA0140E: No process instance found for the process template
0 Comments Published July 19th, 2008 in Websphere Process Server / Integration DeveloperAnother exception with correlation sets. This exception comes if initiation property of correlation set is set to No. The exception stacktrace is
com.ibm.bpe.api.CreateRejectedException: CWWBA0140E: No process instance found for the process template 'XXXX' and createInstance is false for port type '{http://XXXX/XXX}XXX' and operation 'XXXX'
at com.ibm.bpe.engine.BpelEngineCore.createAndStartProcessInstance(BpelEngineCore.java:513)
at com.ibm.bpe.engine.BpelEngine.createAndStartProcessInstance(BpelEngine.java:188)
at com.ibm.bpe.framework.sca.ProcessSessionBean.createOrFindInstance(ProcessSessionBean.java:1429)
at com.ibm.bpe.framework.sca.ProcessSessionBean.invokeEngineSync(ProcessSessionBean.java:911)The solution for this problem is to change the initiation property of correlation set to Join. We would see this exception when we send an event to the correlation set. This exception is because the correlation set is not able to find an existing process for sending the event.
The same exception can occur even if the correlation set initiation property is set to Join also. This is because the value that we are sending to the correlation set does not exist for the correlation set property. So make sure that you are sending a valid value for any of an existing process.
Thanks Dan for helping me out in finding a solution to this problem.
If you enjoyed this post, make sure you subscribe to my RSS feed!
com.ibm.bpe.database. TomDuplicateKeyException: (com.ibm.bpe. database. CorrelationSetInstanceB: PNUDx)
0 Comments Published July 17th, 2008 in Websphere Process Server / Integration DeveloperCNTR0020E: EJB threw an unexpected (non-declared) exception during invocation of method “bpc_invoke” on bean “BeanId(XXXApp#XXXEJB.jar#component.XXXX, null)”. Exception data: com.ibm.bpe.database.TomDuplicateKeyException: (com.ibm.bpe.database.CorrelationSetInstanceB: PNUDx)
This is the exception I got when I tried to send an event to an operation. The complete stacktrace of the application is
CNTR0020E: EJB threw an unexpected (non-declared) exception during invocation of method "bpc_invoke" on bean "BeanId(XXXApp#XXXEJB.jar#component.XXXX, null)". Exception data: com.ibm.bpe.database.TomDuplicateKeyException: (com.ibm.bpe.database.CorrelationSetInstanceB: PNUDx) PIID = _PI:9003011b.356b88eb.dfa2c038.977f0038 COID = _CO:9024011b.356a6d43.dfa2c038.977f0020 SIID = _SI:9010011b.356b8a14.dfa2c038.977f0043 processName = XXXX PTID = _PT:9001011b.356a6d43.dfa2c038.977f0016 status = ACTIVE hashCode = null data = null dataLong = null versionId = 0 (com.ibm.bpe.database.CorrelationSetInstanceB: Pnudx) PIID = _PI:9003011b.356b88eb.dfa2c038.977f0038 COID = _CO:9024011b.356a6d43.dfa2c038.977f0020 SIID = _SI:9010011b.356b8a14.dfa2c038.977f0043 processName = XXX PTID = _PT:9001011b.356a6d43.dfa2c038.977f0016 status = ACTIVE hashCode = [B@6bbd689b data = CS-CorrelationSet-Val=Albin1_/ dataLong = null versionId = 0 at com.ibm.bpe.database.TomCacheBase.addOrReplace(TomCacheBase.java:226) at com.ibm.bpe.database.Tom.newCorrelationSetInstanceB(Tom.java:11040)
This error was because the Correlation Sets initiation property was set to Yes. If the initiation property of correlation set to Yes, it will create a new process instance with the correlation value if the receive is invoked. So I believe in our case WPS was trying to create a new process with the same id. That could be the reason for that TomDuplicateKeyException. Anyways this issue got resolved when I changed the initiation property value to join.
If you enjoyed this post, make sure you subscribe to my RSS feed!
java.lang.NoSuchMethodError “main”. This was the exception one of colleague got when he tried to run a simple java application from within Eclipse. The java file that we were trying to execute had a main method and its syntax also matches with what Java wants.
For resolving this issue we tried to execute the file using different options like Run, Run As Java Application…. None of these methods helped us in resolving the issue. Then we thought its some problem with classpath and we couldn’t see anything wrong in our classpath settings.
Then we thought something wrong with our .metadata directory. We just closed our Eclipse and deleted the .metadata directory and started Eclipse again. Eclipse started with no projects. Since these projects were already in we just imported the projects using ‘Import existing project’ option of Eclipse. This time when we run the program, Eclipse was able to find the main method without any issues.
Yes there was something wrong in his .metadata directory and I still don’t know what it is.
If you enjoyed this post, make sure you subscribe to my RSS feed!
com. ibm. ws. exception. RuntimeError: Unable to initialize the Name Service
0 Comments Published July 14th, 2008 in WebSphereOne more exception stacktrace from me. This time my WebSphere Commerce Test server produced this error. The error is very simple and I just thought of documenting it as there might be some people who still use WCS 5.6.1. The error I got was
[7/15/08 11:30:13:405 IST] 3cfdd9d3 WsServer E WSVR0003E: Server server1 failed to start com.ibm.ws.exception.RuntimeError: Unable to initialize the Name Service at com.ibm.ws.naming.bootstrap.NameServerImpl.start(NameServerImpl.java:462) ........ Caused by: com.ibm.ws.naming.distcos.NameSpaceConstructionException: Unable to start bootstrap server using port 2809. Verify that no servers or other processes are already using the bootstrap server port. Also verify that the bootstrap server is being started with a user ID which has sufficient (e.g., root, Administrator) privileges. at com.ibm.ws.naming.bootstrap.NameServerImpl.startBootstrapService(NameServerImpl.java:736) at com.ibm.ws.naming.bootstrap.NameServerImpl.start(NameServerImpl.java:457) ... 12 more Caused by: org.omg.CORBA.INTERNAL: CREATE_LISTENER_FAILED_4 vmcid: 0x49421000 minor code: 56 completed: No at com.ibm.ws.orbimpl.transport.WSTransport.createListener(WSTransport.java:714) at com.ibm.ws.orbimpl.transport.WSTransport.createListener(WSTransport.java:619)
Unlike other WebSphere exception messages, just by reading the message we can find out why this error occurs. In the exception it clearly tells that ‘ Unable to start bootstrap server using port 2809. Verify that no servers or other processes are already using the bootstrap server port’. Yes that was the problem; I already had a WebSphere server running in my machine (An instance of WebSphere Process Server Test environment.) which is listening to the same port WCS is listening. I was trying to integrate WCS and WPS. When I stopped the WPS server, my WCS test client got started without any issues.
I think the problem is not specific to WCS or WPS any WebSphere based server may face the same problem when there is some port conflict.
If you enjoyed this post, make sure you subscribe to my RSS feed!
Invoke Activity in WID
0 Comments Published July 8th, 2008 in Websphere Process Server / Integration DeveloperInvoke Activity
As the name suggests Invoke activity of WebSphere Process Server or WebSphere Integration Developer is used for invoking services that are not part of a business processes. The Invoke activity would call an operation of another service. These services can be web services, human tasks etc. An Invoke activity needs a reference partner which is associated with an interface. For an Invoke activity we need to specify a reference partner and an operation associated with the reference partner interface. When the Invoke activity is executed, it will invoke the operation specified. If the operation has input or output variables we need to specify the input/output variables also. These variables hold the data that we are receiving from the service or sending to the service.
We can specify a timeout value for an Invoke activity. The timeout associated with the Invoke activity tells when the service will be finished.
If you enjoyed this post, make sure you subscribe to my RSS feed!
Configuring TAI in WebSphere Application Server.
Yesterday I posted about how to create a custom Trust Association Interceptor for WAS. Today I will be explaining how to configure the TAI in WAS. In order to configure the TAI in WebSphere Application Server, export the TAI project as a jar file. (Creating and exporting a jar is very easy in RAD. Right click on the project and select Export. From the export wizard window select ‘JAR file’. It will show all the projects available with the one we right clicked as selected. Enter the destination where we want to save our generated jar file and enter a name for the jar file say tai.jar and click on Finish. Our jar file is ready).
Once we completed generation of jar file for TAI, we need to copy the same jar file to WAS_INSTALL_DIR\lib\ext folder. Now we need to make an entry for our TAI inside the admin console. The steps for configuring a TAI in WebSphere are given below.
1. Login to WebSphere admin console.
2. Click on Global Security under Security menu.
3. From the page opened up expand Authentication Mechanisms and click on LTPA
4. The LTPA configuration page opens up. Click on Trust Association links.
5. Select the “Enable trust association” check box. And save the changes.
6. Come back to the same page if you are not there already.
7. Click on Interceptors
8. Click on New
9. Enter the fully qualified name of your TAI inside “Interceptor class name” text box.
10. Save the changes
We are done. Restart the server and our new custom TAI will be ready for use.
If you enjoyed this post, make sure you subscribe to my RSS feed!
If we are implementing an SSO solution using an external authentication provider, we need a Trust Association Interceptor (TAI) to assert the identity to WebSphere Application Server. If our authentication provider is an external tool like WebSEAL or Tivoli Accesses Manager, we need some mechanism to tell WAS that the user is authenticated. So the actual authentication happens in some external tools and by using TAI we would inform WebSphere about the user’s identity.
Today I will explain how to write a custom Trust Association Interceptor (TAI) for WebSphere. Since TAI is used for informing WebSphere Application Server about a user’s identity, first TAI needs to know which user is authenticated. Typically this is done by passing some parameter (like username) to WebSphere Application Server from authentication provider. The TAI which is present in the Application Server reads the parameters from request and returns the username to WAS. WAS then queries the user registry for the existence of the user. However WAS will not validate the password while it queries the user registry.
The first step in developing a custom TAI is to write a class that implements the TrustAssociationInterceptor interface. The TrustAssociationInterceptor interface contains a couple of methods that we need to implement.
The first method that will be executed when calling the TAI is initialize. Any initialization operations can be performed in this method if required. Then TAI would call the isTargetInterceptor method which evaluates the request and returns true if the request is the one that TAI needs to work with.
If the current request is for target interceptor, TAI would call negotiateValidateandEstablishTrust method which actually returns a TAIResult to the WebSphere Application Server. Finally the cleanUp method will be called. The complete code listing for a simple custom Trust Association Interceptor is given below.
The below code which is residing in the WAS expects a parameter named username from authentication provider. If the request contains the username it returns true and creates a trust with WAS.
import java.util.Properties; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.ibm.websphere.security.WebTrustAssociationException; import com.ibm.websphere.security.WebTrustAssociationFailedException; import com.ibm.wsspi.security.tai.TAIResult; import com.ibm.wsspi.security.tai.TrustAssociationInterceptor; /** * A simple custom Trust Association Interceptor. */ public class TestInterceptor implements TrustAssociationInterceptor { /* Validates the incoming request. * * (non-Javadoc) * @see com.ibm.wsspi.security.tai.TrustAssociationInterceptor#isTargetInterceptor(javax.servlet.http.HttpServletRequest) */ public boolean isTargetInterceptor(HttpServletRequest req) throws WebTrustAssociationException { // Lets do some validation on the incoming request String username = req.getParameter("username"); // If we got a username the request for TAI only. if (username != null) return true; return false; } /* (non-Javadoc) * @see com.ibm.wsspi.security.tai.TrustAssociationInterceptor#negotiateValidateandEstablishTrust(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) */ public TAIResult negotiateValidateandEstablishTrust(HttpServletRequest req, HttpServletResponse resp) throws WebTrustAssociationFailedException { // Validate and establish trust with WebSphere Application Server. TAIResult result = null; String username = req.getParameter("username"); // Create the TAIResult with username we got. result = TAIResult.create(HttpServletResponse.SC_OK, username); // return the TAIResult. return result; } /* (non-Javadoc) * @see com.ibm.wsspi.security.tai.TrustAssociationInterceptor#initialize(java.util.Properties) */ public int initialize(Properties arg0) throws WebTrustAssociationFailedException { // The TAI initialization code goes here. return 0; } /* (non-Javadoc) * @see com.ibm.wsspi.security.tai.TrustAssociationInterceptor#getVersion() */ public String getVersion() { // The version of TAI we are using. return "1.0"; } /* (non-Javadoc) * @see com.ibm.wsspi.security.tai.TrustAssociationInterceptor#getType() */ public String getType() { // The type of TAI. return "Custom TAI 1.0"; } /* (non-Javadoc) * @see com.ibm.wsspi.security.tai.TrustAssociationInterceptor#cleanup() */ public void cleanup() { // The TAI clean up code goes here. } }
Configuring a TAI in WAS will be covered in the next post.
If you enjoyed this post, make sure you subscribe to my RSS feed!
Recently I made a post on Language Integrated Query (LINQ) in C#. Since I like that feature very much I did a search for finding some similar libraries for Java. There is one project in sourceforge called JoSQL (http://josql.sourceforge.net/index.html) for querying collections using SQL syntax in Java. I would call JoSQL as LINQ alternative for Java. This JoSQL (SQL for Java Objects) is a small and powerful library which helps us to query Java collections. I just completed a small program for sorting a collection of object. Yes there are some Out of the Box sorting functions available in Collections. But still I used JoSQL for my sorting purpose.
Here is my first JoSQL program.
// Create a list first ArrayList list = new ArrayList(); // Add something to our collection list.add("1"); list.add("3"); list.add("5"); list.add("4"); list.add("2"); // Just print it. System.out.println(list); // Create the query object. Query qry = new Query(); // Our Java Object SQL for getting all the elements that are greater than // 2 and sorted based on the value qry.parse("SELECT * FROM java.lang.String WHERE toString > 2 ORDER BY toString "); // Get the query results. List results = qry.execute(list).getResults(); // Now display the query results for(int index=0; index < results.size(); index++){ System.out.println(results.get(index)); }
I will give a small explanation for the above program. First I am creating an ArrayList and populating the collection with some values. Next I am querying on that collection. The query I used is “SELECT * FROM java.lang.String WHERE toString > 2 ORDER BY toString “. Here just like a normal SQL our JoSQL query also started with a SELECT, then the columns we want(In my case I want all the columns so I used *). Then I have mentioned java.lang.String as my FROM. This is because my Collection contains String objects. Then the WHERE clause. The WHERE clause condition in our case is ‘toString > 2’. Here toString is a method inside java.lang.String class. I wanted some column to apply my condition, so I thought I will use the toString method as my column name. Instead of toString method we can use any method we want. Then the ORDER BY clause. There also I used the toString methods as I did not find any other column to sort
If you enjoyed this post, make sure you subscribe to my RSS feed!
Yesterday while my roommate (Sunil P Thomas) and me were taking about technology and he showed me some piece of code. He is working on .NET. In fact he started in Java and later moved to .NET. He showed me a feature called LINQ (language integrated query) in C#. It was a really cool feature and I believe Java also should adopt this feature. This feature enables programmers to query on object collections just like how we query on databases. LINQ’s syntax is very similar to SQL syntax. For eg:
string[] names = { "Burke", "Connor", "Frank",
"Everett", "Albert", "George",
"Harris", "David" };
IEnumerable query = from s in names
where s.Length == 5
orderby s
select s.ToUpper();
foreach (string item in query)
Console.WriteLine(item);
LINQ can also be applied on XML. What a really cool feature?
If you enjoyed this post, make sure you subscribe to my RSS feed!






