Tuesday, April 07, 2009

Tomcat and servlets

  • Sevlet Package Strucutre
package proto.inmc.fm.servlet;
  • Web Xml Structure
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
   version="2.5"> 
  
    inmcservlet
    proto.inmc.fm.servlet.inmcservlet
  
  
    inmcservlet
     /servlet/inmcservlet2
    

  • Deploy dir in Tomcat
D:\Program Files\Apache Group\apache-tomcat-6.0.16\apache-tomcat-6.0.16\webapps\inmc\WEB-INF\classes\proto\inmc\fm\servlet
  • Html depl0y place in Tomcat
D:\Program Files\Apache Group\apache-tomcat-6.0.16\apache-tomcat-6.0.16\webapps\docs\inmc.html

  • Html invocation of servlet

form name="myForm" method="GET" action="../inmc/servlet/inmcjnlp"
input type="submit" value="Get Logged in User"

 form

  • Paths
 http://localhost:8090/docs/inmc.html
 http://localhost:8090/docs/inmcjnlp.html

http://localhost:8090/inmc/servlet/inmcservlet2



Friday, January 16, 2009

Jacorb Publish a Corba Servant on well know port without Naming Service

Thanks to the posts from - [jacorb-developer] 'Publish a Servant on well know port'

I was able to do the same. Below are the server and client snippet. This is using Jacorb ORB.

Server code

String[] args3=  { "-DOAPort=4013" };

        java.util.Properties argProps = ObjectUtil.argsToProps( args3 );
               
        Properties props = System.getProperties();

        props.put("org.omg.CORBA.ORBClass", "org.jacorb.orb.ORB");//JACORB
        props.put("org.omg.CORBA.ORBSingletonClass", "org.jacorb.orb.ORBSingleton");
        props.put("org.omg.PortableInterceptor.ORBInitializerClass.bidir_init",
          "org.jacorb.orb.giop.BiDirConnectionInitializer");
        props.put("jacorb.implname","StandardImplName");
        props.putAll( argProps );
        System.setProperties(props);

orb = org.omg.CORBA.ORB.init(args, props);

root_poa = org.omg.PortableServer.POAHelper.narrow( orb.resolve_initial_references("RootPOA")); Any any = orb.create_any(); BidirectionalPolicyValueHelper.insert( any, BOTH.value );

org.omg.CORBA.Policy [] policies = new org.omg.CORBA.Policy[4]; policies[0] =Server.root_poa.create_id_assignment_policy(IdAssignmentPolicyValue.USER_ID); policies[1] =Server.root_poa.create_lifespan_policy(LifespanPolicyValue.PERSISTENT); policies[2] = root_poa.create_implicit_activation_policy( ImplicitActivationPolicyValue.NO_IMPLICIT_ACTIVATION ); policies[3] = orb.create_policy( BIDIRECTIONAL_POLICY_TYPE.value,any );

poa = root_poa.create_POA("NeDetailsPOA",root_poa.the_POAManager(),policies);

//Activate POA manager 
poa.the_POAManager().activate();

//Now register this with the ORB //
org.omg.CORBA.Object obj = poa.servant_to_reference(nedetials);
poa.activate_object_with_id("NeDetails".getBytes(), nedetials);
orb.run();

Client code

Usual Orb routine stuff & then

String location2 = "corbaloc:iiop:127.0.0.1:4013/StandardImplName/NeDetailsPOA/NeDetails"; org.omg.CORBA.Object obj = orb.string_to_object(location2); nedetails = NeDetailsHelper.narrow(obj); proto.inmc.fm.CorbaServer.NE_DETAILS details2 = nedetails.GetNEDetails(1);

Install/Upgrade NVIDI Driver in Ubuntu for CUDA SDK

Most linux distribution comes with the Nouveau https://nouveau.freedesktop.org/wiki/ display driver configured. If you need to use NVIDIA...