| Geronimo_MoinMoin_wiki > HowToTutorial |
HOWTO use Geronimo with the J2EE Tutorial
version 1.4 from Sun Microsystems
Contents
The directions here should work for Geronimo build 208887 or higher (Milestone 3 or earlier will not work).
Download the tutorials and examples in the same bundle
. The file name should be j2ee-1_4-doc-tutorial_3.zip. Extract the zip file somewhere.
$ cd j2eetutorial14/examples/web/hello1 $ ant $ cd build/WEB-INF
<?xml version="1.0" encoding="UTF-8"?>
<web-app
xmlns="http://java.sun.com/xml/ns/j2ee" version="2.4"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
id="hello1"
>
<display-name>hello1</display-name>
</web-app>
Note the id attribute in the <web-app> tag. This gives Geronimo a name for your application. (If you don't supply the name, Geronimo will try to use the value of the <display-name> tag.) Without a name—technically a configuration id—Geronimo can't deploy the application. (cf. http://www.javaworld.com/javaworld/jw-12-2004/jw-1213-geronimo-p2.html
)
<?xml version="1.0" encoding="UTF-8"?>
<web-app
xmlns="http://geronimo.apache.org/xml/ns/web"
configId="j2eetutorialhello1"
parentId="org/apache/geronimo/Server"
>
<context-root>/j2eetutorialhello1</context-root>
<context-priority-classloader>false</context-priority-classloader>
</web-app>
$ cd j2eetutorial14/examples/web/hello1/build $ jar -cf ../j2eehello1.war *
$ cd ~/geronimo/modules/assembly/target/geronimo-1.0-SNAPSHOT $ java -jar bin/server.jar $ java -jar bin/deployer.jar --user system --password manager deploy "x:\Sun\j2eetutorial14\examples\web\hello1\j2eehello1.war" Distributed j2eetutorialhello1
Point your browser to http://localhost:8080/j2eetutorialhello1/
You will get an HTTP ERROR: 500 :
HTTP ERROR: 500 The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application RequestURI=/j2eetutorialhello1/ Powered by Jetty://
or
HTTP ERROR: 500 Failed to load or instantiate TagLibraryValidator class: org.apache.taglibs.standard.tlv.JstlCoreTLV RequestURI=/j2eetutorialhello1/ Powered by Jetty://
Hmm...
17:37:14,380 WARN Servlet Handler
Exception for /j2eehello1/ org.apache.jasper.Jasper Exception: The absolute uri: http://java.sun.com/jsp/jstl/core
cannot be resolved in either web.xml or the jar files deployed with this application
This is a problem with the java tag library defined in index.jsp
Replace index.jsp with a plain text.
HTTP ERROR: 500 Unable+to+compile+class+for+JSP%0A%0ANo+Java+compiler+was+found+to+compile+the+generated+source+for+the+JSP%2E+%0AThis+can+usually+be+solved+by+copying+manually+%24JAVA%5FHOME%2Flib%2Ftools%2Ejar+from+the+JDK+%0Ato+the+common%2Flib+directory+of+the+Tomcat+server%2C+followed+by+a+Tomcat+restart%2E+%0AIf+using+an+alternate+Java+compiler%2C+please+check+its+installation+and+access+path%2E%0A
Hmm...Jasper is not happy. Question : Does geronimo prefer velocity to jsp. Why not?
Put $JAVA_HOME/lib/tools.jar in $JAVA_HOME/jre/lib/ext directory
Success...I can see the text in index.jsp
Now solve the tag library problem.
Try the helloservice example but be aware that Sun's application server supports web services using an entirely different deployment process. See HowToAxisGeronimo for more on web services.
$ cd j2eetutorial14/examples/jaxrpc/helloservice $ ant
Ant reports that the BUILD FAILED but if the compile-service task passed we will be ok
Use the web application created in HowToAxisGeronimo but name the directory MyHelloService
. cp -R build/helloservice MyHelloService
/WEB-INF/classes/
<?xml version="1.0" encoding="UTF-8"?>
<web-app
xmlns="http://geronimo.apache.org/xml/ns/web"
configId="your/domain/name/j2eetutorialhelloservice"
parentId="org/apache/geronimo/Server"
>
<context-root>/hello-jaxrpc</context-root>
<context-priority-classloader>false</context-priority-classloader>
</web-app>
cd MyHelloService
jar -cf [../MyHelloService].war *
cd incubator-geronimo/target java -jar bin/deployer.jar --install --module MyHelloService
.war
java -jar bin/server.jar your/domain/name/j2eetutorialhelloservice
http://localhost:8080/hello-jaxrpc
gives you some links to check out.
<deployment xmlns="http://xml.apache.org/axis/wsdd/
" xmlns:java="[http://xml.apache.org/axis/wsdd/providers/java">|http://xml.apache.org/axis/wsdd/providers/java">]
</deployment>
Executing the Axis client as shown here.
cd MyHelloService
/WEB-INF java -cp $AXISCLASSPATH org.apache.axis.client.AdminClient
-l local://localhost:8080/hello-jaxrpc/servlet/AdminServlet
deploy.wsdd Processing file deploy.wsdd <Admin>Done processing</Admin>
The WEB-INF directory now includes the file server-config.xml which requires redeployment.
cd .. jar -cf [../MyHelloService].war *
Ctrl-C
cd incubator-geronimo/target java -jar bin/deployer.jar --install --module MyHelloService
.war
java -jar bin/server.jar your/domain/name/j2eetutorialhelloservice
http://gisig.com:8080/hello-jaxrpc/servlet/AxisServlet
should now show the hello web service. http://localhost:8080/hello-jaxrpc/services/hello?WSDL
shows you the WSDL for the hello service.
The J2EE Tutorial comes with a number of clients that use this web service.
Stay tuned.