30, ఏప్రిల్ 2012, సోమవారం

JEE WEBLOGIC SERVER CONFIGURATION ,JNDI,APACHE TOMCAT PRELIMANARIES AND MICROPROCESSOR CONCEPTS ILLUSTRATIONS


Professor   Ram A Dayinaboyina
JNDI


here is a picture which will show the concept of JNDI in JEE
Note: JNDI API can be used to access the Directory servers. The directory servers like weblogic,
Web Sphere, oracle application server, jboss, etc.. Provides several facilities. One of the facility provided by these servers is Directory service.
                All the above servers are developed in java language and supports J2EE technologies like servlet /JSP,EJB,JMS etc.. These servers are also called as J2EE servers.
Procedure for setting up weblogic server:
1.        Choose windows Start àAll  programs à BEA Weblogic platformàConfiguration WizardàClick on next.
àClick on next. --> Click on next.
2.        In this provide the username and password and click on the next button.
3.        Click on next.
4.        Provide configuration-name(Domain name) and click on create button.
Note: When the create button is pressed the directory with the name (domain name) will be created under the c:\bea\user_projects\domains\directory and several files will be copied
5.        Click on done.
Procedure to start weblogic server:
1.        Using the cd command move to the directory created by configuration wizard
2.        run startWeblogic.cmd
Procedure for using weblogic console:
1.        Open the browser
2.        Use the url http://localhost:7001/console
3.        Provide the username and password and click on sign in button
In order to see the content of Weblogic directory service:
1.        Choose domainnameàserverà myserver and right click on myserver to get a popup menu.
2.        Click on view JNDI tree.
A java application using jndi api must get the reference of InitialContext object to deal with the directory server.
Note : Getting the reference of IC is equivalent to establishing the connection with JDBC.
In order to get the reference of the IC a set of properties must be used.
Note: We can get the details of the properties from the manuals
Jndi.properties
java.naming.security.principal=ramu
java.naming.security.credentials=dayinaboyina
java.naming.provider.url=t3://localhost:7001
java.naming.Factory.initial=weblogic.jndi.WLInitialContextFactory

JAPP.javaimport javax.naming.*;
import java.io.*;
import java.util.*;
class JApp
{
                public static void main(String ars[]) throws Exception
                {
                                FileInputStream fis=new FileInputStream("jndi.properties");
                                Properties props=new Properties();
                                props.load(fis);
                                Context ic=new InitialContext(props);
                                System.out.println("..........got Ic......");  
                }
}
àWe can use the above code to deal with directory services of other server like JBOSS, Websphere etc.
è  We can create the subcontexts  the InitialContext object by using the following code.
import javax.naming.*;
import java.io.*;
import java.util.*;
class BatchDemo
{
                public static void main(String ars[]) throws Exception
                {
                                FileInputStream fis=new FileInputStream("jndi.properties");
                                Properties props=new Properties();
                                props.load(fis);
                                Context ic=new InitialContext(props);
                                System.out.println("..........got Ic......");  
                                ic.createSubcontext("mbatch");              
                                ic.createSubcontext("abatch");
                                ic.createSubcontext("mbatch/malestudent");
                                ic.createsubContext("mbatch/femalestudent");
                }
}
è  We can manage  the data by using the directory servers( store, retrieve, remove, modify) i.e directory is similar to the database server but directory does not support SQL commands.
è  destroySubcontext method can be used to remove the subcontext.
Ic.destroySubcontext(“abatch”);
Ic.destorySubcontext(“mbatch/malestudent”);
è  While storing an object under a context in a directory server, we must give a name to the object. Giving the name to the object is called as binding the name to the object.
è  Serializable java objects can be stored in a directory server.
è  By using the bind method serializable java objects can be stored under a context.
Integer o1=new Integer(100);
Float  o2=new Float(200.22f);
Double o3=new Double(300.22);
String o4=new String(“Ramu/crl”);
Ic.bind(“none”,o1);
Ic.bind(“ntwo”,o2);
Ic.bind(“nthree”,o3);
Ic.bind(“nfour”,o4);
è  To remove the bound object we can use unbind()
Ic.unbind(“none”);
Ic.unbind(“ntwo”);
è  Rebind method can be used to replace the existing object with a new object
Integer o1=new Integer(100);
Ic.bind(“xxxx”,o1);
Float o2=new Float(1000.11f);
Ic.rebind(“xxxx”,o2);




import java.io.*;
import java.sql.*;
class ramu
{
                public static void main(String s[])  throws Exception
                {
                                   //general method-1
                                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                                Connection con=DriverManager.getConnection("Jdbc:Odbc:ravi");
                                  //method-2

                                  Statement st=con.createStatement();
                                ResultSet rs=st.executeQuery("select * from ram");
                                while(rs.next())
                                {
/*for(int i=1;i<=3;i++) //the index must start from the 1 only generally people are facing trouble by putting the value for index '0'
                                                {
                                                                Object o=rs.getObject(i);
                                                                System.out.println("result:"+o);

                                                }*/




// 2nd method this is the polished way of writing CODE to retrive  the data from the database
System.out.println(rs.getInt(1));
System.out.println(rs.getString(2));
System.out.println(rs.getInt(3));
System.out.print("\n");
                                }
}// end of main()
} // end of class






From My class room discussions in jan-2008
8086 up programming                      
Loading of the Tasm software   c:\tasm\set it environment variables ->my computer

Writing the sample program
Write a program for addition of 2 8bit numbers
DS|CS|SS|ES     these all are called as assemblies directories (for defineing these directories the order also same as in the previous line mentioned otherwise the program will not work even though no errors in the program)
In this programming we are using 8086 micro processor it doesn’t have any internal memory but it uses (or it supports) external memory for 1GB
It is having 20 address lines 
Model small here which memory model you are using
Here are generally 4 models small, medium, compact, large
Small 1CS,1DS 
Medium N CS, 1DS
Compact, 1 CS, NDS
Large N CS, NDS
in any program for loading of data for the program Data Segment and for the source code Code Segment  for each segment by default 64KB if any segment exceeds then it extends for next one more 64Kb extra segment
Total 16(64kbs for each segment 4blocks of 64kbs)
Why we are doing segmentation because to avoid memory wastage
Data
Code
Stack
Extra segment (optational)
Org 2000h our program which location to load beginning address of our program
Cec proc (it indicates start of the sub function i.e. procedure) near (here near means single segment, far means the previous one extension)
Mov Al,06Hdata in (hexa decimal)   here we are having 4 types of registers for arithmetic
They are AX accumulator register
Bx base register
Cx constant register
Dx debug register
Generally we represent data in BCD number format which is 4digit number   for example you want to submit data 8 in the form of 08= 0000  1000(If give 8 1000 only 4bits what about the remaining 4bits )
And one more example here both supplied data should be same for ex
06(this is 3bit ),33(this is 6bit so the input data is not matching to avoid we put before 0
Mov Bl,05h data
Add Al,Bl
Hlt for halting of the program if reach this line then the program is over, here result will get
The above also comes under interrupts section INT 03h,21 are generally using but we are having 256 interrupts
Cec(instead of cec you mention any code or name like x,or ramu…) endp   it indicates the end of the procedure
end cec    here we are closing whole program and segments everything total close in c like main function

Running of the program
We will do the compilation 2 ways tasm turbo assembler, or masm Microsoft assembler
Step: 1 compilations of the program, while compiling source -> machine language
Tasm  filename.asm  ex:-tasm add.asm  here o/p you will get add.obj
Now any error you want to edit ex: - edit add.asm
Step2:- linking stage here you give the I/p the above .obj file

Tlink filename.obj   for this command you will get .exe file
Step 3:-
Debug filename.exe  ex: - add.exe
Now it will ask -rip (register instruction pointer) give the starting address    to exe next instruction you have to give starting address of the program (for ex: - 2000 or 3000) next‘t’   after execute entatire program exit from that ‘q’

Set path=where the java folder is loaded
The below information you should kept in the my computer-advanced - environment variables-take new variable
Variable name JAVA_HOME
Value                 C:\Program Files\Java\jdk1.6.0_05

D:\tom6>cd bin

D:\tom6\bin>startup
Using CATALINA_BASE:   D:\tom6
Using CATALINA_HOME:   D:\tom6
Using CATALINA_TMPDIR: D:\tom6\temp
Using JRE_HOME:        C:\Program Files\Java\jdk1.6.0_05
D:\tom6\bin>shutdown
Using CATALINA_BASE:   D:\tom6
Using CATALINA_HOME:   D:\tom6
Using CATALINA_TMPDIR: D:\tom6\temp
Using JRE_HOME:        C:\Program Files\Java\jdk1.6.0_05

IN THIS PICTURE I KEPT SCREEN SHOTS OF APACHE TOMCAT SERVER

కామెంట్‌లు లేవు:

కామెంట్‌ను పోస్ట్ చేయండి