Discussions

News: Virtual Shopping Mall 1.3 Sample Application Available

  1. OTN developers have implemented the Virtual Shopping Mall 1.3, a sample application that demonstrates the various features of the J2EE platform. The VSM 1.3 enables vendors to set up online shops and customers to browse through these shops. It also enables a system administrator to approve/reject requests for new shops and maintain a list of shop categories. Some of the features that we intend to highlight through this application include:

    * J2EE Design Patterns
    * Internationalization Techniques
    * Apache Struts Framework
    * Security Features using JAAS

    We have put together a series of tutorials that uses the Virtual Shopping Mall 1.3 sample application to demonstrate programming techniques that take advantage of features defined in the J2EE 1.3(EJB 2.0, Servlet 2.3 etc) specifications. While describing parts of the larger application, each tutorial is self-contained, and explains how to use a technique or perform a task.

    The sample application has been certified on Oracle Application Server Containers for J2EE 10g on Windows 2000 and Red Hat Linux Advanced Server 2.1 platforms.

    Threaded Messages (13)

  2. Bring on the benchmarks[ Go to top ]

    I wonder how long till someone does a .Net versus J2EE version of this...

    Billy (blog)
  3. cool one and useful.
  4. Excellent Application[ Go to top ]

    Excellent Application, well done OTN!!

    The VSM application is a role model for engineering a J2EE application. Along with the accompanying tutorial, the VSM app will serve as a good mentor for J2EE developers.

    Arun Sreekumar S
  5. STRUTS vs BC4J[ Go to top ]

    Why did they use STRUTS instead of BC4J ?
  6. STRUTS vs BC4J[ Go to top ]

    Hi,
      We do have a BC4J version of the same application. Check this out
    Infact, BC4J also extends struts by subclassing the RequestProcessor of Struts.
      The idea of VSM 1.3 is to demonstrate writing an end-to-end application using J2EE technologies. Though BC4J itself is pure Java, one has to learn the BC4J framework,whereas VSM 1.3 uses the standard J2EE technologies and the popular Struts framework.
    Hope this clears your doubt.
    rehards
  7. How much of this excellent example is specific to Oracle?
  8. Hi,
       Virtually none. The application uses Oracle XSQL Servlets for report generation.But this can be treated as a library,(can be downloaded from http://otn.oracle.com/tech/xml/xdkhome.html), just like the Apache FOP libraries used by the application.
        Another area which uses Oracle APIs is JAAS user management(JAZN-Oracle's JAAS provider implementation). But it is abstracted and the specific classes can be omitted (note: not 'changed',but simply removed) while deploying to other app servers.
    Hope this helps,
    regards,
    Neelesh
  9. Is this application portable?[ Go to top ]

    Is this application specific to Oracle AS?

    I tried to deploy the generated VSM.ear into EA Server and ran into
    several deployment problems related to oracle:


    Deploying Web Components from bundle VSMWeb
    Caught Exception: {0}
    com.sybase.jaguar.util.JException: Invalid servlet name: oracle.otnsamples.ws.CC
    ServicesImpl
            at com.sybase.jaguar.management.JServletImpl.<init>(JServletImpl.java:70
    )
            at com.sybase.jaguar.management.JWebApplicationImpl.createServlet(JWebAp
    plicationImpl.java:308)
            at com.sybase.jaguar.importer.JEarImporter.installWebComponentsinJaguar(
    JEarImporter.java:2859)
            at com.sybase.jaguar.importer.JEarImporter.deployWebAppBundle(JEarImport
    er.java:770)
            at com.sybase.jaguar.management.deploytool.EarImporterCallClass.run(EarI
    mporterCallClass.java:434)
            at java.lang.Thread.run(Thread.java:484)

    com.sybase.jaguar.util.JException: Invalid servlet name: oracle.otnsamples.ws.CC
    ServicesImpl
            at com.sybase.jaguar.importer.JEarImporter.deployWebAppBundle(JEarImport
    er.java:804)
            at com.sybase.jaguar.management.deploytool.EarImporterCallClass.run(EarI
    mporterCallClass.java:434)
            at java.lang.Thread.run(Thread.java:484)


    Is this not a standard J2ee compatible application/ear?

    Thanks!
  10. Is this application portable?[ Go to top ]

    Hi
      This is a standard J2EE application, only that while you are deploying the app on other application servers, certain utility libraries (like you would add Apache's or any other application specific libs) need to be added to WEB-INF/lib folder of the application.
      In this case, the application uses Oracle's web service implementation, using which a java class can be exposed as a web service. So the libraries you need are under <OC4J_HOME>/webservices/lib folder. You can get ocj4 from http://otn.oracle.com/products/ias/index.html
       I haven't tried this yet, but this should work.
    Please feel free to post your queries/problems/suggestions on this application, either here or http://www.oracle.com/forums/forum.jsp?forum=133 which is meant for resolving issues on sample application developed by OTN.
    Hope this helps,
    Thanks,
    Neelesh
  11. Is this application portable?[ Go to top ]

    I downloaded oc4j 10g and Apache struts and could compile and
    deploy successfully to OC4J. I tried deploying the generated
    VSM.ear to EA Server and ran into the errors I mentioned earlier.
    Is this is the right method? I used build.xml that is bundled with
    the tutorial.

    I tried modifying the build.xml to point to EA Server, but that failed
    at the deployment stage with the following errors:


    oc4j-ear:
          [ear] Building ear: /work1/testarea/vsm-i18n/classes/VSM.ear
       [delete] Deleting: /work1/testarea/vsm-i18n/classes/VSMWeb.war
       [delete] Deleting: /work1/testarea/vsm-i18n/classes/VSMEJB.jar
         [move] Moving 1 files to /work1/testarea/vsm-i18n

    deploy-oc4j:
         [java] Error: Unable to find java:comp/ServerAdministrator: Lookup error: j
    ava.io.EOFException: Disconnected; nested exception is:
         [java] java.io.EOFException: Disconnected
         [java] com.evermind.client.orion.AdminCommandException: Unable to find java
    :comp/ServerAdministrator: Lookup error: java.io.EOFException: Disconnected; nes
    ted exception is:
         [java] java.io.EOFException: Disconnected
         [java] at com.evermind.client.orion.Oc4jAdminConsole.executeCommand(Oc4
    jAdminConsole.java:104)
         [java] at com.evermind.client.orion.Oc4jAdminConsole.main(Oc4jAdminCons
    ole.java:26)
         [java] javax.naming.NamingException: Lookup error: java.io.EOFException: Di
    sconnected; nested exception is:
         [java] java.io.EOFException: Disconnected. Root exception is java.io.E
    OFException: Disconnected
         [java] at com.evermind.server.rmi.RMIConnection.connect(RMIConnection.j
    ava:2263)
         [java] at com.evermind.server.rmi.RMIConnection.connect(RMIConnection.j
    ava:2128)
         [java] at com.evermind.server.rmi.RMIConnection.lookup(RMIConnection.ja
    va:1672)
         [java] at com.evermind.server.rmi.RMIServer.lookup(RMIServer.java:702)
         [java] at com.evermind.server.rmi.RMIContext.lookup(RMIContext.java:100
    )
         [java] at com.evermind.client.orion.Oc4jAdminConsole.executeCommand(Oc4
    jAdminConsole.java:101)
         [java] at com.evermind.client.orion.Oc4jAdminConsole.main(Oc4jAdminCons
    ole.java:26)
         [java] ---- Embedded exception
         [java] java.io.EOFException: Disconnected
         [java] at com.evermind.server.rmi.RMIConnection.connect(RMIConnection.j
    ava:2263)
         [java] at com.evermind.server.rmi.RMIConnection.connect(RMIConnection.j
    ava:2128)
         [java] at com.evermind.server.rmi.RMIConnection.lookup(RMIConnection.ja
    va:1672)
         [java] at com.evermind.server.rmi.RMIServer.lookup(RMIServer.java:702)
         [java] at com.evermind.server.rmi.RMIContext.lookup(RMIContext.java:100
    )
         [java] at com.evermind.client.orion.Oc4jAdminConsole.executeCommand(Oc4
    jAdminConsole.java:101)
         [java] at com.evermind.client.orion.Oc4jAdminConsole.main(Oc4jAdminCons
    ole.java:26)
         [java] Java Result: 3
         [java] Error: Unable to find java:comp/ServerAdministrator: Lookup error: j
    ava.io.EOFException: Disconnected; nested exception is:
         [java] java.io.EOFException: Disconnected
         [java] com.evermind.client.orion.AdminCommandException: Unable to find java
    :comp/ServerAdministrator: Lookup error: java.io.EOFException: Disconnected; nes
    ted exception is:
         [java] java.io.EOFException: Disconnected
         [java] at com.evermind.client.orion.Oc4jAdminConsole.executeCommand(Oc4
    jAdminConsole.java:104)
         [java] at com.evermind.client.orion.Oc4jAdminConsole.main(Oc4jAdminCons
    ole.java:26)
         [java] javax.naming.NamingException: Lookup error: java.io.EOFException: Di
    sconnected; nested exception is:
         [java] java.io.EOFException: Disconnected. Root exception is java.io.E
    OFException: Disconnected
         [java] at com.evermind.server.rmi.RMIConnection.connect(RMIConnection.j
    ava:2263)
         [java] at com.evermind.server.rmi.RMIConnection.connect(RMIConnection.j
    ava:2128)
         [java] at com.evermind.server.rmi.RMIConnection.lookup(RMIConnection.ja
    va:1672)
         [java] at com.evermind.server.rmi.RMIServer.lookup(RMIServer.java:702)
         [java] at com.evermind.server.rmi.RMIContext.lookup(RMIContext.java:100
    )
         [java] at com.evermind.client.orion.Oc4jAdminConsole.executeCommand(Oc4
    jAdminConsole.java:101)
         [java] at com.evermind.client.orion.Oc4jAdminConsole.main(Oc4jAdminCons
    ole.java:26)
         [java] ---- Embedded exception
         [java] java.io.EOFException: Disconnected
         [java] at com.evermind.server.rmi.RMIConnection.connect(RMIConnection.j
    ava:2263)
         [java] at com.evermind.server.rmi.RMIConnection.connect(RMIConnection.j
    ava:2128)
         [java] at com.evermind.server.rmi.RMIConnection.lookup(RMIConnection.ja
    va:1672)
         [java] at com.evermind.server.rmi.RMIServer.lookup(RMIServer.java:702)
         [java] at com.evermind.server.rmi.RMIContext.lookup(RMIContext.java:100
    )
         [java] at com.evermind.client.orion.Oc4jAdminConsole.executeCommand(Oc4
    jAdminConsole.java:101)
         [java] at com.evermind.client.orion.Oc4jAdminConsole.main(Oc4jAdminCons
    ole.java:26)
         [java] Java Result: 3

    BUILD SUCCESSFUL
    Total time: 33 seconds



















    " Error: Unable to find java:comp
  12. Is this application portable?[ Go to top ]

    Hi,
    Although what you are doing is logically correct, J2EE applications doesnt work as they are....ie., minor application server specific modifications has to be done in order to make the J2EE application run across different servers.

    For example, in your case, the application fails at JNDI layer. ie., the default JNDI lookup mechanism in the application tries to load OC4J specific classes and it fails when it didnt find them...You need to modify the jndi.properties in the config directory to make the JNDI layer work.

    Similarly you may need to change the orion-ejb-jar.xml in src/META-INF directory according to your EA server specific deployment descriptor. If you want to deploy this in weblogic then you need to come with weblogic-ejb-jar.xml...etc

    But there is no code change needed for deploying across application servers provided you are not using any server specific API's and your application is J2EE compliant.

    If you want know more information about porting J2EE applications, have a look at the following article which discuss about porting and cluster enabling this very theserverside.com across different app. servers.
    http://www.theserverside.com/resources/article.jsp?l=tsscluster1

    Cheers
    --Venky
  13. Is this application portable?[ Go to top ]

    Thanks for the reply.

    After making necessary modifications to the JNDI layer and deployment
    descriptors, deployment to EA server went through fine.

    However while trying to access the application from the browser:

    http://hostname:http_port#/vsm/home.do

    the application fails with the following message on the browser:

    500 Servletaction:unable to service request::XML - 20220: (Fatal Error)

    Is this something to do with the XML parser. I am using xerces.jar for
    XML parsing.

    The app server log has the following errors (in case you are interested):
    Sep 23 13:13:51 2003: action: init
    Sep 23 13:14:19 2003: 060038-Error: Unable to service request for servlet: actio
    n.
    Sep 23 13:14:19 2003: 060039-Error: ServletException contained the following roo
    t cause exception:
    org.xml.sax.SAXParseException: : XML-20220: (Fatal Error) Invalid InputSource.
            at oracle.xml.parser.v2.XMLError.flushErrorHandler(XMLError.java:262)
            at oracle.xml.parser.v2.XMLError.flushErrors1(XMLError.java:207)
            at oracle.xml.parser.v2.XMLReader.pushXMLReader(XMLReader.java:227)
            at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:174)
            at org.apache.commons.digester.Digester.parse(Digester.java:1567)
    :1433) at org.apache.struts.action.ActionServlet.initServlet(ActionServlet.java
            at org.apache.struts.action.ActionServlet.init(ActionServlet.java:466)
            at javax.servlet.GenericServlet.init(GenericServlet.java:258)
            at com.sybase.jaguar.servlet.JagServlet.init(JagServlet.java:171)
    etPool.java:173)ybase.jaguar.servlet.ServletPool.createInitializedInstance(Servl
    ) at com.sybase.jaguar.servlet.ServletPool.getInstance(ServletPool.java:72
    atcher.java:868)ybase.jaguar.servlet.JagRequestDispatcher.service(JagRequestDisp
    90) at com.sybase.jaguar.servlet.JagWebResource.service(JagWebResource.java:
    :133) at com.sybase.jaguar.servlet.JagFilterChain.doFilter(JagFilterChain.java
    :100) at oracle.otnsamples.vsm.HitCounterFilter.doFilter(HitCounterFilter.java
    :107) at com.sybase.jaguar.servlet.JagFilterChain.doFilter(JagFilterChain.java
            at oracle.otnsamples.vsm.HeaderFilter.doFilter(HeaderFilter.java:220)
    :107) at com.sybase.jaguar.servlet.JagFilterChain.doFilter(JagFilterChain.java
    04) at com.sybase.jaguar.servlet.ServletEngine._service(ServletEngine.java:8
    8) at com.sybase.jaguar.servlet.ServletEngine.service(ServletEngine.java:33
    Impl.java:58)m.sybase.jaguar.servlet.ServletServiceImpl.doService(ServletService
    _JaguarServlet_ServletService.java:143)k_JaguarServlet_ServletService.invoke(_sk
  14. EAServer SAX problem[ Go to top ]

    I have the same problem but when I try to create a Digester Class on the server side. It seems to be that Degister creates a XMLParser and it's throw an Exception...

    Do you've solved the problem? What do you do?

    Thanks.-