Dear All,
Hey,
I am stuck in a very simple example of JNDI, I have a simple Class file called "Timer". In this file, I have two methods to set the time and to get the time. I have another class file "TimerClient" which, first binds an object of Timer Class to the JNDI and then tries to retrieve the same from JNDI, and finally executing it's two method. The Whole source code is given below:
============= START TIMER.JAVA ================
import java.io.*;
import java.util.*;
public class Timer implements Serializable
{
public Date dateObj=null;
public void setCallTimer(Date dateObj)
{
this.dateObj = dateObj;
}
public Date getCallTimer()
{
return dateObj;
}
}
============= STOP TIMER.JAVA =================
========== START TIMERCLIENT.JAVA =============
import java.io.*;
import java.util.*;
import javax.naming.*;
public class TimerClient implements Serializable
{
public static void main(
String args[])
{
Context ctx = null;
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
env.put(Context.PROVIDER_URL, "t3://localhost:7001");
try
{
ctx = new InitialContext(env);
ctx.rebind("Timer-JNDI", new TimerClient());
Timer RetrievedTimer = (Timer)ctx.lookup("Timer-JNDI");
RetrievedTimer.setCallTimer(new Date(System.currentTimeMillis()));
System.out.println("Time Retrieved from JNDI Tree is : "+RetrievedTimer.getCallTimer());
}
catch(Exception ex)
{
System.out.println("TK Exception Occured while Dealing with JNDI: "+ex);
ex.printStackTrace();
}
finally
{
if(ctx!=null)
{
try
{
ctx.close();
}
catch(Exception ex)
{
System.out.println("Exception While Closing Context: "+ex);
ex.printStackTrace();
}
}
}
}
}
========== STOP TIMERCLIENT.JAVA ==============
========== START EXCEPTION STACK ==============
C:\myapps\Timer>
java TimerClient
TK Exception Occured while Dealing with JNDI: javax.naming.CommunicationExceptio
n [Root exception is java.rmi.UnmarshalException: error unmarshalling arguments;
nested exception is:
java.lang.ClassNotFoundException: TimerClient
Start server side stack trace:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: TimerClient
java.lang.ClassNotFoundException: TimerClient
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:195)
at weblogic.j2ee.ApplicationManager.loadClass(ApplicationManager.java:11
0)
at weblogic.rjvm.MsgAbbrevInputStream.readClassDescriptor(MsgAbbrevInput
Stream.java:211)
at weblogic.common.internal.ChunkedObjectInputStream$NestedObjectInputSt
ream.readClassDescriptor(ChunkedObjectInputStream.java:290)
at java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java
:906)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:366)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1186)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
at weblogic.common.internal.ChunkedObjectInputStream.readObject(ChunkedO
bjectInputStream.java:107)
at weblogic.common.internal.ChunkedObjectInputStream.readObject(ChunkedO
bjectInputStream.java:115)
at weblogic.jndi.internal.RootNamingNode_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:296)
at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerR
ef.java:93)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.jav
a:265)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest
.java:22)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
End server side stack trace
; nested exception is:
java.lang.ClassNotFoundException: TimerClient
Start server side stack trace:
java.lang.ClassNotFoundException: TimerClient
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:195)
at weblogic.j2ee.ApplicationManager.loadClass(ApplicationManager.java:11
0)
at weblogic.rjvm.MsgAbbrevInputStream.readClassDescriptor(MsgAbbrevInput
Stream.java:211)
at weblogic.common.internal.ChunkedObjectInputStream$NestedObjectInputSt
ream.readClassDescriptor(ChunkedObjectInputStream.java:290)
at java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java
:906)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:366)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1186)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
at weblogic.common.internal.ChunkedObjectInputStream.readObject(ChunkedO
bjectInputStream.java:107)
at weblogic.common.internal.ChunkedObjectInputStream.readObject(ChunkedO
bjectInputStream.java:115)
at weblogic.jndi.internal.RootNamingNode_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:296)
at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerR
ef.java:93)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.jav
a:265)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest
.java:22)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
End server side stack trace
]
javax.naming.CommunicationException. Root exception is java.rmi.UnmarshalExcept
ion: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: TimerClient
Start server side stack trace:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: TimerClient
java.lang.ClassNotFoundException: TimerClient
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:195)
at weblogic.j2ee.ApplicationManager.loadClass(ApplicationManager.java:11
0)
at weblogic.rjvm.MsgAbbrevInputStream.readClassDescriptor(MsgAbbrevInput
Stream.java:211)
at weblogic.common.internal.ChunkedObjectInputStream$NestedObjectInputSt
ream.readClassDescriptor(ChunkedObjectInputStream.java:290)
at java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java
:906)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:366)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1186)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
at weblogic.common.internal.ChunkedObjectInputStream.readObject(ChunkedO
bjectInputStream.java:107)
at weblogic.common.internal.ChunkedObjectInputStream.readObject(ChunkedO
bjectInputStream.java:115)
at weblogic.jndi.internal.RootNamingNode_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:296)
at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerR
ef.java:93)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.jav
a:265)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest
.java:22)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
End server side stack trace
; nested exception is:
java.lang.ClassNotFoundException: TimerClient
Start server side stack trace:
java.lang.ClassNotFoundException: TimerClient
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:195)
at weblogic.j2ee.ApplicationManager.loadClass(ApplicationManager.java:11
0)
at weblogic.rjvm.MsgAbbrevInputStream.readClassDescriptor(MsgAbbrevInput
Stream.java:211)
at weblogic.common.internal.ChunkedObjectInputStream$NestedObjectInputSt
ream.readClassDescriptor(ChunkedObjectInputStream.java:290)
at java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java
:906)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:366)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1186)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
at weblogic.common.internal.ChunkedObjectInputStream.readObject(ChunkedO
bjectInputStream.java:107)
at weblogic.common.internal.ChunkedObjectInputStream.readObject(ChunkedO
bjectInputStream.java:115)
at weblogic.jndi.internal.RootNamingNode_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:296)
at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerR
ef.java:93)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.jav
a:265)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest
.java:22)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
End server side stack trace
java.lang.ClassNotFoundException: TimerClient
Start server side stack trace:
java.lang.ClassNotFoundException: TimerClient
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:195)
at weblogic.j2ee.ApplicationManager.loadClass(ApplicationManager.java:11
0)
at weblogic.rjvm.MsgAbbrevInputStream.readClassDescriptor(MsgAbbrevInput
Stream.java:211)
at weblogic.common.internal.ChunkedObjectInputStream$NestedObjectInputSt
ream.readClassDescriptor(ChunkedObjectInputStream.java:290)
at java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java
:906)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:366)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1186)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
at weblogic.common.internal.ChunkedObjectInputStream.readObject(ChunkedO
bjectInputStream.java:107)
at weblogic.common.internal.ChunkedObjectInputStream.readObject(ChunkedO
bjectInputStream.java:115)
at weblogic.jndi.internal.RootNamingNode_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:296)
at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerR
ef.java:93)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.jav
a:265)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest
.java:22)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
End server side stack trace
<<no stack trace available>>
C:\myapps\Timer>
========== STOP EXCEPTION STACK ==============
My Development Environment is:
OS: Windows 2000 Prof Ed
Bea Weblogic Server 6.1
JDK 1.3.1 (Built in Bea)
Can anobody help me with it?
Thanks in advance,
Tualha Khan