Monday, 4 May 2009

4-How to Develop Bean-Managed-Persistence Entity Beans

After this point I guess I began to get:
[java] JVM args ignored when same JVM is used.
[java] Starting Client . . .
[java] Looking up the student home via JNDI.
[java] Finding the total number of students using getTotalNumberOfStudents
method
[java] java.rmi.RemoteException: EJB Exception: ; nested exception is:
[java] javax.ejb.EJBException: ejbHomeGetTotalNumberOfStudents:NamingEx
ception:While trying to lookup 'jdbc.styejbDB' didn't find subcontext 'jdbc'. Re
solved ''
[java] at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:
234)…

Clearly, I was getting a NamingException, unfortunately it does not look that clear when you first meet it.
At this point, tinptB’s example uses a different example than MySQL and also he loses his interest as the brevity increases.

In order to be sure that the DAO and EJB parts work, I put almost everything into comments except
public int findTotalNumberOfStudents()
throws StudentDAOSysException {
int total = 111;
….
Return total;

I worked. The program printed the total number of students. So, EJB and DAO part was working. Then, the problem could be in data source definitions. I played with them with some minor improvement with no major results. I also scanned the internet: An outline can be found in entity bean research blog:
The difference of resource-env-ref to resource-ref caused me to use resource-ref instead, which is different from EJB in 21 Days, but I am not sure it matters. Material about deployment descriptors, and then the importance of JNDI name, the difference of application-client.xml and weblogic-application.xml with web client applications,
Then I came to config.xml file of WebLogic and how to declare a JDBC data source with them. Unfortunately, I could not succeed, and solve the JNDı name upto this point. I guess, I was doing some mistake by doing things by hand rather than using tools. My problem is, the WebLogic Console does not work on my machine. So, once more I moved towards WLST, I found out that I was using JYTHON when deploying my applications and played with PYTHON. Finally, I found the solution in
http://www.slideshare.net/