padmshree Patil

Ranch Hand
+ Follow
since Dec 18, 2000
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 padmshree Patil

Hi,
Thanks a lot for your quick response.
I tried with rmi//localhost:1099...
It's working now. I am all set to study further chapters.
Thanks,
Padmashree
HI,
I am learning RMI from Sun site. I am trying to do Calculator example but getting error.I think there is something I am missing in naming statement.Please help me out.
Here is code,
* Definition of Remote Service (Interface) **/
public interface Calculator extends java.rmi.Remote {
public long add(long a, long b)
throws java.rmi.RemoteException;
public long sub(long a, long b)
throws java.rmi.RemoteException;
public long mul(long a, long b)
throws java.rmi.RemoteException;
public long div(long a, long b)
throws java.rmi.RemoteException;
}
/** Implemamtation of Remote Service **/
public class CalculatorImpl
extends java.rmi.server.UnicastRemoteObject implements Calculator {
public CalculatorImpl ( ) throws java.rmi.RemoteException {
super();
}
public long add (long a , long b) throws java.rmi.RemoteException {
return a + b;
}
public long sub (long a , long b) throws java.rmi.RemoteException {
return a - b;
}
public long mul(long a , long b) throws java.rmi.RemoteException {
return a * b;
}
public long div (long a , long b) throws java.rmi.RemoteException {
return a / b;
}
}
These two programs working fine.Created skeleton and stub class.
/**
Remote RMI services must be hosted in a server process. The class CalculatorServer is a very simple server that provides the bare essentials for hosting. **/
import java.rmi.Naming;
public class CalculatorServer {
public CalculatorServer () {
try {
Calculator c =new CalculatorImpl();
Naming.rebind("rmi://localhost:1099/CalculatorService", c);
} catch(Exception e){
System.out.println("Troubel !!! " +e.getMessage()) ;
}
}
public static void main(String arg[] ) {
new CalculatorServer ();
}
}
/**
Client program
**/
import java.rmi.Naming;
import java.rmi.RemoteException;
import java.net.MalformedURLException;
import java.rmi.NotBoundException;
public class CalculatorClient {
public static void main (String arg[] ) {
try {
Calculator c =(Calculator) Naming.lookup( "rmi://remotehost/CalculatorService ");
System.out.println( c.sub(4, 3) );
System.out.println( c.add(4, 5) );
System.out.println( c.mul(3, 6) );
System.out.println( c.div(9, 3) );
}catch (MalformedURLException murle) {
System.out.println();
System.out.println "MalformedURLException");
System.out.println(murle);
}
catch (RemoteException re) {
System.out.println();
System.out.println("RemoteException");
System.out.println(re);
}
catch (NotBoundException nbe) {
System.out.println();
System.out.println("NotBoundException")
System.out.println(nbe);
}
catch (java.lang.ArithmeticException ae) {
System.out.println();
System.out.println("java.lang.ArithmeticException");
System.out.println(ae);
}
}
}
I am running RMI system with 3 different console.
1)After >rmiregistry camand .it doesn't open any other window just waits at command promt.
2) when try to run CalculatorServer program it's giving folowing exception error
C:\RMI\Calculator>JAVA CalculatorServer
It also waits at command promt
3)For Client program giving Error as ,
RemoteException
java.rmi.UnknownHostException: Unknown host: remotehost; nested exception is:
java.net.UnknownHostException: remotehost
DO I need to do some classpath settings?I will appreciate your feedback.
Thanks,
Padmashree
Hi,
Thanks Ram.
I tried with >rmic -v1.2 command and Created Stub class.
Now I am getting Exception Error for ClaculatorClient class as,
C:\RMI\Calculator>java CalculatorClient
RemoteException
java.rmi.UnknownHostException: Unknown host: remotehost; nested exception is
java.net.UnknownHostException: remotehost
When I run ClaculatorServer nothing happens.It doesn't give any output just waits at promt.
I am not sure whether Naming statement is correct or not .
Thanks,
Padmashree
22 years ago
HI,
I am learning RMI from Sun site. I am trying to do Calculator example but getting error.I think there is something I am missing in naming statement.Please help me out.
Here is code,
* Definition of Remote Service (Interface) **/
public interface Calculator extends java.rmi.Remote {
public long add(long a, long b)
throws java.rmi.RemoteException;
public long sub(long a, long b)
throws java.rmi.RemoteException;
public long mul(long a, long b)
throws java.rmi.RemoteException;
public long div(long a, long b)
throws java.rmi.RemoteException;
}
/** Implemamtation of Remote Service **/
public class CalculatorImpl
extends java.rmi.server.UnicastRemoteObject implements Calculator {
public CalculatorImpl ( ) throws java.rmi.RemoteException {
super();
}
public long add (long a , long b) throws java.rmi.RemoteException {
return a + b;
}
public long sub (long a , long b) throws java.rmi.RemoteException {
return a - b;
}
public long mul(long a , long b) throws java.rmi.RemoteException {
return a * b;
}
public long div (long a , long b) throws java.rmi.RemoteException {
return a / b;
}
}
These two programs working fine.Created skeleton and stub class.
/**
Remote RMI services must be hosted in a server process. The class CalculatorServer is a very simple server that provides the bare essentials for hosting. **/
import java.rmi.Naming;
public class CalculatorServer {
public CalculatorServer () {
try {
Calculator c =new CalculatorImpl();
Naming.rebind("rmi://localhost:1099/CalculatorService", c);
} catch(Exception e){
System.out.println("Troubel !!! " +e.getMessage()) ;
}
}
public static void main(String arg[] ) {
new CalculatorServer ();
}
}
/**
Client program
**/
import java.rmi.Naming;
import java.rmi.RemoteException;
import java.net.MalformedURLException;
import java.rmi.NotBoundException;
public class CalculatorClient {
public static void main (String arg[] ) {
try {
Calculator c =(Calculator) Naming.lookup( "rmi://remotehost/CalculatorService ");
System.out.println( c.sub(4, 3) );
System.out.println( c.add(4, 5) );
System.out.println( c.mul(3, 6) );
System.out.println( c.div(9, 3) );
}catch (MalformedURLException murle) {
System.out.println();
System.out.println "MalformedURLException");
System.out.println(murle);
}
catch (RemoteException re) {
System.out.println();
System.out.println("RemoteException");
System.out.println(re);
}
catch (NotBoundException nbe) {
System.out.println();
System.out.println("NotBoundException")
System.out.println(nbe);
}
catch (java.lang.ArithmeticException ae) {
System.out.println();
System.out.println("java.lang.ArithmeticException");
System.out.println(ae);
}
}
}
I am running RMI system with 3 different console.
1)After >rmiregistry camand .it doesn't open any other window just hangs at camand promt.
2) when try to run CalculatorServer program it's giving folowing exception error
C:\RMI\Calculator>JAVA CalculatorServer
Troubel !!! RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: CalculatorImpl_Stub
3)For Client program giving Error as ,
RemoteException
java.rmi.UnknownHostException: Unknown host: remotehost; nested exception is:
java.net.UnknownHostException: remotehost
DO I need to do some classpath settings?I will appreciate your feedback.
Thanks,
Padmashree


[This message has been edited by padmshree Patil (edited August 27, 2001).]
22 years ago
Hi All ,
I am preparing for SCJD exam. What�s the approach for SCJD exam?
I don�t have much IT experience. I have done some small projects on Servlet and JSP.
I need to study RMI, socket programming and Swing. Before that I have few doubts.
1)When should I download the assignment?
2)Whether I have to Choose RMI or socket programming implementation method for project or they will specify in the assignmnt?
3)What type of projects they usually give?
I really appreciate your response for my doubts.
Thanks you,
Padmashree
Hi ,
I am preparintg for SCJD exam .
For developer exam Swing is for only GUI or I need to know more ?
What Topics I need to study ?
I haven't used Swing before . can I run Swing programs on JDK 1.2 platform or need to install something else ?
Thanks,
Padmashree
Hi
I cleared SCJP exam. Now I am looking forward to give SCJD exam.
I don't have much exposer to real projects. Is there any site from where I can get all detailed info about exam?
I learnt from certification book that one has to know following topics,
1) RMI
2) object serialization
3)jdbc
4)Swing
5)network protocols
.... etc
can anybody tell me what I have to practice from these topics?
I really appreciate your help.
Thanks,
Padmashree
Hi,
I have set path to javahome. It's strange that if I copy PacakegeTest.java to root dir (c:\)
and then try to compile it works .It also runs.
I just comented package statement.
// package Myprgs.java;
import Myprgs.java.first.*;

class PackageTest{

public static void main(String arg[])
{
System.out.println("Before calling Test funcion");
TestClass tc =new TestClass();
tc.testShow( "Testing from main");
System.out.println("After calling Test funcion");

}
}

same file if I move to c:/Myprgs/java dir ,then uncoment package statement and try to compile it from c:/Myprgs/java dir gives err !!
TestClass.java is in
c:/Myprgs/java/first/ dir
What's wroung with this ???
Thanks,
padmashree
22 years ago
Hi,
I have set path to javahome. It's strange that if I copy PacakegeTest.java to root dir (c:\)
and then try to compile it works .It also runs.
I just comented package statement.
// package Myprgs.java;
import Myprgs.java.first.*;

class PackageTest{

public static void main(String arg[])
{
System.out.println("Before calling Test funcion");
TestClass tc =new TestClass();
tc.testShow( "Testing from main");
System.out.println("After calling Test funcion");

}
}

same file if I move to c:/ Myprgs/java dir ,then try to compile it gives err !!
TestClass.java is in
c:/Myprgs/java/first/ dir
What's wroung with this ???
Thanks,
padmashree
22 years ago
Hi All,
I am facing problem in packaging .
I have file testClass.java as
package java.first;
public class TestClass {
public void testShow(String str)
{ System.out.println (str);
}
}
and PackageTest file as
package MyPrgs.java;
import java.first.*;
public class PackageTest{
public static void main(String arg[])
{
System.out.println("Before calling Test funcion");
TestClass tc =new TestClass();
tc.testShow( "Testing from main");
System.out.println("After calling Test funcion");
}
}
TestClass.java file is compliling .But PackageTest.java file is giving err at
import java.first.*; as package java.first not found.
I do have correct directory structure.
Where am I wroung ?
Thanks
padmashree

22 years ago
Hi All,
I am facing problem in packaging .
I have file testClass.java as

package java.first;
public class TestClass {
public void testShow(String str)
{ System.out.println (str);
}
}
and PackageTest file as
package MyPrgs.java;
import java.first.*;
public class PackageTest{

public static void main(String arg[])
{
System.out.println("Before calling Test funcion");
TestClass tc =new TestClass();
tc.testShow( "Testing from main");
System.out.println("After calling Test funcion");

}
}
TestClass.java file is compliling .But PackageTest.java file is giving err at
import java.first.*; as package java.first not found.
I do have correct directory structure.
Where am I wroung ?
Thanks
padmashree

[This message has been edited by padmshree Patil (edited April 17, 2001).]
22 years ago
Hi all ,
My problem solved. I had given absolute path in request dispatch method so it was giving error.
Thanks,
Padmashree
23 years ago
Hi,
I am trying to deploy project on www.webappcabaret.com site.
So far it's working fine.I am able to redirect from html to html and html to servlet .But when I do from servlet to html file
getting error as below.
It is giving error at
out.println("Before dispatch"+"<BR>");
RequestDispatcher RD =getServletContext().getRequestDispatcher ("http://www.webappcabaret.com/padmashree/Login.html");
RD.forward(req,res);
out.println("After Dispatch");
it prints Before dispatch and then Error :500

Error: 500
Location: /padmashree/Registration
Internal Servlet Error:
java.lang.NullPointerException
at RegForm.doGet(RegForm.java:123)
at RegForm.doPost(RegForm.java:136)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:503)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
at ngasi.b.a.n.a(Unknown Source)
at ezj.b.e.run(Unknown Source)

you also can check at
http://www.webappcabaret.com/padmashree/RegForm.html
I have not used tomcat and Apache server before.Though it's working fine on my PC (with JRUN).
Thanks
Padmashree

23 years ago
Hi
I have mailed usedid and pwd to your emailID:tualhakhan@yahoo.co.in
I willl create another context and try that also.
thanks for all ur help.
Sorry for taking ur valuable time.
thanks
padmshree
23 years ago
Hi ,
Thanks a lot for ur quick response .Really appreciate ur help.
As u said I deleted all other files and started everything from scrach.
uploaded HelloWorldServlet.java and HelloWorldServlet.class files into osaproject/web_inf/classes dir
then edited the web.xml file as
(Wanted to confirm abt <url-pattern> /HelloWorldServlet </url-pattern> tag )

<servlet>
<servlet-name>
HelloWorldServlet
</servlet-name>
<servlet-class>
HelloWorldServlet
</servlet-class>
<load-on-startup>
-454677
</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>
HelloWorldServlet
</servlet-name>
<url-pattern>
/HelloWorldServlet
</url-pattern>
</servlet-mapping>
Then changed the servlet context status to OFF then again ON .
clicked on test url : http://www.webappcabaret.com/osaproject/
Guess what !!! Page can't be displayed Err

I also tried with simple servlet which get request parameter as u said.
but no use .
One more thing , when I open website www.webappcabater.com and enter context name It is not asking for userid and password .it's directly takeing me to file manager page. I thought may this is problem but I can invoke html pages.

thanks
padmashree


[This message has been edited by padmshree Patil (edited March 13, 2001).]
23 years ago