Guest_imported
New member
- Jan 1, 1970
- 0
Dear Friends,
I am getting a very serious problem.If possible please help me as soon as possible.My problem is---
1.Whenever I am trying to make the commuicatio between my servlet corba client to server corba via visibroker(4.5).I am getting a org.omg.CORBA.BAD_PARAM error at runtime.
I also know that this error is coming due to narrow method.
But I am not able to rectify it.Below ,I am giving my corba client servlet,server corba ,servant file with the idl.Plzz help me.
//Corba Client Servlet
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class JokeClientServlet1 extends HttpServlet
{
public void init(ServletConfig config) throws ServletException
{
super.init(config);
String str1="10";
String str2="aftab";
String str[]=new String[2];
str[0]=str1;
str[1]=str2;
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(str,null);
try
{
byte[] JokeId= "JokeObject".getBytes();
chapter3.joke manager = chapter3.jokeHelper.bind(orb,"Joke_poa",JokeId);
int R = Integer.parseInt(str1);
long Dollar = manager.convert(R);
String show = manager.welcome(str2);
System.out.println(show);
System.out.println(R+" Us Dollars are Equals to Indian Rupees"+Dollar);
System.out.println("AFTABY"
}
catch(Exception ex)
{
System.out.println(ex);
}
}
public void doPost(HttpServletRequest req,HttpServletResponse res) throws IOException,ServletException
{
try
{
res.setContentType("text/html"
PrintWriter out=res.getWriter();
out.println("<html>"
out.println("<body>"
out.println("hi"
out.println("</body>"
out.println("</html>"
}catch(Exception ex)
{}
}
}
//Corba Server Program
import org.omg.PortableServer.*;
import org.omg.CORBA.*;
public class JokeServer1
{
public static void main(String[] args)
{
try
{
ORB orb = ORB.init(args,null);
POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA");
//Create policies for our persistent POA
org.omg.CORBA.Policy[] policies={rootPOA.create_lifespan_policy(LifespanPolicyValue.PERSISTENT)};
POA myPOA = rootPOA.create_POA("Joke_poa",rootPOA.the_POAManager(),policies);
JokeImpl JokeServant = new JokeImpl();
byte[] JokeId = "JokeObject".getBytes();
myPOA.activate_object_with_id(JokeId,JokeServant);
rootPOA.the_POAManager().activate();
System.out.println(myPOA.servant_to_reference(JokeServant)+" is ready."
orb.run();
}
catch(Exception ex)
{
System.out.println(ex);
}
}
}
//Servant Program
import org.omg.PortableServer.*;
import java.awt.*;
import java.net.URL.*;
import java.sql.*;
import java.util.*;
public class JokeImpl extends chapter3.jokePOA
{
public int convert(int Dollar)
{
int R = Dollar;
int Dollar1=45*R;
return Dollar1;
}
public String welcome(String Name)
{
String joke="Hi "+Name+" Welcome to the USA";
return joke;
}
}
// joke.IDL FILE
module chapter3
{
interface joke
{
long convert (in long Dollars);
string welcome(in string Name);
};
};
I am getting a very serious problem.If possible please help me as soon as possible.My problem is---
1.Whenever I am trying to make the commuicatio between my servlet corba client to server corba via visibroker(4.5).I am getting a org.omg.CORBA.BAD_PARAM error at runtime.
I also know that this error is coming due to narrow method.
But I am not able to rectify it.Below ,I am giving my corba client servlet,server corba ,servant file with the idl.Plzz help me.
//Corba Client Servlet
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class JokeClientServlet1 extends HttpServlet
{
public void init(ServletConfig config) throws ServletException
{
super.init(config);
String str1="10";
String str2="aftab";
String str[]=new String[2];
str[0]=str1;
str[1]=str2;
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(str,null);
try
{
byte[] JokeId= "JokeObject".getBytes();
chapter3.joke manager = chapter3.jokeHelper.bind(orb,"Joke_poa",JokeId);
int R = Integer.parseInt(str1);
long Dollar = manager.convert(R);
String show = manager.welcome(str2);
System.out.println(show);
System.out.println(R+" Us Dollars are Equals to Indian Rupees"+Dollar);
System.out.println("AFTABY"
}
catch(Exception ex)
{
System.out.println(ex);
}
}
public void doPost(HttpServletRequest req,HttpServletResponse res) throws IOException,ServletException
{
try
{
res.setContentType("text/html"
PrintWriter out=res.getWriter();
out.println("<html>"
out.println("<body>"
out.println("hi"
out.println("</body>"
out.println("</html>"
}catch(Exception ex)
{}
}
}
//Corba Server Program
import org.omg.PortableServer.*;
import org.omg.CORBA.*;
public class JokeServer1
{
public static void main(String[] args)
{
try
{
ORB orb = ORB.init(args,null);
POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA");
//Create policies for our persistent POA
org.omg.CORBA.Policy[] policies={rootPOA.create_lifespan_policy(LifespanPolicyValue.PERSISTENT)};
POA myPOA = rootPOA.create_POA("Joke_poa",rootPOA.the_POAManager(),policies);
JokeImpl JokeServant = new JokeImpl();
byte[] JokeId = "JokeObject".getBytes();
myPOA.activate_object_with_id(JokeId,JokeServant);
rootPOA.the_POAManager().activate();
System.out.println(myPOA.servant_to_reference(JokeServant)+" is ready."
orb.run();
}
catch(Exception ex)
{
System.out.println(ex);
}
}
}
//Servant Program
import org.omg.PortableServer.*;
import java.awt.*;
import java.net.URL.*;
import java.sql.*;
import java.util.*;
public class JokeImpl extends chapter3.jokePOA
{
public int convert(int Dollar)
{
int R = Dollar;
int Dollar1=45*R;
return Dollar1;
}
public String welcome(String Name)
{
String joke="Hi "+Name+" Welcome to the USA";
return joke;
}
}
// joke.IDL FILE
module chapter3
{
interface joke
{
long convert (in long Dollars);
string welcome(in string Name);
};
};