Win a copy of Pro Spring MVC with WebFlux: Web Development in Spring Framework 5 and Spring Boot 2 this week in the Spring forum!

Bharathi Kongara

Ranch Hand
+ Follow
since Sep 15, 2005
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 Bharathi Kongara

Thank you for the responses. Servlet Filter sounds like a better way as the tracking part is most likely not part of the business logic. So I can just update a context attribute with in a synchronized scope of ServeltContext with in the filter instead of doing it in the servlet itself.
10 years ago
I was asked this question quite a few times as how to keep track of the requests to a particular servlet, so I just want to confirm I got it right. Looks like there are few ways to do it; just want to see what everyone thinks is the best way to do so:

a. Storing a static count variable and incrementing it in each of the doXXX methods (). But how can we make sure that different threads are not incrementing at the same time? On what object, should I have my synchronized context upon?
b. Setup a ServletRequestListener and update a context attribute with the count in there.
c. A variation of b - update the context attribute in each of the doXXX methods in a synchronized context of ServletContext.

Thanks!
10 years ago
Hi All,

We've been encountering an interesting scenario in WebSphere (WAS 6.1). We know the root cause for the problem in question and fixed it, and things have been working fine since then. But what we don't understand is WebSphere's behavior in the scenario. This is what our process does:

1. It is a stateless session bean that uses bean managed transaction.
2. In a nutshell, it starts a transaction, selects a row in Oracle database table for update, do some processing on the retrieved result set, writes to a MQ queue and commits/rollback.
3. Normally the above logic works perfectly as the whole transaction will be completed with in 30-100 millisecs.
4. But recently we introduced some other MDBs into the same JVM as this session bean. These MDBs also read and write to some queues under the same queue connection factory as the session bean. The caveat though is that we've got the queue connection in the ejbCreate and closed it in ejbRemove() as against doing it just for the period needed with in the onMessage somewhere.
And here is the configuration we've setup in WAS:
a. Total transaction lifetime timeout - 120 secs
b. Queue Connection timeout - 1800 secs
c. Queue Connection Pool Maximum Connections - 10
5. When these MDBs and the session beans are all running simultaneously, we believe the MDBs are hogging all the queue connections and the session bean waits forever to get the queue connection.
6. So the scenario we face is that: the session bean starts a transaction, locks the db row for update and tries to get the queue connection. Since there is no available queue connection, it just keeps waiting. Meanwhile after 120 secs, the container times out the transaction. At this point, I would assume the container would roll back the transaction as part of the timeout, but it didn't, continuing to hold the db lock. When the queue connection request finally timed out after 30 mnts, it threw the error that the queue connection cannot be obtained. But it also throws an error that the transaction cannot be rolled back because I try to rollback when the queue connection cannot be obtained. So when I try to rollback, it throws javax.transaction.RollbackException but it still doesn't release the lock on the db row. In fact that lock was not released until we kill the JVM. The WebSphere documentation claims that the transaction will be rolled back when the transaction times out, but I don't understand why it wouldn't release the resources if it had really executed the rollback correctly.

Any ideas or insights?


Bharathi
Hi,

We ran into this issue and have been trying to resolve since yesterday with no luck. I'm wondering if anybody else has encountered this and has any thoughts ...

We are trying to call the methods of the com.ibm.websphere.runtime.ServerName class in a utility class that is packaged into a jar and put onto the JVM classpath in WebSphere 6.1. And we are running into NoClassDefFound errors. So we just did Class.forName("com.ibm.websphere.runtime.ServerName") in that utility class and got the ClassNotFoundException as expected. But when we do the same in a separate utility class that is outside of the classpath, both the forName and the actual method calls work without any problem.

That kind of suggested that the com.ibm.websphere.runtime.ServerName class is not "available"(/loaded) by the time our utility class gets loaded, may be. So we turned on the Verbose Class Loading to see the order in which the classes are loaded when the JVM starts up. But the com.ibm.websphere.runtime.ServerName class is loaded way before our utility class from the jar in the classpath.

So I'm wondering:

Why would it give me a ClassNotFound exception in my utility class (which is put on the classpath) when the log shows that the utility class is already loaded by the time this class starts loading?

Any feedback or thoughts would be greatly appreciated.

Thanks,
Bharathi
With over 4 years of experience in Software Development and been in different roles such as Software Design Engineer, Module Leader, I always look for better ways to perform and encourage the same in others. Being a motivated and focused self-starter, I pursue constant learning on the latest technologies and try to hone my skills.

• Sound experience in Application Design using Object Oriented Analysis and Design (OOAD), Object Oriented Methodologies and good understanding of Software Development Life Cycle.
• Strong background in Core Java.
• Extensive Web Application Development experience using J2EE technologies.
• Sound Knowledge of Data Structures and problem solving skills for designing optimized solutions to complex problems.
• Extensive data modeling using UML.
• Well-versed with multiple operating systems – Windows/Unix/Linux/Solaris.
• Experienced in various Agile Programming Methodologies like Extreme Programming and SCRUM.
• Solid understanding of Design Patterns (Gang of Four and Enterprise)

Please send a private message or email bharathikongara@yahoo.com for resume and more details.

Thanks,
Bharathi
12 years ago
Thank you Rijwan ... congrats on passing the exam!

Do you have any prior experience in Web Services and how do you find the exam? I don't have any experience in Web Services per se though I've experience in J2EE .. thought studying for the exam will help me understand and learn the concepts.

Bharathi
Hello ranchers,

I'm planning to start on SCDJWS in the next couple of months; I've completed SCJP, SCWCD, SCBCD - I understand this exam is a bit different when compared to the earlier ones after going through all your opinions.

After going through different threads in the past few day, these books/notes look like the most popular ones:

RMH's J2EE Web Services
MZ's study guide
WS Basic Profile
Blue Prints

Is the RMH book exam-oriented like HFEJB etc.? If not, are there any books like that?

Please let me know what you think ...

Bharathi
Rajan,

Sorry for my late reply ... caught up in work esp. with my on-and-off schedule during the exam week

While working on EJB's, I didn't follow any book in particular. I've gone through the J2EE and EJB tutorials from Sun and followed some books like "Professional EJB" from Wrox (hope the publisher name is correct), and J2EE Complete Reference for reference purposes. I've learnt mostly by experience and I used to follow java ranch forum for EJB's (not the certification one).

Coming to SCBCD, the only book I've studied is Head First EJB, used spec for reference, and Valentin Crettaz's cheat sheets really helped me in remembering some things for the exam, esp. for ejb-jar.xml. I did the mock exams on ejbcertficate.com, jdiscuss.com and ofcorse, the mock exam from HFEJB. And yes, the 1.5 yrs experience has definitely helped me a lot in preparing for the exam ... I can't imagine taking an exam with out real world experience with a 2 week prep ... it would be very tough for me As you asked, the percentage split would be something like:

HFEJB 80%
Specs 8%
Cheat Sheets 7%
ejcertificate,jdiscuss 5%

Everyone,

Thank you for reading through this long email and thanks for all your support.

Bharathi
14 years ago
Hi,

I've passed the SCBCD exam yesterday with 100%

I've prepared roughly for 2 weeks (and I've got 1.5 yrs experience in EJBs), studied HFEJB once and revised once, have done the HFEJB mock and the mock exams on ejbcertificate and jdiscuss websites.

Some of the questions on the exam are very easy and staight forward. But the ones from Message Driven Beans and EJB-QL are a bit tricky. Read the specs for message driven beans if you can, as I came across a couple of tricky ones on those. EJB-QL questions are very time consuming expecially in the drag n drop flavour.

Thank you so much Kathy and Bert for that wonderful book ... it is so fun reading it and I came across some interesting concepts which I never paid attention while working on EJBs. Thank you ranchers for all those valuable solutions and feedback.

And all the best for all those taking the beta exam (I'm not sure I can do that as I never worked on EJB 3.0)!

Bharathi
14 years ago
Hello ranchers,

I've a question on the exceptions, the client might get as described in page 159 in HFEJB.

I think for the remote client view, the exception need to be "java.rmi.RemoteException" and not "javax.ejb.RemoteException". But it is not mentioned in the errata. Please advise.

Thanks,
Bharathi
Vijay,

I don't think option # 4 is correct b'coz it is too early to access a database in setEntityContext() method. Please refer to page 327 in HFEJB (page 197 corresponds to sessionbean, setSessionContext()) for reference or the spec.

Bharathi
Vijay,

I also agree that the first option is confusing; To avoid confusion, I read it this way "Bean Provider must not provide any constructors with arguments so that the compiler will give the default no-arg constructor or the bean provider himself can do that". And I'm pretty sure that the real exam does not give ambiguous questions like this

Bharathi
Hello ranchers,

I've doubt on the following question from ejcertificate.com. I'm wondering why can't 3 and 4 be correct?! I think 3 is correct b'coz the deployer can always modify the values of the env. entries and option 4 sounds vague b'coz of the word "enterprise bean instances". Experts, please advise!

Which of the following statements regarding an enterprise bean's environment are correct?

1. The container provides the tools that allow the deployer to create and manage the enterprise bean's environment.
2. Enterprise bean instances can modify the values of the environment entries at runtime.
3. The deployer sets and modifies the values of the environment entries by editing the enterprise bean's deployment descriptor.
4. Enterprise bean instances obtain the values of the environment entries from the enterprise bean's deployment descriptor.
5. Enterprise bean instances use the JNDI interfaces to obtain the values of the environment entries.

Answers 1 and 5 are correct.

Answer 2 is incorrect because enterprise bean instances can only read the values of the environment entries at runtime and are not able to modify them. Answers 3 and 4 are incorrect because the deployment descriptor is used to define only the environment entries, as opposed to the values that the enterprise bean expects to be provided at runtime.

Thanks,
Bharathi

Originally posted by John Mathew:
We are on the same page.I am also looking for the answers for SUP exercises after page 497.The PDFs are at:
EJBSharpenA.pdf
EJBSharpenB.pdf
EJBSharpenC.pdf

Thanks
JohnM



Thank you for these PDF links ... please post the links for the answers of SUP after page 497 if you find them!