on 07-13-2006 7:20 AM
Hi All,
I'm using MDM Java Connector to get a connection to MDM Repository. I have all the JAR files included and all the references given in the Web Dynpro Application. I get the connection with MDM repository perfectly and perform operations too.
But, the problem is if I run the same application 2-3 times it starts giving error like.."Login Method not executed properly". Does anyone know what could be the possible problem here??
The code I'm using,
//Obtain the initial JNDI context
Context ctx = new InitialContext();
//Perform JDNI lookup to obtain connection factory
IConnectionFactory connectionFactory =(IConnectionFactory)ctx.lookup("deployedAdapters/MDM Factory/shareable/MDM Factory");
//Get Connection Spec to set connection properties
IConnectionSpec spec = ConnectionFactory.getConnectionSpec();
//Set Connection Properties
spec.setPropertyValue("UserName", <username>);
spec.setPropertyValue("Password", <password>);
spec.setPropertyValue("Server", <server>);
spec.setPropertyValue("Port", <por>);
spec.setPropertyValue("RepositoryLanguage", <lang>);
//Get the Connection
IConnection connection = connectionFactory.getConnectionEx(spec);
wdComponentAPI.getMessageManager().reportSuccess("Connection Established");
//Retrieve Native inteface
INative nativeInterface = connection.retrieveNative();
//Get the CatalogData the physical connection
CatalogData catalog = (CatalogData)nativeInterface.getNative(CatalogData.class.getName());
Regards,
Mausam
Hi Mausam,
check whether you close the connection at the end:
connection.close();
Did you have a look at the connector monitor ?
Via Visual Admin -> Services -> Monitoring -> Services -> Connector Service -> ... -> MDM Factory.
Regards
Andreas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Andreas,
Thanks for replying.
Yes, you are right. I didn't close the connection when application exits. I have put it now, but I think the previous connection still has some effects and still I'm not able to connect. Can you tell me, is there any place where I can go and manually free the connection??
One more thing, where should I close the connection in my application...once I get the CatalogData object or when the application exits??
Regards,
Mausam
Hi,
You should close the connection as soon as it is not immediately used by your program any more. This will return the connection back to the connection pool. Typically you react on some user input by opening the connection, doing some operations via the API, close the connection, return the results to the user.
In words and generally speaking: Close connections as often as you open new ones. If your application is "idle" (e.g. not processing any user request) it should not hold a connection open.
Does this make it clear ?
Andreas
Hi Andreas,
Thanks for clearing my doubt.
But the problem is still there. Here is what I'm doing.
I have a Web Dynpro application. In wdDoInit(), I'm opening a connection and getting the data from MDM. Once I finish with fetching data from MDM, I call "connection.close()" method. And it doesn't give any exception.
Now, when I run the same application again, I'm getting the error "Login method has not been successfully called."
I couldnt find any method in IConnection which can show the status of the connection like, isAlive or something. And even in VA Monitoring I can see that connection is still not broken. (I'm looking into "Used Managed Connection number")
So, is there any way out of this??
Thanks and Regards,
Mausam
Hi Mausam,
first of all: Are you sure that you have the latest connector and mdm4j sda deployed ?
If yes, please try
connection.close();
connection = null;
catalog = null;
and try again. Remember: You must not call CatalogData.Logout() !
Does "Free managed connections number" increase from an initial 0 to at least 1 during program execution ?
(Remember to use "Update" in the right mouse button menue)
How does "Used managed connections number" change in detail ?
I you'd post more of your coding in wdDoInit, I could possibly investigate further.
Regards
Andreas
Hi,
What is the SCA file to depoly and refer in dev time for the clasees like
com.sapportals.connector.connection.IConnection;
com.sapportals.connector.connection.IConnectionFactory;
com.sapportals.connector.connection.IConnectionSpec;
com.sapportals.connector.connection.INative;
Please help me.
thanks
Hari
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.