J2EE Tutorial examples compile problems
I wanna try to compile the examples that came with the tutorial but I
don't succeed.
Here are the error messages:
[root:/usr/local/j2eetutorial/examples]$ ant all
Buildfile: build.xml
init:
BUILD FAILED
/usr/local/j2eetutorial/examples/build.xml:19: /usr/local/j2eetutorial/examples/
build.xml:19: java.lang.StringIndexOutOfBoundsException: String index out of ran
ge: -1
--- Nested Exception ---
/usr/local/j2eetutorial/examples/build.xml:19: java.lang.StringIndexOutOfBoundsE
xception: String index out of range: -1
--- Nested Exception ---
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1480)
at org.apache.tools.ant.taskdefs.Property.loadEnvironment(Property.java:
248)
at org.apache.tools.ant.taskdefs.Property.execute(Property.java:172)
at org.apache.tools.ant.Target.execute(Target.java:153)
at org.apache.tools.ant.Project.runTarget(Project.java:898)
at org.apache.tools.ant.Project.executeTarget(Project.java:536)
at org.apache.tools.ant.Project.executeTargets(Project.java:510)
at org.apache.tools.ant.Main.runBuild(Main.java:421)
at org.apache.tools.ant.Main.main(Main.java:149)
Total time: 1 second
[root:/usr/local/j2eetutorial/examples]$
I set the environment according the instructions in the tutorial:
J2EE_HOME=/usr/local/j2sdkee1.3.1
JAVA_HOME=/usr/local/j2sdk1.4.1_01
ANT=/usr/local/jakarta-ant-1.3
PATH=$PATH:$J2EE_HOME/bin:$JAVA_HOME/bin:$ANT/bin
export J2EE_HOME JAVA_HOME ANT PATH
but I suspect the problem lies within 'build.xml'. These are lines 19
through 24:
<property environment="myenv" />
<property name="j2eepath" value="${myenv.J2EE_HOME}/lib/j2ee.jar" />
<property name="webpath" value="${webejb}" />
<property name="connector-lib" value="${myenv.J2EE_HOME}/lib/connector" />
<property name="cloud-lib" value="${myenv.J2EE_HOME}/lib/cloudscape" />
<property name="system-lib" value="${myenv.J2EE_HOME}/lib/system" />
Line 19 mentions "myenv" but I never set anything like that. Maybe I
should edit this line?
Any ideas?
Thanks
Nick.
Had the same error myself. Seems to be an issue with ant, I upgraded to ant 1.5.3.beta1 and it built fine. Hope this helps somewhat.
--Rice
Similar Messages
-
Run client execution problem when running Sun J2EE tutorial example
Hi,
I'm trying to run the Sun J2EE tutorial example, CartApp.
When come to run the client application I got the following error:
The command:
E:\Dev\src\J2EE_J2EE_tutorial\examples\ears>runclient -client CarApp.ear -name CartClient -textauth
The error:
Application threw an exception:java.io.IOException: CarApp.ear does not exist
The deployment complete without error.
I tried to the the APPCPATH to :
set APPCPATH=E:\Dev\src\J2EE_J2EE_tutorial\examples\ears\CartAppClient.jar
set APPCPATH=CartAppClient.jar
On both set, it gave the same error above.
Did someone known the problem I have ?
Thnakshi ,
I think u have given other disply name to your J2EE client ,
Anyway check disply name of J2EE client through deploytool.
u have to use that display name to access the j2ee client .
suppose ur j2ee client displyname is testclient, u can use:
runclient -client ConverterApp.ear -name testclient
hope this will help u,
babu. -
"asant build" for bookstore1 example in j2ee tutorial gives "compile error"
Hello everybody,
I am trying to run "asant build" command to build package for bookstore1 example given in j2ee tutorials.
I installed my j2ee tutorial 1.4 in "c:\java\j2eetutorial14" and my example is in "c:\java\j2eetutorial\examples\web\bookstore1".
My j2ee SDK with appliation server is installed in C:\sun\appserver.
When i run the "asant build" command in "c:\java\j2eetutorial\examples\web\bookstore1" directory i get compile error with last few lines as follows.
[javac] location: class servlets.ShowCartServlet
[javac] } catch (BookNotFoundException ex) {
[javac] ^
[javac] C:\Java\j2eetutorial14\examples\web\bookstore1\src\servlets\ShowCartServlet.jav
:136: cannot resolve symbol
[javac] symbol : class ShoppingCartItem
[javac] location: class servlets.ShowCartServlet
[javac] ShoppingCartItem item = (ShoppingCartItem) i.next();
[javac] ^
[javac] C:\Java\j2eetutorial14\examples\web\bookstore1\src\servlets\ShowCartServlet.jav
:136: cannot resolve symbol
[javac] symbol : class ShoppingCartItem
[javac] location: class servlets.ShowCartServlet
[javac] ShoppingCartItem item = (ShoppingCartItem) i.next();
[javac] ^
[javac] C:\Java\j2eetutorial14\examples\web\bookstore1\src\servlets\ShowCartServlet.jav
:137: cannot resolve symbol
[javac] symbol : class BookDetails
[javac] location: class servlets.ShowCartServlet
[javac] bd = (BookDetails) item.getItem();
[javac] ^
[javac] 69 errors
BUILD FAILED
file:C:/Java/j2eetutorial14/examples/web/bookstore1/build.xml:68: Compile failed; see the compiler error output for details.
Total time: 2 seconds
Can some one please help me.
thanksWhen i run the "asant build" command in
"c:\java\j2eetutorial\examples\web\bookstore1"
directory i get compile error with last few lines as
follows.Did you package the bookstore common files as described in Chapter 3? My guess is that you didn't include bookstore.jar from <INSTALL>/j2eetutorial14/examples/build/web/bookstore/dist/.
-Ian Evans
Sun Microsystems
J2EE Tutorial team -
J2EE Tutorial: Exception when building with ant
I am trying to build the converter example on page 48 of the J2EE tutorial using ant. Ant seems to choke on the following line from the build.xml:
<property environment="myenv" />
The output of the "ant converter" command is:
Buildfile: build.xml
init:
BUILD FAILED
/usr/j2sdkee1.3/j2eetutorial/examples/src/build.xml:18: /usr/j2sdkee1.3/j2eetutorial/examples/src/build.xml:18: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
--- Nested Exception ---
/usr/j2sdkee1.3/j2eetutorial/examples/src/build.xml:18: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
--- Nested Exception ---
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1525)
at org.apache.tools.ant.taskdefs.Property.loadEnvironment(Property.java:248)
at org.apache.tools.ant.taskdefs.Property.execute(Property.java:172)
at org.apache.tools.ant.Target.execute(Target.java:153)
at org.apache.tools.ant.Project.runTarget(Project.java:898)
at org.apache.tools.ant.Project.executeTarget(Project.java:536)
at org.apache.tools.ant.Project.executeTargets(Project.java:510)
at org.apache.tools.ant.Main.runBuild(Main.java:421)
at org.apache.tools.ant.Main.main(Main.java:149)
Total time: 1 second
My best guess is that the "myenv" line in the build.xml requires some additional attribute. I'm using ant version 1.3. My OS is Solaris (noted for possible environment-related issues).
Thanks in advance!
Eric SmithOn Windows XP Pro, the line
<property environment="myenv" />
in the init target of build.xml for the j2ee tutorial examples triggers a windows error message:
16 bit MS-DOS Subsystem
=======================
C:\WINDOWS\system32\ntvdm.exe
Error while setting up environment for the application. Choose 'Close' to terminate the application.
<<Close>> <<Ignore>>
So it looks as if ant is trying and failing to access the winnt system environment here.
According to Ant Developers Handbook (Sams, October 2002, chapter 4, p. 151), the ant environment property "specifies a prefix, giving access to OS-specific environment variables. This is not supported on all platforms." Until this problem is fixed, it appears that on XP systems anyway, any ant settings in build.xml files that rely on direct access to the system environment will fail. Here is some debug output from the j2ee tutorial examples init target which demonstrates this:
C:\apps\j2sdkee1.3.1\j2eetutorial\examples>ant init
Buildfile: build.xml
init:
[echo] starting init target
[echo] reached marker 1
[echo] reached marker 2
[echo] value of J2EE_HOME is ${myenv.J2EE_HOME}
[echo] finished init target
BUILD SUCCESSFUL
where the task:
<property environment="myenv" />
(which generates the OS error popup noted above) occurs between marker 1 and marker 2. Clearly the value of J2EE_HOME is NOT being successfully read from the system environment here. -
J2EE tutorial (June 17 '04) servlet example compilation error
This is a copy of my previous post on the same topic, but this one has a more self-desriptive subject line. Apologies for duplication.
I am trying the first servlet example in the J2EE tutorial, June 17, 2004, pgs 443 - 448. I have completed all the steps as described. However, the URL results in the following error. I would like to point out that I am using the URL http://localhost:8081/bookstore1/bookstore (instead of port 8080 because the admin console suggests that port 8081 is an available http port):
Assistance would be appreciated.
HTTP Status 404 - /bookstore1/bookstore
type Status report
message /bookstore1/bookstore
description The requested resource (/bookstore1/bookstore) is not available.
Sun-Java-System/Application-Server-PE-8.0
I looked at the logviewer and there are 3 severe errors in the log:
1. Application Server
Log Entry Detail
Details
Timestamp: Aug 6, 2004 14:36:28.375
Log Level: SEVERE
Logger: javax.enterprise.system.container.web
Name-Value Pairs:
_ThreadID=12;
Record Number: 754
Message ID: WebModule[bookstore1]Exception sending context initialized event to listener instance of class listeners.ContextListener java.lang.NoClassDefFoundError
Complete Message
exception/OrderException
at listeners.ContextListener.contextInitialized(Unknown Source)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3679)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4140)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:873)
at org.apache.catalina.core.ContainerBase.access$000(ContainerBase.java:171)
at org.apache.catalina.core.ContainerBase$PrivilegedAddChild.run(ContainerBase.java:193)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:855)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:623)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:947)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:729)
at com.sun.enterprise.server.WebModuleDeployEventListener.moduleDeployed(WebModuleDeployEventListener.java:147)
at com.sun.enterprise.server.WebModuleDeployEventListener.moduleDeployed(WebModuleDeployEventListener.java:224)
at com.sun.enterprise.admin.event.AdminEventMulticaster.invokeModuleDeployEventListener(AdminEventMulticaster.java:488)
at com.sun.enterprise.admin.event.AdminEventMulticaster.handleModuleDeployEvent(AdminEventMulticaster.java:475)
at com.sun.enterprise.admin.event.AdminEventMulticaster.processEvent(AdminEventMulticaster.java:302)
at com.sun.enterprise.admin.event.AdminEventMulticaster.multicastEvent(AdminEventMulticaster.java:107)
at com.sun.enterprise.admin.server.core.mbean.config.ManagedServerInstance.multicastEvent(ManagedServerInstance.java:3880)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.sun.enterprise.admin.server.core.jmx.Introspector.invokeMethodOn(Introspector.java:181)
at com.sun.enterprise.admin.server.core.mbean.config.AdminBase.invoke(AdminBase.java:86)
at com.sun.enterprise.admin.server.core.mbean.config.ConfigMBeanBase.invoke(ConfigMBeanBase.java:680)
at com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImpl.java:221)
at com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:228)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:823)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:792)
at sun.reflect.GeneratedMethodAccessor74.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.sun.enterprise.admin.util.proxy.ProxyClass.invoke(ProxyClass.java:54)
at $Proxy1.invoke(Unknown Source)
at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.invoke(SunoneInterceptor.java:282)
at com.sun.enterprise.deployment.phasing.DeploymentService.multicastEvent(DeploymentService.java:341)
at com.sun.enterprise.deployment.phasing.ServerDeploymentTarget.sendStartEvent(ServerDeploymentTarget.java:284)
at com.sun.enterprise.deployment.phasing.StartPhase.runPhase(StartPhase.java:115)
at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:74)
at com.sun.enterprise.deployment.phasing.DeploymentService.executePhases(DeploymentService.java:233)
at com.sun.enterprise.deployment.phasing.DeploymentService.deploy(DeploymentService.java:150)
at com.sun.enterprise.admin.mbeans.ApplicationsConfigMBean.deploy(ApplicationsConfigMBean.java:275)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:287)
at com.sun.enterprise.admin.config.BaseConfigMBean.invoke(BaseConfigMBean.java:280)
at com.sun.jmx.mbeanserver.DynamicMetaDataImpl.invoke(DynamicMetaDataImpl.java:221)
at com.sun.jmx.mbeanserver.MetaDataImpl.invoke(MetaDataImpl.java:228)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:823)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:792)
at sun.reflect.GeneratedMethodAccessor74.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.sun.enterprise.admin.util.proxy.ProxyClass.invoke(ProxyClass.java:54)
at $Proxy1.invoke(Unknown Source)
at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.invoke(SunoneInterceptor.java:282)
at com.sun.enterprise.admin.jmx.remote.server.callers.InvokeCaller.call(InvokeCaller.java:38)
at com.sun.enterprise.admin.jmx.remote.server.MBeanServerRequestHandler.handle(MBeanServerRequestHandler.java:92)
at com.sun.enterprise.admin.jmx.remote.server.servlet.RemoteJmxConnectorServlet.processRequest(RemoteJmxConnectorServlet.java:69)
at com.sun.enterprise.admin.jmx.remote.server.servlet.RemoteJmxConnectorServlet.doPost(RemoteJmxConnectorServlet.java:94)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:768)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:861)
at sun.reflect.GeneratedMethodAccessor78.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:289)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:311)
at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:205)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:283)
at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:102)
at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:192)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:263)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:156)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:569)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:261)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:215)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:156)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:583)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:569)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:200)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:156)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:180)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:582)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)
at com.sun.enterprise.webservice.EjbWebServiceValve.invoke(EjbWebServiceValve.java:134)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)
at com.sun.enterprise.security.web.SingleSignOn.invoke(SingleSignOn.java:254)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)
at com.sun.enterprise.web.VirtualServerValve.invoke(VirtualServerValve.java:209)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:569)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:161)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:156)
at com.sun.enterprise.web.VirtualServerMappingValve.invoke(VirtualServerMappingValve.java:166)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:154)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:569)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:979)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:211)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:692)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:647)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:589)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:691)
at java.lang.Thread.run(Thread.java:534)
2. Application Server
Log Entry Detail
Details
Timestamp: Aug 6, 2004 14:36:28.375
Log Level: SEVERE
Logger: tomcat.server./bookstore1.Context
Name-Value Pairs:
_ThreadID=12;
Record Number: 755
Message ID:
Complete Message
Error listenerStart
3. Application Server
Log Entry Detail
Details
Timestamp: Aug 6, 2004 14:36:28.375
Log Level: SEVERE
Logger: tomcat.server./bookstore1.Context
Name-Value Pairs:
_ThreadID=12;
Record Number: 756
Message ID:
Complete Message
Context startup failed due to previous errorsI had the same problem. It was caused by not including \j2eetutorial14\examples\web\bookstore\dist\bookstore.jar in the bookstore1.war. You may need to build the bookstore.jar file first if you haven�t already.
-
How to use ant1.3 in Wndows ME to build the examples in J2EE Tutorial?
When I tried to build the examples bundled with j2ee tutorial in the ..\j2eetutorial\examples directory using the ant 1.3 on Wndows ME I get the following exception.Anybody please help me.Is there any other build tool available for download?
StringIndexOutOfboundsException
D:\JAVATUTORIAL\J2EE\j2eetutorial\examples> ant -verbose all
Ant version 1.3 compiled on March 2 2001
Buildfile: build.xml
Detected Java Version: 1.3
Detected OS: Windows Me
parsing buildfile D:\JAVATUTORIAL\J2EE\j2eetutorial\examples\build.xml with URI
= file:D:/JAVATUTORIAL/J2EE/j2eetutorial/examples/build.xml
Project base dir set to: D:\JAVATUTORIAL\J2EE\j2eetutorial\examples
Build sequence for target `all' is [init, savingsaccount, bank, cart, checker, c
onfirmer, converter, enroller, order, salesrep, storagebin, teller, htmlreader,
warehouse, simplemessage, cmproster, ejb, date, hello1, hello2, bookstore1, web-
ejb, bookstore2, bookstore3, web, all]
Complete build sequence is [init, savingsaccount, bank, cart, checker, confirmer
, converter, enroller, order, salesrep, storagebin, teller, htmlreader, warehous
e, simplemessage, cmproster, ejb, date, hello1, hello2, bookstore1, web-ejb, boo
kstore2, bookstore3, web, all, create-storagebin-table, get-cci-jar, procs, cci,
connector, create-salesrep-table, create-procs-alias, create-coffee-table, abou
t, create-enroller-table, create-savingsaccount-table, create-web-db, create-war
ehouse-table, create-bank-table, clean, create-order-table, create-teller-table,
prepare, create-ejb-db]
init:
[property] Loading Environment myenv.
BUILD FAILED
D:\JAVATUTORIAL\J2EE\j2eetutorial\examples\build.xml:19: D:\JAVATUTORIAL\J2EE\j2
eetutorial\examples\build.xml:19: java.lang.StringIndexOutOfBoundsException: Str
ing index out of range: -1
--- Nested Exception ---
D:\JAVATUTORIAL\J2EE\j2eetutorial\examples\build.xml:19: java.lang.StringIndexOu
tOfBoundsException: String index out of range: -1
--- Nested Exception ---
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1476)
at org.apache.tools.ant.taskdefs.Property.loadEnvironment(Property.java:
248)
at org.apache.tools.ant.taskdefs.Property.execute(Property.java:172)
at org.apache.tools.ant.Target.execute(Target.java:153)
at org.apache.tools.ant.Project.runTarget(Project.java:898)
at org.apache.tools.ant.Project.executeTarget(Project.java:536)
at org.apache.tools.ant.Project.executeTargets(Project.java:510)
at org.apache.tools.ant.Main.runBuild(Main.java:421)
at org.apache.tools.ant.Main.main(Main.java:149)
Total time: 2 seconds
D:\JAVATUTORIAL\J2EE\j2eetutorial\examples>
*********************************************************************Please Help Me
-
Error when executing EJB example in J2EE Tutorial
Hi,
I am trying Converter example in J2EE tutorial.
I have created ConverterJAR and ConverterWAR
ConverterJAR is verified sucessfully when using verifier option
When verifying ConverterWAR i am getting the following error
Error: Class [ converter.ConverterHome ] not found in WEB-INF/classes or WEB-INF/lib.
For [ /ConverterWAR ]
Error: class [ converter.ConverterHome ] cannot be found within this jar [ war-ic.war ].
Error: Class [ converter.Converter ] not found in WEB-INF/classes or WEB-INF/lib.
For [ /ConverterWAR ]
Error: class [ converter.Converter ] cannot be found within this jar [ war-ic.war ].
Please let me know if anybody aware of this problemI have created ConverterJAR and ConverterWAR
ConverterJAR is verified sucessfully when using
verifier option
When verifying ConverterWAR i am getting the
following errorCreate an EJB-client JAR which will contain only the home and remote interfaces. Place it in WEB-INF/lib of your webapp and recreate your WAR. This should solve the problem. :)
$ -
J2ee tutorial bookstore2 example - again
Folks,
I've been trying to run the bookstore2 example of the j2ee tutorial.
When I click on the start shopping link nothing happens.
I found this in the server.log file
[#|2005-05-11T11:26:22.353+0100|WARNING|sun-appserver-pe8.1|javax.enterprise.system.stream.err|_ThreadID=18;|
org.apache.jasper.JasperException: /bookcatalog.jsp(39,2) The end tag "</c:forEach" is unbalanced
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:43)
I have tried to fix this and redeploy the application but I continue to get the same error. Obviously I am not deploying this correctly. Can someone tell me the steps involved? Thanks?
Here is the offending code.
<c:if test="${!empty param.Add}">
<c:set var="bid" value="${param.Add}"/>
<jsp:setProperty name="bookDB" property="bookId" value="${bid}" />
<c:set var="addedBook" value="${bookDB.bookDetails}" />
<p><h3><font color="red" size="+2">
<fmt:message key="CartAdded1"/> <em>${addedBook.title}</em> <fmt:message key="CartAdded2"/></font></h3>
</c:forEach>
</c:if>Somehow you accidentally added an incorrect tag. That section should be:
<c:if test="${!empty param.Add}">
<c:set var="bid" value="${param.Add}"/>
<jsp:setProperty name="bookDB" property="bookId" value="${bid}" />
<c:set var="addedBook" value="${bookDB.bookDetails}" />
<p><h3><font color="red" size="+2">
<fmt:message key="CartAdded1"/> <em>${addedBook.title}</em> <fmt:message key
="CartAdded2"/></font></h3>
</c:if>
That is, remove the </c:forEach>.
-Ian Evans -
Running examples from J2EE Tutorial
Has anyone been successfully running examples from
J2EE Tutorial on Creator?
I tried to import the JSP but Creator complains that it is
not an XHTML document. Clicking on the 'Convert to XHTML'
button or 'Preview...' button does not seem to do anything.
Openning the Source panel shows parsing problems on
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
Does anyone know how to run these in Creator correctly?
- weijyhYes,
It runs successfully....
I have download the examples from Sun,
unzipped It into my Projektfolder and open it in Creator, start it and works fine ...
No error messages .... -
Error when compiling the J2ee tutorial source files on win2k professional
Hi,
Could you help me?
I'm trying to complete the j2ee tutorial.
I have downloaded the example code, J2EE Sdk, J2SE and Ant from the web site (these files� name are: j2ee-1_3-doc-tutorial-draft3.zip, j2sdkee-1_3_01-win.exe, j2sdk-1_3_1_01-win.exe, jakarta-ant-1.3-bin.zip) and installed the �j2sdkee-1_3_01-win.exe, j2sdk-1_3_1_01-win.exe� and unzipped �j2ee-1_3-doc-tutorial-draft3.zip, jakarta-ant-1.3-bin.zip� to their default subdirectory.( jdk1.3.1_01,
j2sdkee1.3,jakarta-ant-1.3)
According to instructions, I have set the Environment Variables as the below:
ANT_HOME=c:\jakarta-ant-1.3
CLASSPATH=c:\sybtools\ASEP\Monclass.zip;c:\sybtools\ASEP\3pclass.zip;c:\program files\microsoft sql server 2000 jdbc\lib\mssqlserver.jar;c:\program files\microsoft sql server 2000 jdbc\lib\msbase.jar;c:\program files\microsoft sql server 2000 jdbc\lib\msutil.jar;c:\orcle\ora81\jdbc\lib\classes12.zip; c:\orcle\ora81\jdbc\lib\nls_charset12.zip;c:\program files\oracle\jdevelop 3.2.3\jdbc\lib\oracle8.1.7\classes12.zip;c:\j2sdkee1.3\lib\j2ee.jar;c:\jdk1.3.1_01\lib\tools.jar;c:\jdk1.3.1_01\lib\classes.zip;c:\jakarta-ant-1.3\lib\ant.jar
HOMEPATH=\
J2EE_HOME=c:\j2sdkee1.3
JAVA_HOME=c:\jdk1.3.1_01
OS=Windows_NT
Os2LibPath=C:\WINNT\system32\os2\dll;
Path=C:\oracle\ora81\bin;C:\oracle\ora81\Apache\Perl\5.00503\bin\mswin32-x86;C:\Program Files\Oracle\jre\1.1.7\bin;C:\PROGRA~1\REFLEC~1;C:\Program Files\Reflection;C:\WINNT\SYSTEM32;C:\WINNT;C:\WINNT\SYSTEM32\WBEM;C:\DMI\WIN32\BIN;C:\Program Files\Symantec\pcAnywhere\;C:\MSSQL7\BINN;C:\Sybase\DLL;C:\Sybase\BIN;C:\sybtools\WIN32;C:\sybtools\ASEP;c:\oracle\ora81\jdbc\lib;c:\j2sdkee1.3\bin;c:\jdk1.3.1_01\bin;c:\jakarta-ant-1.3\bin
SystemRoot=C:\WINNT
windir=C:\WINNT
�
After finishing the above actions, I have started the j2ee server and deploytools successfully. But when I executed the following command( ANT CONVERTER ) under the appointed subdirectory, the error occurred.
The information is
�Exception in thread �main� java.lang.NoClassDefFoundError: files\Microsoft �.
Looking forward to the answer!
Arthur Ward
2001-12-21by the way, after checking the ant_home\bin\ant.bat(see bellow)
-------end quote----
@echo off
if exist "%HOME%\antrc_pre.bat" call "%HOME%\antrc_pre.bat"
if not "%OS%"=="Windows_NT" goto win9xStart
:winNTStart
@setlocal
rem %~dp0 is name of current script under NT
set DEFAULT_ANT_HOME=%~dp0
rem : operator works similar to make : operator
set DEFAULT_ANT_HOME=%DEFAULT_ANT_HOME:\bin\=%
if %ANT_HOME%a==a set ANT_HOME=%DEFAULT_ANT_HOME%
set DEFAULT_ANT_HOME=
rem On NT/2K grab all arguments at once
set ANT_CMD_LINE_ARGS=%*
goto doneStart
:win9xStart
rem Slurp the command line arguments. This loop allows for an unlimited number of
rem agruments (up to the command line limit, anyway).
set ANT_CMD_LINE_ARGS=
:setupArgs
if %1a==a goto doneStart
set ANT_CMD_LINE_ARGS=%ANT_CMD_LINE_ARGS% %1
shift
goto setupArgs
:doneStart
rem This label provides a place for the argument list loop to break out
rem and for NT handling to skip to.
rem find ANT_HOME
if not "%ANT_HOME%"=="" goto checkJava
rem check for ant in Program Files on system drive
if not exist "%SystemDrive%\Program Files\ant" goto checkSystemDrive
set ANT_HOME=%SystemDrive%\Program Files\ant
goto checkJava
:checkSystemDrive
rem check for ant in root directory of system drive
if not exist "%SystemDrive%\ant" goto noAntHome
set ANT_HOME=%SystemDrive%\ant
goto checkJava
:noAntHome
echo ANT_HOME is not set and ant could not be located. Please set ANT_HOME.
goto end
:checkJava
set _JAVACMD=%JAVACMD%
set LOCALCLASSPATH=%CLASSPATH%
for %%i in ("%ANT_HOME%\lib\*.jar") do call "%ANT_HOME%\bin\lcp.bat" "%%i"
if "%JAVA_HOME%" == "" goto noJavaHome
if "%_JAVACMD%" == "" set JAVACMD=%JAVAHOME%\bin\java
if exist "%JAVA_HOME%\lib\tools.jar" call "%ANT_HOME%\bin\lcp.bat" "%JAVA_HOME%\lib\tools.jar"
if exist "%JAVA_HOME%\lib\classes.zip" call "%ANT_HOME%\bin\lcp.bat"
"%JAVA_HOME%\lib\classes.zip"
goto checkJikes
:noJavaHome
if "%_JAVACMD%" == "" set _JAVACMD=java
echo.
echo Warning: JAVA_HOME environment variable is not set.
echo If build fails because sun.* classes could not be found
echo you will need to set the JAVA_HOME environment variable
echo to the installation directory of java.
echo.
:checkJikes
if not "%JIKESPATH%" == "" goto runAntWithJikes
:runAnt
%_JAVACMD% -classpath %LOCALCLASSPATH% -Dant.home="%ANT_HOME%" %ANT_OPTS%
org.apache.tools.ant.Main %ANT_CMD_LINE_ARGS%
goto end
:runAntWithJikes
%_JAVACMD% -classpath %LOCALCLASSPATH% -Dant.home="%ANT_HOME%" -Djikes.class.path=%JIKESPATH%
%ANT_OPTS% org.apache.tools.ant.Main %ANT_CMD_LINE_ARGS%
:end
set LOCALCLASSPATH=
set _JAVACMD=
set ANT_CMD_LINE_ARGS=
if not "%OS%"=="Windows_NT" goto mainEnd
:winNTend
@endlocal
-------end quote----
i found something is wrong with the sentence in ":runAnt".
--------quote-----
%_JAVACMD% -classpath %LOCALCLASSPATH% -Dant.home="%ANT_HOME%" %ANT_OPTS%
org.apache.tools.ant.Main %ANT_CMD_LINE_ARGS%
--------end quote-----
No value was set for %ANT_OPTS% and %ANT_CMD_LINE_ARGS% -
Error when compiling the J2ee tutorial source files
HI,
I have installed ant, j2ee tomcat-3.2.2 and jdk1.3 and when i tried to compile the source file downloaded from java.sun by
ant converter, it prompted
"Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/main"
I am running it on win98 with the autoexec.bat containing the followings:
set J2EE_HOME=c:\j2sdkee1.3
set JAVA_HOME=c:\jdk1.3.1
set ANT_HOME=c:\jakarta-ant-1.3
set TOMCAT_HOME=c:\tomcat\jakarta-tomcat-3.2.2
set classpath=;.;c:\jdk1.3.1\jre\lib\rt.jar;c:\j2sdkee1.3\lib\j2ee.jar;c:\jaxp\xalan.jar;c:\jaxp\crimson.jar;c:\jaxp\jaxp.jar;c:\C:\jakarta-ant-1.3\lib\ant.jar;C:\jakarta-ant-1.3\lib\jaxp.jar;C:\jakarta-ant-1.3\lib\parser.jar
PATH=%PATH%;"C:\Program Files\Mts";C:\PROGRA~1\ULTRAE~1;c:\jdk1.3.1\bin;c:\j2sdkee1.3\bin;c:\jakarta-ant-1.3\bin;C:\PROGRA~1\MICROS~4\80\TOOLS\BINN
Really thx for help !!!!Hi.
I am compiling the sample converter.ear downloaded from
the j2ee tutorial bundle form java.sun. I am using jakarta-ant-1.4alpha-bin.zip downloaded from jakarta
oh..yes it should be org.apache.tools.ant.Main ....sorryfor typo.....
look forward to any helpful reply -
J2ee Tutorial #4 problem - FailedLoginException
I am new to enterprise beans, and I am going through the j2ee tutorial. When working on lesson 4 - a simple message bean, I receive the following message after submitting the initail form:
javax.servlet.ServletException: Could not initialize due to javax.security.auth.login.FailedLoginException: Password Incorrect
at bonus.controllers.BonusCalculationServlet.init(BonusCalculationServlet.java:71)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:852)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:615)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:368)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1012)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107)
at java.lang.Thread.run(Thread.java:536)
This appears to be a simple permissions problem, but I can not figure out where to configure these permissions. Can anyone help me?
TIA,
ChadEasy solution that I overlooked:
When setting the ResourceRefs for the BonusCalculationServlet, a user name and password must be specified. The generic username and password can be found in the auth.properties file in <install location>\config\auth.properties. In my specific case, they were the generic values from the j2ee install, guest/guest123.
-Chad -
Hi,
I�am only new to the J2EE platform but have experience with J2SE. I have installed J2EE 1.4 and Tomcat server 5.0.28 to study for the Web Component Developer Exam.
When I go to compile my java files, the compiler doesn�t not recognise the J2EE parts of the file. I have imported the correct classes (even the import statements, it doesn�t recognise!) and when I compile, the errors are associated with J2EE classes (i.e. doesn�t recognise HttpServlet....)
I compile in command prompt by typing: javac myFile.java.
I am aware that the file servlet-api.jar is required for these J2EE extras when compiling and I think this is my problem. I have put the location of this file on my classpath (set classpath=.;C:\fileDir\servlet-api.jar) by it still fails to compile. I have also put this location of the file directly into my PATH by this doesnt help!
Can anybody help me out with this configuration problem?
Thanks very much for any help!You need to have j2ee.jar (which can be found in <j2ee_install_dir>/lib directory in your classpath in order to successfully compile.
-
Having problem in getting JaveEE tutorial example source
I have tried to follow the link below to get example source, unfortunately it doesnt work, can someone show me how to get or send it to my email.
http://docs.oracle.com/javaee/6/tutorial/doc/gexaj.html#giqtt
Thanks~Please provide your platform OS and version, jdk version and the version of any tools you are using (netbeans, glassfish, etc).
Also, what happens when you follow the instructions titled' To Obtain the Tutorial Component Using the Update Tool' at the link you provided?
Java EE 6 Tutorial Component
The tutorial example source is contained in the tutorial component. To obtain the tutorial component, use the Update Tool.
To Obtain the Tutorial Component Using the Update Tool
1.Start the Update Tool.
From the command line, type the command updatetool.
On a Windows system, from the Start menu, choose All Programs, then chooseJava EE 6 SDK, then choose Start Update Tool.
2.Expand the GlassFish Server Open Source Edition node.
3.Select the Available Add-ons node.
4.From the list, select the Java EE 6 Tutorial check box.
5.Click Install.
6.Accept the license agreement.
After installation, the Java EE 6 Tutorial appears in the list of installed components. The tool is installed in the as-install/docs/javaee-tutorial directory. This directory contains two subdirectories: docs and examples. The examples directory contains subdirectories for each of the technologies discussed in the tutorial. -
J2EE Tutorial sample codes question
Hi there,
I just started to catchup some tutorials' sample codes using J2EE tutorial, what happened when i tried to compile the first example called "Converter" EJB, using the command:
ant converteri get all the files compiled except the ConverterClient.java which leads to some errors:
ConverterClient.java:15: '.' expected
import Converter;
^
ConverterClient.java:16: '.' expected
import ConverterHome;
^
ConverterClient.java:26: cannot resolve symbol
symbol : class ConverterHome
location: class ConverterClient
ConverterHome home =
^
ConverterClient.java:27: cannot resolve symbol
symbol : class ConverterHome
location: class ConverterClient
(ConverterHome)PortableRemoteObject.narrow(objref,
^
ConverterClient.java:28: cannot resolve symbol
symbol : class ConverterHome
location: class ConverterClient
ConverterHome.class);
^
ConverterClient.java:30: cannot resolve symbol
symbol : class Converter
location: class ConverterClient
Converter currencyConverter = home.create();
^
6 errors
whats wrong actually? I also tried to put the ConverterClient.java into another directory, after compiled the rest, then i copied the file into the build folder and compile it manually, yet still getting this error. Please help!
Thanks
NeoI think you didn't read my question properly, i had said that i manually copied the ConverterClient to the other class together as it needs;
This is the code for ConverterClient:
* Copyright 2001 Sun Microsystems, Inc. All Rights Reserved.
* This software is the proprietary information of Sun Microsystems, Inc.
* Use is subject to license terms.
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import java.math.BigDecimal;
import Converter;
import ConverterHome;
public class ConverterClient {
public static void main(String[] args) {
try {
Context initial = new InitialContext();
Context myEnv = (Context)initial.lookup("java:comp/env");
Object objref = myEnv.lookup("ejb/SimpleConverter");
ConverterHome home =
(ConverterHome)PortableRemoteObject.narrow(objref,
ConverterHome.class);
Converter currencyConverter = home.create();
BigDecimal param = new BigDecimal ("100.00");
BigDecimal amount = currencyConverter.dollarToYen(param);
System.out.println(amount);
amount = currencyConverter.yenToEuro(param);
System.out.println(amount);
System.exit(0);
} catch (Exception ex) {
System.err.println("Caught an unexpected exception!");
ex.printStackTrace();
} also please try the tutorial before answering...TQ :D
Maybe you are looking for
-
How to configure a error message
Hello, I have a User bean that hold informations about a user login ( login and password ). I write a method protected String logon() that search if the login and the password entered by the user match with those stored in a database. If not, i would
-
Turning Bash into GLaDOS and other fun tricks
I wanted to share some simple bash customizations that can improve functionality and awesomeness. All changes can be undone by deleting the added text or commenting out a line. This was made in Ubuntu, your mileage may vary. These edits can be safely
-
What is the safe music listening level for regular and in-ear headphones?
I am wondering what the safe music listening level for regular and in-ear headphones is. I heard it was 50% volume for regular headphones but what about the new 60$ in-ear ones? I am going to get them soon.
-
Xorg + nvidia = 640x480
When I use the nvidia driver I only get 640x480, but when i use the nv driver i get 1024x768. Here is my xorg.conf Section "ServerLayout" Identifier "X.org Configured" Screen 0 "Screen0" 0 0 InputDevice "Mouse0" "CorePointer" InputDevice "Keyboard0"
-
Newbee question - Headers Footer and menus
What is the current, best practice for building a web site with consistent menus, headers and footers etc. I have read good and bad about SSI, and Dreamweaver libraries etc, and would like to know where folks in the industry turn to complete this kin