Posts

Invoking EJB deployed on a remote machine

Invoking EJB deployed on a remote machine In case we are calling remote ejb( ejb deployed on remote machines), The JNDI lookup might lookup like, Properties env = new Properties(); env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); env.put(Context.PROVIDER_URL, "XX.XXX.XX.XX:1099"); env.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces"); Context ctx = new InitialContext(env); If we are calling local ejb then we can simply create InitialContext without any parameters. Like, Context ctx = new InitialContext();

USE OF EJB-LINK

What is ejb-ref:: ejb-link?? The ejb-link element is used in the ejb-ref or ejb-local-ref elements to specify that an EJB reference is linked to an enterprise bean. The path name is relative to the war file containing the web application that is referencing the enterprise bean. This allows multiple enterprise beans with the same ejb-name to be uniquely identified. ejb-link is used so that servlets from the same application unit can refer ejb. If we specify then we don’t need to specify any thing in application server specific web.xml file(incase of jboss jboss-web.xml file)

Configuring JMS with JBOSS 4.0.2

The following documents illustrate steps to configure Jboss with JMS 1) Installing Jboss messaging with Jboss 4.0.2 a. Get the Jboss messaging software from http://www.jboss.org/jbossmessaging/downloads/ b. Set up JBOSS_HOME and ANT_HOME c. Unzip the messaging software to local directory d. Open Command Prompt e. Go to util directory( cd util) f. execute the command ant -f release-admin.xml, The installation script will create a $JBOSS_HOME/server/messaging configuration g. Create a new Jboss Server instance in Eclipse using this configuration h. Example, Name:EJB_Jboss_JMS i. Jboss Home::C:\DevWorld\SDE\jboss-4.0.2 j. Server Configuration: messaging k. Start the Server from Eclipse l. The default installation comes with the following pre configured destinations defined in (destination-service.xml) testTopic, securedTopic, testDurableTopic, testQueue, A,B,C etc. m. Test the instal...

Difference between volatile and synchronized

volatile is a field modifier, while synchronized modifies code blocks and methods. So we can specify three variations of a simple accessor using those two keywords: int i1; int geti1() {return i1;} volatile int i2; int geti2() {return i2;} int i3; synchronized int geti3() {return i3;} geti1() accesses the value currently stored in i1 in the current thread . Threads can have local copies of variables, and the data does not have to be the same as the data held in other threads. In particular, another thread may have updated i1 in it's thread, but the value in the current thread could be different from that updated value. In fact Java has the idea of a "main" memory, and this is the memory that holds the current "correct" value for variables. Threads can have their own copy of data for variables, and the thread copy can be different from the "main" memory. So in fact, it is possible for the "main...

How To Change Port Of Jboss

Image
With default configurations, JBoss listens on port 8080 for web connections. But this can be changed easily as this port is defined in an configuration xml file. This is how port 8080 is changed on JBoss 4. 1. Goto the deploy folder of the server instance you use. 2. Goto the jbossweb-tomcat55.sar inside that deploy folder. 3. Find the file named server.xml inside that folder. (tomcat service file). Look for the HTTP Connector section inside the server.xml where 8080 configuration is available. Change the port value to what ever the required port number. Connector port= "8080" address="${jboss.bind.address}" maxThreads="250" strategy="ms" maxHttpHeaderSize="8192" emptySessionPath="true" enableLookups="false" redirectPort="8443" acceptCount="100" connectionTimeout="20000" disableUploadTimeout="true"

What is the difference between an application server and a Web server

A Web server exclusively handles HTTP requests, whereas an application server serves business logic to application programs through any number of protocols. Web server's delegation model is fairly simple. When a request comes into the Web server, the Web server simply passes the request to the program best able to handle it. The Web server doesn't provide any functionality beyond simply providing an environment in which the server-side program can execute and pass back the generated responses. The server-side program usually provides for itself such functions as transaction processing, database connectivity, and messaging. A Web server handles the HTTP protocol. When the Web server receives an HTTP request, it responds with an HTTP response, such as sending back an HTML page. To process a request, a Web server may respond with a static HTML page or image, send a redirect, or delegate the dynamic response generation to some other program such as CGI scrip...

What is Serialization

Serialization is the process of persisting the state of an object. Lets say for example you create a dog object and instantiate all its various members, size, age, height etc. Serialization allows you to 'save' this object persisting all its state. Its kind of like saving anything, this can then be restored at a later date and the object reused. To make a class suitable for serialization the class needs to implement the Serializable interface. Serializable is a marker interface, it doesnot have any methods defined.