Author |
Message
|
venkatesh1976 |
Posted: Mon Dec 02, 2002 7:38 pm Post subject: problem using RMI Locator |
|
|
Apprentice
Joined: 11 Nov 2002 Posts: 26
|
Hi Vennela/John,
I had written a Java Program to connect to the Runtime Client of MQWF.
I had previously used an RMI Locator to connect. It gave an error sayingit could not connect to the domain MQWFAGENT.
Later I changed the settings to LOC_LOCATOR and made it as local bindings and it gave an error saying it could not login to the runtime
client.
I'm giving the sample code written :
/******************************************************/
import com.ibm.workflow.api.*;
import com.ibm.workflow.api.ServicePackage.*;
public class OrderFullfillment {
public static void main(String a[]) {
String userid = "admin";
String passwd = "bluestone";
int locator = Agent.LOC_LOCATOR;
String name = "MQWFAGENT";
Agent agent = new Agent();
try{
int getloc = agent.getLocator();
System.out.println("getting loc...." + locator);
agent.setLocator(locator);
System.out.println("getting loc...." + agent.getName());
agent.setName(name);
ExecutionService service = agent.locate("FMCGRP", "FMCSYS");
System.out.println("getting loc...." + agent.getName());
//with parameters for the user ID and password, the session mode and the user’s
//absence indicator:
service.logon2(userid, passwd, SessionMode.PRESENT_HERE, AbsenceIndicator.LEAVE);
System.out.println("after logon2.....");
//Query the template that the user has
//queryProcessTemplates(java.lang.String filter,
//java.lang.String sortCriteria, java.lang.Integer threshold)
Integer myint = new Integer(1);
ProcessTemplate[] proctempl =
service.queryProcessTemplates("NAME = 'OrderFulfillment'", "NAME", myint);
// Get a handle to the Input Container of the Process Template
ReadWriteContainer inputContainer = proctempl[0].inContainer();
// fill the input container: field CustID
//inputContainer.setString("CustID", of.order.custID);
inputContainer.setString("CustID", "40000");
// fill the input container: fields ProdID, Qty, and Total
inputContainer.setString("OrderedItem.ProdID", "BookX");
inputContainer.setLong("OrderedItem.Qty",32423 );
inputContainer.setLong("OrderedItem.Total", 232423);
// create and start a process instance and pass input container
// the second and third params give sys group names and sys names
ProcessInstance procinst =
proctempl[0].createAndStartInstance2("", "", "", inputContainer, false);
service.logoff();
}catch(Exception e) {
e.printStackTrace();
}
}
}
/******************************************************/
After I connected to the runtime it does not start the instance.
Do guide me on this
Venkat |
|
Back to top |
|
 |
Ratan |
Posted: Mon Dec 02, 2002 9:28 pm Post subject: |
|
|
 Grand Master
Joined: 18 Jul 2002 Posts: 1245
|
Did you get a timeout error?
Run 'fmcautil' from the system you are running the program and check to make sure it can connect to the workflow server.
-Laze |
|
Back to top |
|
 |
vennela |
Posted: Mon Dec 02, 2002 9:57 pm Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
Venkat:
Looks good to me. I was able to execute your program without any trouble. I would suggest you a few changes ...
ExecutionService service = agent.locate("FMCGRP", "FMCSYS");
change it to
ExecutionService service = agent.locate("", "");
Let workflow pick the defaults.
Integer myint = new Integer(1);
ProcessTemplate[] proctempl =
service.queryProcessTemplates("NAME = 'OrderFulfillment'", "NAME", myint);
change this to
Integer myint = new Integer(4);
ProcessTemplate[] proctempl = service.queryProcessTemplates("", "NAME", myint);
System.out.println("No of templates = " + proctempl.length);
This is an adhoc change and you can revert back once you are sure you are getting non-null values to the array.
Also why don't you post the sample output.
Atleast your output should say
getting loc....4
getting loc....
getting loc....MQWFAGENT
after logon2.....
if you don't get logon2 then you are not logged on and if you are not logged on I am sure you won't expect a process template to be started, would you?
---
Venny |
|
Back to top |
|
 |
venkatesh1976 |
Posted: Tue Dec 03, 2002 5:44 am Post subject: FMC_API_ERROR_NOT_LOGGED_ON Error |
|
|
Apprentice
Joined: 11 Nov 2002 Posts: 26
|
Vennela,
After executing the said program when I tried to start the process
instance I got this error :
FMC_API_ERROR_NOT_LOGGED_ON User 'ADMIN' not logged on.
Do let me know why this comes ?? is there anything that has to be done for java settings ?
awaiting ur reply,
venkat |
|
Back to top |
|
 |
venkatesh1976 |
Posted: Tue Dec 03, 2002 6:09 am Post subject: giving path and file info of Java Programs in Buildtime |
|
|
Apprentice
Joined: 11 Nov 2002 Posts: 26
|
vennela,
How do I invoke a Java program from the Buildtime Client.
In the implementations tab, when I go to the programs,
there is one item for Path and File name .
In our previous example we gave exe's.
Now my requirement is to run Java programs from here.
Can I give the path of Java programs,jsp's, EJB's.
If so what is the syntax ?
Do let me know in detail how I can invoke.
Please give more information on how to go about this .
I would |
|
Back to top |
|
 |
jmac |
Posted: Tue Dec 03, 2002 6:36 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Jun 2001 Posts: 3081 Location: EmeriCon, LLC
|
Code: |
String userid = "admin";
. . .
service.logon2(userid, passwd, SessionMode.PRESENT_HERE, AbsenceIndicator.LEAVE);
|
Unless I'm missing something, this cant work... UserID must be uppercased right?
venkatesh1976 wrote
Quote: |
How do I invoke a Java program from the Buildtime Client. |
Simply put java.exe on the "Path and File name" and the class name on the Command Line Parameters
The FDL would look like this...
Code: |
WINNT EXE PATH_AND_FILENAME "java.exe"
PARAMETER "<your class>" |
_________________ John McDonald
RETIRED |
|
Back to top |
|
 |
vennela |
Posted: Tue Dec 03, 2002 7:38 am Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
Quote: |
Unless I'm missing something, this cant work... UserID must be uppercased right?
|
Shouldn't matter -- incase of USER-ID. Other things are case sensitive...
---
Venny |
|
Back to top |
|
 |
jmac |
Posted: Tue Dec 03, 2002 8:07 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Jun 2001 Posts: 3081 Location: EmeriCon, LLC
|
Venny wrote
Quote: |
Shouldn't matter -- incase of USER-ID. Other things are case sensitive... |
Thought you were wrong on this so I tested it out. Turns out we're both right. Looks like JAVA API folds this to uppercase for logon() and logon2(). But C, C++ and VB do not.
And I'm pretty certain at one point JAVA didnt either. However, I don't know when this changed. _________________ John McDonald
RETIRED |
|
Back to top |
|
 |
venkatesh1976 |
Posted: Tue Dec 03, 2002 11:03 pm Post subject: problem while connecting to Runtime |
|
|
Apprentice
Joined: 11 Nov 2002 Posts: 26
|
Vennela/John,
I used a sample java program to connect to the MQWorkflow Server.\
and used an RMI_LOCATOR for it.
In the Server side I got this error :
java.security.AccessControlException: access denied (java.net.SocketPermission 127.0.0.1:1812 accept
,resolve)
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:272)
at java.security.AccessController.checkPermission(AccessController.java:399)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:545)
at java.lang.SecurityManager.checkAccept(SecurityManager.java:1162)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.checkAcceptPermission(TCPTransport.j
ava:567)
at sun.rmi.transport.tcp.TCPTransport.checkAcceptPermission(TCPTransport.java:206)
at sun.rmi.transport.Transport$1.run(Transport.java:151)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:148)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:465)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:706)
at java.lang.Thread.run(Thread.java:484)
and at the client side this error came :
java.beans.PropertyVetoException: FMC38000E Could not locate Agent for Domain rmi://csi5j01/MQWFAGENT
at com.ibm.workflow.api.Agent.failureName(Agent.java:619)
at com.ibm.workflow.api.Agent.setName(Agent.java:417)
at TestProcessClient.main(TestProcessClient.java:20)
Do let me know wy this came. I have used the previous code shown.
Venkat |
|
Back to top |
|
 |
vennela |
Posted: Wed Dec 04, 2002 10:10 pm Post subject: |
|
|
 Jedi Knight
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
|
Comment this line in your code:
agent.setName(name);
I guess the agent name is set during configuration of the RMI agent. Atleast it worked for me when I commented that line. When I say it worked, I could get rid of the error you mentioned and could get past that line of the code. But I don't know how RMI programming or a socket programming is done or how an RMI agent is located.
After I commented out the above line I am getting a null pointer exception further down the line.
Because you want to use RMI, for whatever reason, you should be able to figure out how the agent bean or agent or is located and finally the key is to get a Service object from the agent bean. A service object is retruned at
Service service = agent.locate("", "");
This service object could be null. You are not succesful until you get a non null service object.
That's my understanding correating things with local bindings mode.
Why do you really want to use RMI. Is there any particular reason or you just want to try all the locator policies. If you are just trying to play with the policies I would advise you to forget all the others except JNDI_Locator and LOC Bindings
---
Venny
---
Venny |
|
Back to top |
|
 |
|