Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > Servlets
|
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Servlets section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 9th, 2004, 02:06 AM
Authorized User
 
Join Date: Apr 2004
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to partho_choudhury Send a message via Yahoo to partho_choudhury
Default A question on bookstore sample app and pointbase

Hi all:

This is regarding the bookstore sample program bundled in the webapps folder of the Java System Application Server PE-8. The problem I face is this:

The admin console lists the appname and context roots as bookstore1. Hence the logical pathname should be http://<localhost>:<port>/bookstore1/ . However, this does not work, and I need to type /enter at the end to make it work. What is going on?

I start the application as instructed and go through one shopping cycle, and check out. I am once again instructed to "Continue Shopping", but upon clicking the "Continue Shopping" link, I get a error page saying that the servlet is unavailable. The log stack trace is as follows:



Servlet.service() for servlet BookDetailsServlet threw exception

java.lang.NullPointerException

at samples.webapps.bookstore.bookstore1.BookDetailsSe rvlet.doGet(Unknown Source)

at javax.servlet.http.HttpServlet.service(HttpServlet .java:748)

at javax.servlet.http.HttpServlet.service(HttpServlet .java:861)

at sun.reflect.GeneratedMethodAccessor110.invoke(Unkn own Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at org.apache.catalina.security.SecurityUtil$1.run(Se curityUtil.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.doAsPriv ilege(SecurityUtil.java:205)

at org.apache.catalina.core.ApplicationFilterChain.in ternalDoFilter(ApplicationFilterChain.java:283)

at org.apache.catalina.core.ApplicationFilterChain.ac cess$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.do Filter(ApplicationFilterChain.java:188)

at org.apache.catalina.core.StandardWrapperValve.invo ke(StandardWrapperValve.java:263)

at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:156)

at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:569)

at org.apache.catalina.core.StandardContextValve.invo keInternal(StandardContextValve.java:261)

at org.apache.catalina.core.StandardContextValve.invo ke(StandardContextValve.java:215)

at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:156)

at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:569)

at org.apache.catalina.core.StandardHostValve.invoke( StandardHostValve.java:200)

at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:156)

at org.apache.catalina.valves.ErrorReportValve.invoke (ErrorReportValve.java:180)

at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:154)

at org.apache.catalina.valves.AccessLogValve.invoke(A ccessLogValve.java:582)

at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:154)

at com.sun.enterprise.webservice.EjbWebServiceValve.i nvoke(EjbWebServiceValve.java:134)

at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:154)

at com.sun.enterprise.security.web.SingleSignOn.invok e(SingleSignOn.java:272)

at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:154)

at com.sun.enterprise.web.VirtualServerValve.invoke(V irtualServerValve.java:209)

at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:154)

at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:569)

at org.apache.catalina.core.StandardEngineValve.invok e(StandardEngineValve.java:161)

at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:156)

at com.sun.enterprise.web.VirtualServerMappingValve.i nvoke(VirtualServerMappingValve.java:166)

at org.apache.catalina.core.StandardValveContext.invo keNext(StandardValveContext.java:154)

at org.apache.catalina.core.StandardPipeline.invoke(S tandardPipeline.java:569)

at org.apache.catalina.core.ContainerBase.invoke(Cont ainerBase.java:979)

at org.apache.coyote.tomcat5.CoyoteAdapter.service(Co yoteAdapter.java:211)

at org.apache.coyote.http11.Http11Processor.process(H ttp11Processor.java:692)

at org.apache.coyote.http11.Http11Protocol$Http11Conn ectionHandler.processConnection(Http11Protocol.jav a:647)

at org.apache.tomcat.util.net.TcpWorkerThread.runIt(P oolTcpEndpoint.java:589)

at org.apache.tomcat.util.threads.ThreadPool$ControlR unnable.run(ThreadPool.java:691)

at java.lang.Thread.run(Thread.java:534)



Please help me with what is going on? Am I missing some settings, or is there a bug in the release I am unaware of? Are there any fixes?

Moreover, are there any alternatives to the pointbase database server bundled with SAS PE-8? Could I use MS-Access2k, for ex. and how do I configure it to work with these sample apps? I am really uncomfortable working with pointbase.

Partho
__________________
Watch your thoughts; they become words.
Watch your words; they become actions.
Watch your actions; they become habits.
Watch your habits; they become character.
Watch your character; it becomes your destiny.

I will, hence I can
 
Old May 13th, 2004, 11:48 AM
Registered User
 
Join Date: May 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Spell Check
Hello my friend,

1. There is no mapping to servlet for a welcome page per default.
If you enter http://<localhost>:<port>/bookstore1/ and there is no index.html or index.jsp page in the context root of /bookstore1 listing of files will be provided.
Solution. Put index.html or index.jsp inside context root or specify mapping to welcome file (in deploytool select war file, file refs tab, welcome files section). But since these do not apply to the bookstore1 sample (there is no index files provided and you can't designate a servlet a as welcome file) you can simply make a mapping to the right servlet like this: in deploytool select the war, then select "BookStoreServlet", aliases tab, enter new alias with value "/index.html". This will simply do what you want as along as there is no "/index.html" in the war itself. Now you should be able to enter http://<localhost>:<port>/bookstore1/ and be redirected to "BookStoreServlet".

2. This just a simple app. It has bugs. You found one of them. Reason ? Look at the "ReceiptServlet.java". You will find lines like this:
    // Payment received -- invalidate the session
    session.invalidate();

Null pointer is because rest of pages get parameters from session scope.
Solution: comment the line. Drastic but works. There is only "continue shopping button" in this app so I don't know why this instruction is there. Remember this is only a sample. You can image how this should be implemented as you look at real shops.

3. Lookup jdbc tutorials. There should be some info on using java with access. To the real databases you look for jdbc database driver. For access there is an odbc:jdbc bridge if I recall correct. I haven't used it myself.

That's all. See ya.





Similar Threads
Thread Thread Starter Forum Replies Last Post
A question on bookstore sample app and pointbase partho_choudhury JSP Basics 0 April 9th, 2004 02:10 AM
A question on bookstore sample app and pointbase partho_choudhury Pro JSP 0 April 9th, 2004 02:09 AM
A question on bookstore sample app and pointbase partho_choudhury J2EE 0 April 9th, 2004 02:07 AM
A question on bookstore sample app and pointbase partho_choudhury Java Databases 0 April 9th, 2004 02:04 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.