soudamini.s shirkhedkar

Greenhorn
+ Follow
since Nov 29, 2005
Merit badge: grant badges
For More
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 soudamini.s shirkhedkar

Thanks for your help. Will try doing it this way.

Best,
Hi all,

I want to write a java program/use a protocol to synchonise cache on the three servers that we use in production.
I want the solution work in this way:
if any change occurs in the data of one server cache, it should broadcast the change to the remaining two servers. Depending upon the state these servers have their cache in, caches should be updated.

I did some google on this and found out that there is a protocol Server Cache Synchonisation Protocol- SCSP RFC 2334. At this point, I am not very sure as to how this can be used. I dont have any backgroung in Internet Engineering so I am at a slight disadvantage.
What other options do I have? Can I use IP Multicasting for this purpose? Can I use any class/es from java.net?
Please help. Thanks in advance for replying.
Pls help me!!! I am stuck at this and want to make this work!!!
Thanks!
I have installed netbeans IDE 5.0 Beta version on my home computer(XP Professional).
It comes bundled with Sun Application Server. In the tutorials section, there is a quick start guide for developing Enterprise Applications. The link is,
quickstartguide
http://www.netbeans.org/kb/41/quickstart-j2ee.html
When I try to start the sun app server, I get following exceptions:

javax.naming.NameNotFoundException: No object bound to name java:comp/env/ejb/CustomerFacade
at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:668)
at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:132)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:288)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at web.ServiceLocator.lookup(ServiceLocator.java:39)
at web.ServiceLocator.getRemoteHome(ServiceLocator.java:59)
at web.CustomerDetail.lookupCustomerFacade(CustomerDetail.java:96)
at web.CustomerDetail.processRequest(CustomerDetail.java:42)
at web.CustomerDetail.doGet(CustomerDetail.java:68)............

[#|2006-01-31T16:48:21.806-0500|SEVERE|sun-appserver-pe8.1_02|javax.enterprise.system.container.web|_ThreadID=15;|StandardWrapperValve[CustomerDetail]: Servlet.service() for servlet CustomerDetail threw exception
java.lang.RuntimeException: javax.naming.NameNotFoundException: No object bound to name java:comp/env/ejb/CustomerFacade
at web.CustomerDetail.lookupCustomerFacade(CustomerDetail.java:98)
at web.CustomerDetail.processRequest(CustomerDetail.java:42)
at web.CustomerDetail.doGet(CustomerDetail.java:68)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:747)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)...........

In spite of these, I finally see the line,"[#|2006-01-31T19:54:22.254-0500|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.core|_ThreadID=10;|Application server startup complete.|#]"
I tried to follow exact same steps as given in the tutorial to deploy the sample application.
I can see the servlet for customer information in my browser window but when I enter the customer number to extract its information from the database, application crashes and I get following exception:

java.lang.RuntimeException: javax.naming.NameNotFoundException: No object bound to name java:comp/env/ejb/CustomerFacade
web.CustomerDetail.lookupCustomerFacade(CustomerDetail.java:99)
web.CustomerDetail.processRequest(CustomerDetail.java:42)
web.CustomerDetail.doGet(CustomerDetail.java:69)
javax.servlet.http.HttpServlet.service(HttpServlet.java:747)
javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)
java.security.AccessController.doPrivileged(Native Method)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)

My questions are:
1 Has Sun App server started properly?
2 Whats wrong with my deployment, why am I getting exception when I try to give customer number?

Please help.This thing is bugging me for many days now. I want to get this running.
I am not very sure what exactly happens but my understanding is:

If there are several threads wishing to use the same object and are currently executing wait() because some other thread has control of the monitor and hence it is executing the synchronised code block/method associated with the object:

A call to notify() method wakes up the thread that called wait() method first.If priorities are given to the threads, it can also wake up the thread with highest priority.

A call to notifyAll() wakes up all the threads that are waiting for access. Scheduler will then schedule the next thread to be run depending upon the priorities or the threads might contend upon themselves for access to the monitor.
We can make use of the methods join() and isAlive() in thread class.

boolean isAlive()
This is used to find out whether a thread is alive(still functioning) or terminated.
A parent thread can call this method to find out the excution status of its child threads before terminating itself. It can choose not to terminate itself if any of its child threads are still functioning.

join()
A call to this method invoked on a thread will wait and not return until the thread has completed. A parent thread can use this method to wait for its child thread to complete before continuing. In other words, parent thread waits for its child thread to join it after completion.

All the best!
Answers to these two questions are related to the concept of dynamic method binding and varible shadowing.
As you can see, base class as well as a derived class, both have a method named test() and an integer variable i.These two classes do not have a non-default constructor. So, a default constructor will be specified for each one of them by the compiler.
Now, when an object b is created using,
class2Base b = new class2()
This has reference type of class2Base and object type if class2. a default constructor of class2 will be called when we create an object using new operator. This default constructor will call the default constructor of the parent class as its first line. The object state is now initialized. The next line of code is:
System.out.println(b.i). Variable shadowing is resolved on the basis of reference type, in this case, reference type is class2Base. So, integer i from base class ( which is initialized to 2 ) will be displayed.
Next line is:
b.test(). This has object type of class2, so overriden test method from class2 will be called and hence the output.
Your second question can be explained in a similar manner.
Concepts of variable shadowing and dynamic method binding are very important and it helps if you get it right once and for all.
Hope this helps.
Cheers!!
[ December 01, 2005: Message edited by: soudamini.s shirkhedkar ]
18 years ago
Hi,

There are two types of multitasking:

process based multitasking and
thread based multitasking.

In process based multitasking, two processes run concurrently on an operating system. For example, we can think of a word processor and an excel sheet running at the same time in parallel. These are two different programs that do not share common memory space ( in other words, they have separate data and code ) but they are just running in parallel.

Thread based multitasking is at a finer level than this. Two threads share the same memory space, they can operate on same data and they are usually parts of the same program. They have different execution paths and hence can run concurrently making an efficient use of operating system.

I would suggest to read the Sun Tutorial on threads, its excellent to begin with. When you feel like you have sufficient knowledge of threads, try writing some code on your own, that would give you first-hand experience.

Sun tutorial on threads

This is updated to include concepts from a new release.

All the best.

Soudamini