What are the steps involved in creating a Bean?

Answers were Sorted based on User's Feedback



What are the steps involved in creating a Bean?..

Answer / nirmala

1.bean class shouldimplement the inteface specifying that
the typeof the bean(SB,EB,MDB)
2.which in turn extends javax.ejb.EnterpriseBean
3.extends serializable interface

Is This Answer Correct ?    2 Yes 0 No

What are the steps involved in creating a Bean?..

Answer / kiran

Creating a J2C bean to connect to IMS
After you create IMS™ Java data bindings, you need to
create a Java bean that communicates with IMS through the
J2EE Connector Architecture.
About this task
This Java bean includes a method that submits a request to
IMS to run the IMS transaction. This method uses the Java
data bindings to build the input and output messages for
the transaction. A J2C bean can include more than one
method that runs an IMS transaction, as well as multiple
data bindings for different input and output messages. The
code that is generated for the J2C bean uses the CCI
provided by the IMS TM Resource Adapter to communicate with
IMS.
Procedure
To start the J2C dynamic wizard, from the menu bar, select
File > New > Other > J2C.
Expand the J2C folder, select J2C bean, and click Next.
In the Resource Adapters Selection page, select the version
of the IMS TM Resource Adapter that you want to use. You
can select either IMS Connector for Java (IBM: 10.5.x) or
IMS Connector for Java (IBM: 11.3.0), and click Next.
In the Connection Properties page, select Managed.
Note: There are two options for the way in which
connections are created between the IMS TM Resource
Adapter, as used by your Java bean, and IMS Connect. This
example is not a two-tiered application, so only a managed
connection is applicable.
Managed connections are created by a construct of the J2EE
Connector Architecture called a connection factory and are
managed by the application server. Your Java bean accesses
a connection factory using JNDI (Java Naming and Directory
Interface). Managed connections are recommended. The IMS TM
Resource Adapter and the connection manager of the
application server work together to manage efficiently the
connections by providing connection pooling, reuse, and
persistence.
Non-managed connections are obtained directly through the
IMS resource adapter, without collaboration with the
application server. Non-managed connections are typically
used by two-tiered applications, and are not pooled or
reused. In addition, non-managed socket connections between
the IMS TM Resource Adapter and IMS Connect are not
persistent, incurring the additional overhead of opening
and closing the socket for each use by an application.
On the Connection Properties page, next to the JNDI lookup
name field, click New. This defines a new server instance.
To define a new server instance, the resource adapter you
selected in Step 3, is deployed to the server instance. To
create a server instance in your workspace, complete the
following steps:
In the JNDI Lookup wizard, on the Server instance selection
page, select New.
In the Define a New Server page, select the type of server
you want to create; for example, WebSphere 7.0 Server.
Then, click Next.
In the WebSphere® Server Settings page, accept the defaults.
Click Finish. The resource adapter you selected in Step 3
is deployed to your server instance.
On the Server instance selection page, click Next.
Create and configure a J2C connection factory for the
server instance you created. The J2C Connection Factories
wizard allows you to select a J2C connection factory from
the ones that have been defined for the resource adapter
you selected in Step 3. You can also provide the JNDI
lookup name of a connection factory that does not yet exist
and define it later. To create and configure a J2C
connection factory for your server instance, complete the
following steps:
In the J2C Connection Factory page, enter a JNDI name for
your new connection factory. For example, imsCFac.
Configure your connection factory. For TCP/IP connections
to IMS Connect, at minimum, provide values for the
following fields:
In the Host name: field, enter the TCP/IP host name of the
IMS Connect that your application will use. For example:
MYHOST.MYCOMPANY.COM
In the Port number: field, enter the port number. For
example, 9999.
In the Data store name: field, enter the target IMS data
store. For example, IMSA.
Click Finish. The server instance is started and
initialized.
After you have configured your server instance and your
server has started, the JNDI name of the connection factory
appears in the JNDI Lookup name field. Click Next.
In the J2C Bean Output Properties page, complete the
following steps:
For the Java Project Name, click New.
Select Java project as the project type, and click Next.
In the Create a Java project page, type PhoneBookJ2CBean
for the new Java project name, accept all other defaults,
and then click Finish.
Next to Java Package Name, click New.
In the Java Package page, type sample.ims for the new Java
package name and click Finish.
For the Interface Name, specify PB.
For the Binding Name, accept the default of PBImpl.
Click Next.
To create a method that runs the transaction, use the Java
Methods wizard and complete the following steps:
Click Add to add a Java method to your J2C bean.
In the Add Java Method page, type runPB for the Java method
name, the click Next.
On the Java Method page, click Browse next to the Input
type field.
In the Select a data type window, prime the entry field
with an asterisk (*) to view the available data types.
In the Matching types field, select INPUTMSG and click OK
to use the INPUTMSG data binding for the method, runPB.
Next to the Output type field, click Browse.
In the Select a data type window, prime the entry field
with an asterisk (*) to view the available data types.
In the Matching types field, select OUTPUTMSG and then
click OK to use the OUTPUTMSG data binding for the method,
runPB.
Click Finish.
The Java Methods wizard displays the new method, runPB
(INPUTMSG: OUTPUTMSG) in the list of methods for the Java
bean. Ensure that this method is selected.
In the InteractionSpec properties for 'runPB', specify the
IMSInteractionSpec values. For this example, accept all
defaults, then click Finish.
Results
You now have a J2C bean in project, PhoneBookJ2CBean, that
you can deploy in one or more Java EE applications using
different Java EE resources.
Feedback

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More EJB Interview Questions

What is the use of @ejb annotation?

0 Answers  


How to invoke ejb from java client?

0 Answers  


Can an ejb send asynchronous notifications to its clients?

0 Answers  


can we stop the execution of a method before completion?

0 Answers  


What do you mean by EJB architecture?

0 Answers  






Can i write business logic methods in entitybean?

3 Answers   HCL,


What is pub/sub model?

0 Answers  


What is @resource in java?

0 Answers  


What is ejb in java with example?

0 Answers  


Is it possible to write two EJBs that have different bean classes, but they share same Remote interface and Home interfaces?

1 Answers  


Explain the concept of connection pooling feature of ejb container?

0 Answers  


In my project iam integrating telephone line using some bridge. To connect my project to that telephone line they have give some jar file. Using dat i connected with that.. To handle that event like call attented, call disposed and idle time they have give one event listener class.. I did every thing and this class is alsoo called when a particular event is fired. The only thing is i wanna call EJB from that event listener method.. But the EJB is not getting initated and exception is thrown. This below shownn error is occured only i try to call it from this event listener class. In other places EJB calling is working fine.. javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org/jnp/interfaces/NamingContextFactory] at javax.naming.spi.NamingManager.getInitialContext (NamingManager.java:657) at javax.naming.InitialContext.getDefaultInitCtx (InitialContext.java:247) at javax.naming.InitialContext.init(InitialContext.java:223) at javax.naming.InitialContext.<init> (InitialContext.java:197) at com.kgisl.etrac.desk.servicelocator.ServiceLocator.getInitia lContext(ServiceLocator.java:82) at com.kgisl.etrac.commonUtils.EventListener.getAdministrationE JBRemote(EventListener.java:206) at com.kgisl.etrac.commonUtils.EventListener.CallDispositioned (EventListener.java:65) Caused by: java.lang.ClassNotFoundException: org/jnp/interfaces/NamingContextFactory at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:242) at com.sun.naming.internal.VersionHelper12.loadClass (VersionHelper12.java:42) at javax.naming.spi.NamingManager.getInitialContext (NamingManager.java:654) ... 6 more javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org/jnp/interfaces/NamingContextFactory] at javax.naming.spi.NamingManager.getInitialContext (NamingManager.java:657) at javax.naming.InitialContext.getDefaultInitCtx (InitialContext.java:247) at javax.naming.InitialContext.init(InitialContext.java:223) at javax.naming.InitialContext.<init> (InitialContext.java:197) at com.kgisl.etrac.desk.servicelocator.ServiceLocator.getInitia lContext(ServiceLocator.java:82) at com.kgisl.etrac.commonUtils.EventListener.getAdministrationE JBRemote(EventListener.java:206) at com.kgisl.etrac.commonUtils.EventListener.CallDispositioned (EventListener.java:65) Caused by: java.lang.ClassNotFoundException: org/jnp/interfaces/NamingContextFactory at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:242) at com.sun.naming.internal.VersionHelper12.loadClass (VersionHelper12.java:42) at javax.naming.spi.NamingManager.getInitialContext (NamingManager.java:654) ... 6 more It would be more help full if i get the solution 10x in advance balaji

1 Answers  


Categories