aspose file tools*
The moose likes BEA/Weblogic and the fly likes problem in deploying .ear file in weblogic6.1 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "problem in deploying .ear file in weblogic6.1" Watch "problem in deploying .ear file in weblogic6.1" New topic
Author

problem in deploying .ear file in weblogic6.1

Ashish Agarwal
Ranch Hand

Joined: Dec 02, 2000
Posts: 36
I m having a JSP file which calls a method of a session bean. How do I create the .ear file. Please give the detail procedure from the scratch. I tried this according to the doc. But still I m not able to deploy it. Any help is most welcome. Waiting for reply.
regards
Rajesh
Marcos Maia
Ranch Hand

Joined: Jan 06, 2001
Posts: 977
Hi,
First you have to create a war file for your jsp and web files, then create a jar file for your ejb, and then you�re gonna be able to build the ear file with war and jar inside.
Ashish Agarwal
Ranch Hand

Joined: Dec 02, 2000
Posts: 36
Thanx for ur reply.
I tried that way, but still the same problem.
Let me explain u in detail what I have done.
creating jar:
I have 3 class files as following:
Square.class - Bean class which implements SessionBean. It has a method square() which returns the square of the passed integer.
SquareHome.class - Home interface
SquareRemote.class - Remote interface.
I created a temporary folder named "a". Inside this I created a folder "META-INF". I put these 3 classes inside "a". Then on command prompt I went to the folder "a" ("d:\a>"). I ran the tool
"java weblogic.ant.taskdefs.ejb20.DDInit ." to generate ejb-jar.xml and weblogic-ejb-jar.xml. Then I created the jar file by running
"jar -cvf sqjar.jar .".
creating war:
I created a temporary folder named "aa". Inside this I created a folder "WEB-INF". Inside WEB-INF I created a folder "classes". I put SquareHome.class and SquareRemote.class inside classes folder. I put the jsp file "sqr.jsp" inside "aa". Then on command prompt I went to the folder "a" ("d:\aa>"). I ran the tool
"java weblogic.ant.taskdefs.war.DDInit ." to generate web.xml and weblogic.xml. Then I created the war file by running
"jar -cvf sqwar.war .".
creating ear:
I created a temporary folder named "aaa". Inside this I created a folder "META-INF". I put the "sqjar.jar" and "sqwar.war" inside "aaa". Then on command prompt I went to the folder "a" ("d:\aaa>"). I ran the tool
"java weblogic.ant.taskdefs.ear.DDInit ." to generate application.xml. Then I created the ear file by running
"jar -cvf sqear.ear .".
sqr.jsp content:

<%@ page language="java" import="java.sql.*,java.util.*,javax.naming.*;" session="true" isThreadSafe="true" contentType="text/html" %>
<HTML>
<HEAD>
<title>Squaring a number</title>
</HEAD>
<BODY bgcolor=#ddeeff>
<%
try{
Properties h = new Properties();
h.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
h.put(Context.PROVIDER_URL, "t3://localhost:7001");
Context initial = new InitialContext(h);
Object objref = initial.lookup("SQ2");
SquareHome home =(SquareHome)PortableRemoteObject.narrow(objref,SquareHome.class);
SquareRemote s = home.create();
System.out.println("After squaring : "+s.square(Integer.parseInt(4));


}catch(Exception e){out.println("Exception ::"+e.toString());}
%>
</BODY>
</HTML>
In the lookup method I have passed the JNDI-NAME that is provided in the tag <jndi-name> in weblogic-ejb-jar.xml.
In application.xml the <context-root> tag contains the value "sqwar".
When I run the jsp by the url "http://localhost:7001/sqwar/sqr.jsp" it gives "cannot resolve symbol" for SquareHome and SquareRemote.
Please tell me what is wrong in the above deployment process. I tried the other way by not putting SquareHome.class and SquareRemote.class inside classes folder while creating the war file. Still the same problem.
Waiting for reply.
regards
Rajesh
Marcos Maia
Ranch Hand

Joined: Jan 06, 2001
Posts: 977
Hi,
Looks like everithing is ok with your deployment process, and you really don�t need to package the ejb interfaces in the war file(if you build an ear file) because the way weblogic classloader works.
If you still have problems with it feel free to drop me an email at: mmaia@awa.com.br and atach the files, I�ll take a look for you.
Tualha Khan
Ranch Hand

Joined: Nov 22, 2000
Posts: 287
I don't know, whether I am right or wrong, but what about ejb-jar.xml and weblogic-ejb-jar.xml Descriptor files?? Are they not reqiured??
Be,
Tualha Khan


SCJP2, BEA WLS 6.0, DB2 UDB 7.1
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem in deploying .ear file in weblogic6.1