This week's giveaway is in the Spring forum.
We're giving away four copies of liveProject: Protecting User Data with Spring Security and OAuth2 and have Laurentiu Spilca on-line!
See this thread for details.
Win a copy of liveProject: Protecting User Data with Spring Security and OAuth2 this week in the Spring forum!

Pratul Chakre

Greenhorn
+ Follow
since Oct 27, 2003
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Pratul Chakre

Hi,

I am trying to create a logging service using Log4J, which uses a JMS Appender with a JDBC Appender that logs messages asynchronously.

And I "have" to that using an EJB. What I am trying to do is encapsulate the logger class in a SSB and expose different methods for the client to access.

In doing so, however, my LocationInfo is lost. Fair enough, since the location info is captured by log4j from the ClassLoader( IMO), which changes for an EJB.

Now, when I am trying to set different parameters in the MDC of the logger object, even that is being retrieved as null.

Could anybody provide any ideas as to what am I missing here? Has anybody tried using a SSB for a logger?

Any pointers would be helpful.

Thanks in Advance.
Pratul
Hi,

Is there any tool which can generate UML from JSPs?

Thanks in Advance.
Pratul
Ok, so I googled and found that Oracle started supporting transaction propagation since OC4J 10.1.3.

But I am still unable to fetch the Trnasaction Manager using JNDI lookup, in the embedded OC4J container of JDeveloper 10.1.3. I have tried the following:

--> java:comp/UserTransaction
--> java:comp/pm/TransactionManager
--> java:comp/env/UserTransaction
--> java:comp/env/pm/UserTransaction.

but to no avail. I was, however, able to retrieve the Transaction Manager context in standalone OC4J container.

Somebody please help as I have practially gone berserk trying all possible combinations for the JNDI names. All I am trying to do is lookup the TransactionManager (or UserTransaction) in the embedded OC4J container of JDev 10.1.3.

Many thanks in anticipation.
Pratul
14 years ago
Hi,

I am trying to check how user transactions work in context of the OC4j Containers.

I have deployed a Stateless Session Bean in the 'standalone' OC4J container of JDev10.1.3. I then exposed the EJB as a WebService.

Next, I wrote a client and am running it in the 'embedded' OC4J container of JDev 10.1.3. From this client, I am trying to invoke the bean methods as WebService calls. Below is my client code:

<code>
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
env.put(Context.PROVIDER_URL, "ormi://localhost:23791/");
env.put(Context.SECURITY_PRINCIPAL, "oc4jadmin");
env.put(Context.SECURITY_CREDENTIALS, "welcome");
Context context = new InitialContext(env);
ut = (UserTransaction) context.lookup("java:comp/UserTransaction");
ut.begin();

// call bean methods.

ut.commit();
</code>
However, I am not able to look up the JNDI Name for UserTransaction in the embedded OC4J. I tried both "java:comp/UserTransaction" and "jta/usertransaction".

Could somebody please let me know how to lookup the User Transaction from the Context in OC4J?

Also, I read somewhere that UserTransactions (begin .. method .. commit/rollback) is not supported in OC4J unless the EJB are running in the same container? Is this true? In which case, my above test scenario would never work, is it?

Many thanks in Advance.

Regards,
Pratul
14 years ago
Thanks a lot, Peer ! Option A is what I would be working on.

Thank you once again.

Regards,
Pratul Chakre
14 years ago
Hi Ranchers,

I created a WebService and used EJB Binding to expose my methods in an EJB. Then on the client side, I used WSIF APIs to invoke the service.

My question is: In having done so, does the invocation happen through Remote EJB Interface or the Local interface (I have both the interfaces since I was just writing some sample code).

If it is invoked via the Remote Interface, then what do I need to do in order to invoke using the local interface (if at all it is possible)? Also, some good reading material on WSIF and its associated bindings would be helpful as well.

Thanks in Advance.
Pratul Chakre
14 years ago
Hi Peer,

Thanks a lot for your response.

However, my requirement is to send error messages specific to a field on the front-end (client), so that they can be displayed directly in front of the erroneous fields. As a result, the error messages need to be tied to an ID (which is the field name) and hence, the use of Hashtable/Hashmap.

In this case, an array of Strings woudl not help as then it would not have any links to the specific fields to which a message belongs to.

Could you please suggest?

Thanks,
Pratul Chakre
14 years ago
Hi,

I have a WebService operation that takes a JavaBean (A) as input parameter. It returns another JavaBean (C) that contains a Hashtable and a third JavaBean (B).

I have two problems employing this:

a) When I created the WSDL for the above operation, the Hashtable got converted to 'Map' (I did not find any XSD for Hashtable). Could somebody please let me know how to declare Hashtables to be used in WSDL?

b) I need to set the key of the Hashtable as one of the user Defined JavaBeans (complex-type). However, doing so and I am not able to retrieve the value on the client side. If I set the key as a Java primitive type (string), then all works well. Would somebody please explain why this would happen?

Can somebody help me out? If required, i can post teh sample code here as well.

Thanks in advance.

Regards,
Pratul Chakre
14 years ago
Thank you Peer! I have just started looking into the docs and it has helped me a lot to understand stuff.



Thank you once again !

Regards,
Pratul Chakre
14 years ago
Hi Ranchers,

I would like to know how the lifecycle of an inherited EJB works.

For example: I have an 'InheritedBean' which is derived from a 'BaseBean'. When the first call to instantiate the 'InheritedBean' is made, the 'BaseBean' is instantiated after which the 'InheritedBean' is instantiated.

Now, if another instance of the 'InheritedBean' is created, will the previous 'BaseBean' instance be re-used for the new inherited bean? Or is it that the 'BaseBean' instance is tied to the previous 'InheritedBean' instance and cannot be re-used until the lifecycle of the inherited bean is completed?

Any help on this would be much appreciated.

Thanks,
Pratul Chakre
Thank you Peer, for your explanations.

I am using WSAD v5.1 to create the WebServices out of an EJB. And I am not able to set the Local Interface of my bean as the SEI for the WebService.

Also, using the IDE to create my WebServices, a whole bunch of files are created (eg: webservices.xml, webservicesclient.xml, etc). Though I know and have understaood what these files individually stand for, what I have not been able to relate is how all these components come together when a client initiates a request to the WebService.

Pardon me if this questions sounds very basic but I am new to the WebServices world. Using IDE, though reduces the work during development time, it really has not helped me to understand the concept of WebServices as a whole and the exact path of execution when a client calls a WebService using SOAP/HTTP.

Any pointers in this directions would be of great help (books, documents, etc).

Thanks in adavnce.
Pratul Chakre
14 years ago
Hi,

I created a WSDL for an EJB, for it to be used as a WebService. I used the SOAP/HTTP protocol.

Now, what I understand ( I am a newbie to WebServices), that the endpoint for the WebService is the Remote Interface of the bean. That is, if I have a bean named myPackage.Sample and the various bean classes as:

myPackage.Sample (Remote)
myPackage.SampleHome (Home Intf)
myPackage.SampleBean (Bean)
myPackage.SampleLocal (Local Intf)
myPackage.SampleLocalHome (Local Home)

the WebService would be exposed using the myPackage.Sample remote interface.

What I am trying to understand is whether I can have the WebService exposed over the local interface i.e. myPackage.SampleLocal.

I am trying this to explore that if the client and the WebServices are co-located in the same VM, then what are the different endpoints that can be defined for them to communicate.

Could somebody please help me in this regard? Also, if there are any samples/documentation/books on how this and other WebServices work in general would also be helpful.

Thanks & Regards,
Pratul Chakre
14 years ago
Hi,

Thank you for your responses. Well, I have used the lookup methods in a static utility class, but like I mentioned earlier, I am just trying to explore the inheritance concept w.r.t EJBs.

here's what I tried:

I moved my JNDI lookup methods to the BaseBean. However, I did not expose these methods in my remote interfaces. Hence, even though it would have been possible to instantiate the bean (making it abstract would essentially mean it no longer is EJB), no methods would have been able to be accessed. Then, I created another bean (SampleBean), which extended this BaseBean, so all the methods in BaseBean were available to SampleBean.

However, this scenario did not work for me as I needed to use those lookup methods for locating a bean. So, what I managed to achieve was a Catch-22 situation whereby the methods to lookup the beans were in a bean itself; and to use those methods I had to lookup THAT bean and create an object.

That's when Jeanne's response previous response about how the functionality that is truly intended to be in a superclass made more sense.

So now, I am trying to create a scenario which I can use to explore inheritance in EJBs.

Meanwhile, if you have any sample that you have implemented and can share with me, would be immensely helpful to jump start.

Thanks,
Pratul
Jeanne,

Thank you for your response!

Well, I actually did implement the methods as static in Utility class and used them. But I want to explore the concept of inheritance in EJBs. Do you know of any post/document that explains this in detail?

Also, the intermediate class that you mentioned, is that NOT an EJB but only a standalone class extending javax.ejb.EJBObject?

Just to give you a brief insight of what I am trying to do:

I wrote some generic methods for doing a lookup of the home objects in order to create my bean objects. I wrote the methods as static in a utility class and used them. Now, I want to see if I can move them to another bean (say BaseBean) and then use them. Would you be able to explain further on how can I achieve this?

Thanks,
Pratul
Hi,

I want to club all my common methods (used across different EJBs) in one base EJB, so that I can extend this base EJB to the others and have those methods available for use.

Can somebody throw some light on how this can be achieved?

Thanks in advance.
Pratul