Forums Register Login

EAR Files?

+Pie Number of slices to send: Send
hi all, Please tel me how to create EAR files combining jar and war files...i have got errors in using that.
+Pie Number of slices to send: Send
 

Abubacker Siddik wrote:hi all, Please tel me how to create EAR files combining jar and war files...i have got errors in using that.


Which method/tool you used ?
+Pie Number of slices to send: Send
... and what are the errors?
+Pie Number of slices to send: Send
actually i explain my package structure first.

D:\abu\webapp\index.jsp
D:\abu\webapp\WEB-INF\web.xml, weblogic.xml
D:\abu\webapp\WEB-INF\classes

D:\abu\createjar\*.class
D:\abu\createjar\META-INF\ejb-jar.xml, weblogic-ejb-jar.xml

This is my folder structure..then i created war and jar files in the respective folders. Then i created another folder called myapplication. The folder structure is like this.

D:\abu\myapplication\myejb.jar, myjsp.war
D:\abu\myapplication\META-INF\application.xml, weblogic-application.xml

Then i created app.ear file and deployed it in weblogic8.1 server. What i get is, jsp compilation error saying that


_________________________________________________________________________________

Compilation of 'C:\DOCUME~1\Admin\LOCALS~1\Temp\jsp_servlet\__index.java' failed: C:\DOCUME~1\Admin\LOCALS~1\Temp\jsp_servlet\__index.java:145: cannot resolve symbol
probably occurred due to an error in /index.jsp line 17:
StatefulSessionHome home = (StatefulSessionHome)ctx.lookup("ejbjsp");

C:\DOCUME~1\Admin\LOCALS~1\Temp\jsp_servlet\__index.java:145: cannot resolve symbol
probably occurred due to an error in /index.jsp line 17:
StatefulSessionHome home = (StatefulSessionHome)ctx.lookup("ejbjsp");

C:\DOCUME~1\Admin\LOCALS~1\Temp\jsp_servlet\__index.java:147: cannot resolve symbol
probably occurred due to an error in /index.jsp line 19:
StatefulSession rem = home.create();

Full compiler error(s):

C:\DOCUME~1\Admin\LOCALS~1\Temp\jsp_servlet\__index.java:145: cannot resolve symbol
symbol : class StatefulSessionHome
location: class jsp_servlet.__index
StatefulSessionHome home = (StatefulSessionHome)ctx.lookup("ejbjsp"); //[ /index.jsp; Line: 17]
^
C:\DOCUME~1\Admin\LOCALS~1\Temp\jsp_servlet\__index.java:145: cannot resolve symbol
symbol : class StatefulSessionHome
location: class jsp_servlet.__index
StatefulSessionHome home = (StatefulSessionHome)ctx.lookup("ejbjsp"); //[ /index.jsp; Line: 17]
^
C:\DOCUME~1\Admin\LOCALS~1\Temp\jsp_servlet\__index.java:147: cannot resolve symbol
symbol : class StatefulSession
location: class jsp_servlet.__index
StatefulSession rem = home.create(); //[ /index.jsp; Line: 19]
^
3 errors

Mon Sep 07 16:52:24 IST 2009

______________________________________________________________________________________________

please help me..thanks
+Pie Number of slices to send: Send
 

Abubacker Siddik wrote:Full compiler error(s):
C:\DOCUME~1\Admin\LOCALS~1\Temp\jsp_servlet\__index.java:145: cannot resolve symbol
symbol : class StatefulSessionHome
location: class jsp_servlet.__index
StatefulSessionHome home = (StatefulSessionHome)ctx.lookup("ejbjsp"); //[ /index.jsp; Line: 17]
^
C:\DOCUME~1\Admin\LOCALS~1\Temp\jsp_servlet\__index.java:145: cannot resolve symbol
symbol : class StatefulSessionHome
location: class jsp_servlet.__index
StatefulSessionHome home = (StatefulSessionHome)ctx.lookup("ejbjsp"); //[ /index.jsp; Line: 17]
^
C:\DOCUME~1\Admin\LOCALS~1\Temp\jsp_servlet\__index.java:147: cannot resolve symbol
symbol : class StatefulSession
location: class jsp_servlet.__index
StatefulSession rem = home.create(); //[ /index.jsp; Line: 19]
^
3 errors


Container is unable to find the class files required, so it may be due to classes are not properly packaged ? What are the EAR contents (structure) ?
+Pie Number of slices to send: Send

Thats what i mentioned in the myapplication folder. It contains war file and jar file and META-INF folder.

I am really confused with this thing.
+Pie Number of slices to send: Send
Abubacker,
myejb.jar -this is an EJB jar? What does it contain? Is it in the manifest of the war file? There's a file in the war's manifest.mf telling it where to look for things.

Also, you might try looking at the startup logs to see if the ejb has started. This will narrow down whether the problem is on the ejb or jsp side.

I hope this is just a toy project. Having Java code (especially EJBs) in a JSP is bad practice.
+Pie Number of slices to send: Send
hi Jeanne,

I am using weblogic8.1 server. i dont have manifest.mf files there. Only ejb-jar.xml and weblogic-ejb-jar.xml. And ya i know this is naive approach to build applications writing ejb code in jsp file. My problem is that i want to deploy an EAR file which successfully runs.

Another doubt persists in my mind is...

EJB gives service components residing on the server side. So once *.jar files are deployed and your service components will reside in server. Any client can go and look for the service component using JNDI Look up name of the component. If this is the case, i write stateless session bean which gives the name of the server if client looked up.. Ok. Now my client writes the lookup code in jsp file (Let it be.. the client is naive).

If my understanding is correct, I should not get the errors mentioned in my earlier replies. Because the errors pose as it depends on the class files that the server runs. Thats puzzling.. Please correct me and give any other way of writing EAR application..

Thanks in advance.
+Pie Number of slices to send: Send
I don't see the answers to my questions in your reply. You'll need to give more information to get an answer.

1) myejb.jar -this is an EJB jar?

2) Also, you might try looking at the startup logs to see if the ejb has started. This will narrow down whether the problem is on the ejb or jsp side.

And WebLogic does support a manifest.
+Pie Number of slices to send: Send
To your questions, Jeane,
1) myejb.jar -this is an EJB jar. K

2) yes weblogic supports manifest file. I think its ejb-jar.xml and weblogic-ejb-jar.xml.

I will give more information now so that you can help me out.

I wrote stateless session bean which just sets and gets name if you pass a string. Then i created jar file. Thats myejb.jar.

myejb.jar contains META-INF\ ejb-jar.xml and weblogic-ejb-jar.xml.
*.class

I have one jsp file. which has JNDI lookup code. This is a naive approach for EAR. (Let it be)
Then i created WEB-INF folder and classes folder in it.

Now the important point is, I placed the class files EJBHome, EJBObject, and Session Bean of myejb.jar in the WEB-INF\Classes folder.. (I thought this would solve my problem).

Now i created myjsp.war file which contains WEB-INF\Classes\*.class(myejb.jar)
WEB-INF\web.xml and weblogic.xml
index.jsp(JNDI look up)


Now coming to EAR file, I created another folder called abu. K
abu folder contains myejb.jar, myjsp.war and META-INF\application.xml and weblogic-application.xml

now i created myapplication.ear file and deployed it. The problem is that index.jsp is throwing compile time error which you can see in the my post reply above.
+Pie Number of slices to send: Send
 

Abubacker Siddik wrote:I have one jsp file. which has JNDI lookup code. This is a naive approach for EAR. (Let it be)


Ok. Noting that you may encounter problems that are hard to get help with because people don't have experience doing that.

Abubacker Siddik wrote:Now the important point is, I placed the class files EJBHome, EJBObject, and Session Bean of myejb.jar in the WEB-INF\Classes folder.. (I thought this would solve my problem).


That would "solve" a compiler error but introduce a new error - not being able to call the EJB because it is just Java code. It does hint at the problem though. My guess is the JSP imports are incorrect. Can you show what imports you have in the JSP along with the package name of the EJB?
+Pie Number of slices to send: Send


This is the .jsp file showing the import files. I still dont get the solution.

+Pie Number of slices to send: Send
Thanks Jeane, I found the error i did and solved the problem. My EAR is running now. I didnt import package where my *.class files are.. Now i imported the package in the jsp file. Now it runs.. Thanks a lot.
Creativity is allowing yourself to make mistakes; art is knowing which ones to keep. Keep this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 2700 times.
Similar Threads
NoClassDefFoundError
.ear files
Doubut reagarding application.xml
ClassNotFoundException: org.apache.tiles.startup.BasicTilesInitializer
how to merge war file and ear file?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 09:00:29.