I am new to weblogic8.1 and I am not able to call my
ejb example from my client application deployed. Please help me to solve this.
For the stateless bean HelloWorld application, I have created
Hello.java,HelloBean.java and HelloHome.java along with the two decripters.
---------------------------
(1) weblogic-ejb-jar:
----------------------
<!DOCTYPE weblogic-ejb-jar PUBLIC '-//BEA Systems, Inc.//DTD WebLogic 8.1.0 EJB//EN' 'http://www.bea.com/servers/wls810/dtd/weblogic-ejb-jar.dtd'>
<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name>HelloBean2</ejb-name>
<stateless-session-descriptor>
<pool></pool>
<stateless-clustering></stateless-clustering>
</stateless-session-descriptor>
<transaction-descriptor></transaction-descriptor>
<jndi-name>HelloBean2</jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
---------------------------
2) ejb-jar.xml:
----------------------
<!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN' 'http://java.sun.com/dtd/ejb-jar_2_0.dtd'>
<ejb-jar>
<enterprise-beans>
<session>
<ejb-name>HelloBean2</ejb-name>
<home>HelloHome</home>
<remote>Hello</remote>
<ejb-class>HelloBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>HelloBean2</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
----------------
I have created the jar using jar option and created the jar file named Stl.jar.
In the weblogic console in Deployments---> EJB Modules-->Deploy a new EJB Module...
I have deployed the application in
localhost\D:\bea\user_projects\mydomain\myserver\upload\Stl.jar
Now the deployment is success.
----------------
I wrote the
JSP for accessing this
<%@page import="javax.naming.*,java.util.*" %>
<%
Properties h = new Properties();
h.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
h.put(Context.PROVIDER_URL, "t3://localhost:7001");
Context ctx = new InitialContext(h);
Object obj = ctx.lookup("HelloBean2");
HelloHome home = (HelloHome)javax.rmi.PortableRemoteObject.narrow(obj, HelloHome.class);
Hello hello = home.create();
hello.remove();
%>
I also wrote the two deployment decripters for the war file.
------------------------
web.xml
----------
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>HelloClient</display-name>
<
servlet>
<servlet-name>HelloClient</servlet-name>
<jsp-file>HelloClient.jsp</jsp-file>
</servlet>
<login-config><auth-method></auth-method></login-config>
</web-app>
-------------
weblogic.xml
----------
<!DOCTYPE weblogic-web-app PUBLIC "-//BEA Systems, Inc.//DTD Web Application 8.1//EN" "http://www.bea.com/servers/wls810/dtd/weblogic810-web-jar.dtd">
<weblogic-web-app>
</weblogic-web-app>
--------------
I bundled these three in a war file named StlClient.war and installed in weblogic using
deployments-->web application modules-->Deploy a new Web Application Module...
I have uploaded the war file and the deployment was success.
In the configuration the context root shown as
Context Root: /HelloClient
So when I typed
http://localhost:7001/HelloClient/HelloClient.jsp I am getting the following error.
Compilation of 'D:\bea\user_projects\mydomain\.\myserver\.wlnotdelete\extract\myserver_HelloClient_HelloClient\jsp_servlet\__helloclient.java' failed:
--------------------------------------------------------------------------------
D:\bea\user_projects\mydomain\.\myserver\.wlnotdelete\extract\myserver_HelloClient_HelloClient\jsp_servlet\__helloclient.java:137: cannot resolve symbol
probably occurred due to an error in /HelloClient.jsp line 19:
HelloHome home = (HelloHome)javax.rmi.PortableRemoteObject.narrow(obj, HelloHome.class);
D:\bea\user_projects\mydomain\.\myserver\.wlnotdelete\extract\myserver_HelloClient_HelloClient\jsp_servlet\__helloclient.java:137: cannot resolve symbol
probably occurred due to an error in /HelloClient.jsp line 19:
HelloHome home = (HelloHome)javax.rmi.PortableRemoteObject.narrow(obj, HelloHome.class);
D:\bea\user_projects\mydomain\.\myserver\.wlnotdelete\extract\myserver_HelloClient_HelloClient\jsp_servlet\__helloclient.java:137: cannot resolve symbol
probably occurred due to an error in /HelloClient.jsp line 19:
HelloHome home = (HelloHome)javax.rmi.PortableRemoteObject.narrow(obj, HelloHome.class);
D:\bea\user_projects\mydomain\.\myserver\.wlnotdelete\extract\myserver_HelloClient_HelloClient\jsp_servlet\__helloclient.java:140: cannot resolve symbol
probably occurred due to an error in /HelloClient.jsp line 22:
Hello hello = home.create();
--------------------------------------------------------------------------------
Full compiler error(s):
D:\bea\user_projects\mydomain\.\myserver\.wlnotdelete\extract\myserver_HelloClient_HelloClient\jsp_servlet\__helloclient.java:137: cannot resolve symbol
symbol : class HelloHome
location: class jsp_servlet.__helloclient
HelloHome home = (HelloHome)javax.rmi.PortableRemoteObject.narrow(obj, HelloHome.class); //[ /HelloClient.jsp; Line: 19]
^
D:\bea\user_projects\mydomain\.\myserver\.wlnotdelete\extract\myserver_HelloClient_HelloClient\jsp_servlet\__helloclient.java:137: cannot resolve symbol
symbol : class HelloHome
location: class jsp_servlet.__helloclient
HelloHome home = (HelloHome)javax.rmi.PortableRemoteObject.narrow(obj, HelloHome.class); //[ /HelloClient.jsp; Line: 19]
^
D:\bea\user_projects\mydomain\.\myserver\.wlnotdelete\extract\myserver_HelloClient_HelloClient\jsp_servlet\__helloclient.java:137: cannot resolve symbol
symbol : class HelloHome
location: class jsp_servlet.__helloclient
HelloHome home = (HelloHome)javax.rmi.PortableRemoteObject.narrow(obj, HelloHome.class); //[ /HelloClient.jsp; Line: 19]
^
D:\bea\user_projects\mydomain\.\myserver\.wlnotdelete\extract\myserver_HelloClient_HelloClient\jsp_servlet\__helloclient.java:140: cannot resolve symbol
symbol : class Hello
location: class jsp_servlet.__helloclient
Hello hello = home.create(); //[ /HelloClient.jsp; Line: 22]
^
4 errors
Please help.