This discussion is archived
1 2 Previous Next 18 Replies Latest reply: Sep 5, 2010 2:30 PM by 843833 RSS

Problem accessing PetStore app

843833 Newbie
Currently Being Moderated
I have deployed the PetStore demo on the Sun App Server 9.1_01 using NetBeans 6.0 Beta 1.

When I try to access the app by Launching from the Sun App Server Admin Console I get the following:

HTTP Status 503 -
--------------------------------------------------------------------------------
type Status report
message
descriptionThe requested service () is not currently available.
--------------------------------------------------------------------------------
Sun Java System Application Server 9.1_01
.


I think the cause may be the following (taken from NetBeans deployment console):

naming.bind
Null component com.sun.appserv:type=JspMonitor,name=jsp,WebModule=//server/petstore,*J2EEApplication=null*,J2EEServer=server
+WEB0207: Error starting web context StandardEngine[com.sun.appserv].StandardHost[server].StandardContext[petstore] on virtual server server+
java.lang.RuntimeException: java.lang.RuntimeException: javax.naming.NameNotFoundException
at com.sun.enterprise.web.WebModuleListener.loadPersistenceUnits(WebModuleListener.java:193)
at com.sun.enterprise.web.WebModuleListener.lifecycleEvent(WebModuleListener.java:168)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:143)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:5094)
at com.sun.enterprise.web.WebModule.start(WebModule.java:326)
at com.sun.enterprise.web.LifecycleStarter.doRun(LifecycleStarter.java:58)
at com.sun.appserv.management.util.misc.RunnableBase.runSync(RunnableBase.java:304)
at com.sun.appserv.management.util.misc.RunnableBase.run(RunnableBase.java:341)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.RuntimeException: javax.naming.NameNotFoundException
at com.sun.enterprise.server.PersistenceUnitInfoImpl._getJtaDataSource(PersistenceUnitInfoImpl.java:283)
at com.sun.enterprise.server.PersistenceUnitInfoImpl.<init>(PersistenceUnitInfoImpl.java:116)
at com.sun.enterprise.server.PersistenceUnitLoaderImpl.load(PersistenceUnitLoaderImpl.java:121)
at com.sun.enterprise.server.PersistenceUnitLoaderImpl.load(PersistenceUnitLoaderImpl.java:84)
at com.sun.enterprise.web.WebModuleListener.loadPersistenceUnits(WebModuleListener.java:190)
+... 13 more+
Caused by: javax.naming.NameNotFoundException
at com.sun.enterprise.naming.TransientContext.resolveContext(TransientContext.java:268)
at com.sun.enterprise.naming.TransientContext.lookup(TransientContext.java:191)
at com.sun.enterprise.naming.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:74)
at com.sun.enterprise.naming.LocalSerialContextProviderImpl.lookup(LocalSerialContextProviderImpl.java:111)
at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:398)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at com.sun.enterprise.connectors.ConnectorResourceAdminServiceImpl.lookup(ConnectorResourceAdminServiceImpl.java:196)
at com.sun.enterprise.connectors.ConnectorRuntime.lookupPMResource(ConnectorRuntime.java:1099)
at com.sun.enterprise.server.PersistenceUnitInfoImpl.lookupPMDataSource(PersistenceUnitInfoImpl.java:294)
at com.sun.enterprise.server.PersistenceUnitInfoImpl._getJtaDataSource(PersistenceUnitInfoImpl.java:281)
+... 17 more+


Could someone please help me to resolve this problem?

Thanks in advance.
  • 1. Re: Problem accessing PetStore app
    843833 Newbie
    Currently Being Moderated
    This appears to be more of a appserver issue. Could you please post the same question to users[at]glassfish[dot]dev[dot]java[dot]net mailing list?

    Thanks
    Shreedhar
  • 2. Re: Problem accessing PetStore app
    843833 Newbie
    Currently Being Moderated
    I tried again from the start (correctly following the instructions this time, I think), and it works.

    Sorry for wasting your time.
  • 3. Re: Problem accessing PetStore app
    843833 Newbie
    Currently Being Moderated
    Hi, i had the same error. How did you solve the problem?
    Thanks
  • 4. Re: Problem accessing PetStore app
    843833 Newbie
    Currently Being Moderated
    I am getting the same error. I followed the petstore instructions as listed in blue prints. Everything goes well except for run. I saw the similar exception where j2eeapplication was null:

    Null component com.sun.appserv:type=JspMonitor,name=jsp,WebModule=//server/petstore,J2EEApplication=null,J2EEServer=server


    How to get rid of this?
  • 5. Re: Problem accessing PetStore app
    843833 Newbie
    Currently Being Moderated
    Hi,
    i had the same error with netbeans 6.0, petstore 2.0 EA5 and glassfish v2ur1-b09d, on windows vista.

    i solved this problem by changing two things

    - the path to the glassfish install in "petstore/bp-project/app-server.properties".
    It was set to "c:/sun/appserver". i changed it to my installation directory (ie "c:/glassfish")

    - the path to the glassfish install in "/petstore/bp-project/build.properties"

    and don't forget to create a file in your eeserver home dir ("c:/glassfish" for me) named "passfile" wich contains the unique line "AS_ADMIN_PASSWORD=adminadmin".

    Hope this helps

    Nicolas
  • 6. Re: Problem accessing PetStore app
    843833 Newbie
    Currently Being Moderated
    I['ve tried all of the above including re-installing (Glassfish v2ur1)to path with no spaces and re-installing PetStore. I still get

    Null component com.sun.appserv:type=JspMonitor,name=jsp,WebModule=//server/petstore,J2EEApplication=null,J2EEServer=server
    WEB0207: Error starting web context StandardEngine[com.sun.appserv].StandardHost[server].StandardContext[petstore] on virtual server server
    java.lang.RuntimeException: java.lang.RuntimeException: javax.naming.NameNotFoundException
    from NetBeans 6.0.1

    -and-

    Error occurred during application loading phase. The application will nfrom deploying either from asadin or NetBeans 6.0.1 (Glassfish v2ur1)ot run properly. Please fix your application and redeploy. WARNING: com.sun.enterprise.deployment.backend.IASDeploymentException: java.lang.RuntimeException: javax.naming.NameNotFoundException: PetstoreDB not found com.sun.enterprise.deployment.backend.IASDeploymentException: java.lang.RuntimeException: javax.naming.NameNotFoundException: PetstoreDB not found

    from deploying either from asadmin

    Any ideas?
  • 7. Re: Problem accessing PetStore app
    843833 Newbie
    Currently Being Moderated
    I am facing an identical problem. Any help will be much appreciated! Thanks.
  • 8. Re: Problem accessing PetStore app
    843833 Newbie
    Currently Being Moderated
    I got over the problem by simply downloading and installing the latest installer jar javapetstore-2.0-ea5.jar. The instructions work just fine. Thanks.
  • 9. Re: Problem accessing PetStore app
    843833 Newbie
    Currently Being Moderated
    do not use IDE to deploy/run.

    use
    asant setup
    asant run
  • 10. Re: Problem accessing PetStore app
    843833 Newbie
    Currently Being Moderated
    I installed the NetBeans / Glassfish v2 / MySQL bundle on my Mac and ran into this same problem. The solution is to follow the instructions very carefully, including changing the build.properties file's reference to your app server, and then following instructions all the way to the end where it says to run the "setup" target. Without running this target first, the JavaDB doesn't get setup, and running the project fails in connection with some kind of persistence error. (If you look further down at the error message detail when you run the project, you'll see that some persistence-related objects are not found.)

    I also found it helpful to read about how netbeans builds "standard projects" (in netbeans help). This project is provided with ant configurations for building/running either within netbeans and outside of netbeans, and I found this info useful in chasing down this error.
  • 11. Re: Problem accessing PetStore app
    843833 Newbie
    Currently Being Moderated
    This is not the same sample project, and I'm hoping it might be of some use to describe how I was able to get a windows platform to deploy to a linux platform.

    In order to complete enterprise beans project at :
    http://www.netbeans.org/kb/60/javaee/ejb30.html

    And get it to work on a remote machine, I needed to configure the database connection.
    I used net beans 6.0.1 under Windows and deployed to Ubuntu Linux.
    Installed GlassFish and setup derby database as instructed for Linux installation.
    I found that I needed to create the 'sample' database in derby using 'lj'. In order to define the connection in the netBeans IDE (below) you must attach to a database, therefore you must create one first (I think). Once you have attached to a database, you can execute arbitrary commands using that connection.

    First, create a server definition:
    - In netBeans, Select Tools->Servers
    - There should already be a GlassFish V2 Server defined - this is the local application server.
    - Add Server...
    - If you have installed most versions of the Sun Application Server, you should select GlassFish V2 as the server
    - Give it a unique name GlassFish V2 (1) will probably be the default
    - Click Next
    - On this page, only select the "Register Remote Domain" option - don't mess with anything else on this page!
    - Click Next
    - Specify a hostname. This can be a name (if you have set up SMB on your Linux box) or an IP address.
    - Port 4848 is the default unless you set up GlassFish on your Linux box with different port numbers.
    - Click Next
    - If you add your admin password, it will be saved in the netBeans IDE, forming a security risk. Good when learning, bad for any real work you might do. The default user is admin, the default password is adminadmin.
    - Click Finish


    Next, define your connectivity:
    - In netBeans, Select "Services" in the "Projects/Files/Services" window.
    - Expand Databases, Expand Drivers (click on the plus (+) sign to the left)
    - Verify the Java DB (Network) driver is there (it was there for me by default)
    - Collapse Drivers (click on the minus (-) sign to the left)
    - Add a connection for the remote machine (I had to do this step, I'll assume that is always the case)

    To add the connection:
    - Right click on Databases and Click on "New Connection..."
    - For Name: select "Java DB (Network)" from the drop-down list
    - For "Database URL:", type in "jdbc:derby//YourServerNameOrIP:1527/sample"
    - Click OK
    - You are prompted to select a database schema to use. The project listed above uses schema APP.
    - Click OK

    ALMOST DONE

    - Right Click on the newly formed connection
    - Select "Disconnect" so that it can be modified
    - Right Click on the newly formed connection (again!)
    - Click on "Properties"
    - Click on the "..." to the right of the "User" line
    - Set the user to "app" (Yes, the schema is in upper case and the user is in lower case)
    - Close the wizard, and you should be good to go.

    At this point, I was able to step through the project and get it to deploy!
  • 12. Re: Problem accessing PetStore app
    843833 Newbie
    Currently Being Moderated
    Does anyone really have a definitive answer as to why this doesn't work for some people and it does for others? I get the exact same error!
  • 13. Re: Problem accessing PetStore app
    843833 Newbie
    Currently Being Moderated
    Try this page!
    it's excellent!

    http://www.omniprogrammer.com/?p=4#comment-56

    Arre!
  • 14. Re: Problem accessing PetStore app
    843833 Newbie
    Currently Being Moderated
    Hello there !
    I've also experienced same problems (regarding to persistence) when deploying the Petstore app, altough I've carefully done the required steps (modify some properties files).
    But fear not, here is my workaround (at least it worked for me !)
    To start with, here is my environment :
    OS: Windows XP SP2
    JDK : 1.6_10
    Netbeans IDE: 6.1
    Glassfish: v2ur2 (that was bundled with Netbeans)

    I assume that you've already downloaded the jar file with the petstore app and properly made the required changes(that is to modify build.properties).
    Ok, now go to *<petstoreApp.home>/bp-project* and edit the app-server.properties file. Change both db.user and db.password with app value : db.user=app, db.password = app. .
    Now go to *<petstoreApp.home>* change to command line and execute the following: ant setup and ant run.
    Look closely at results from the console. Search for the following : create-jdbc-connection-pool and create-jdbc-resource. They should be executed successfully and you should not see something complaining about some required parameters (+datasourceclassname+ for create-jdbc-connection-pool) and (? for create-jdbc-resource).
    If you see this things, then you have to manually enter in the console (assume asadmin is added to your path env variables) the following commands:
    1)
    asadmin> create-jdbc-connection-pool --user admin --passwordfile c:/passfile --host localhost --port 4848 --datasourceclassname org.apache.derby.jdbc.ClientDataSource --restype javax.sql.XADataSource
    --property portNumber=1527:serverName=localhost:User=app:Password=app:databaseName=petstore PetstorePool
    with the result
    Command create-jdbc-connection-pool executed successfully.
    Note: replace
    --passwordfile=c:/passfile
    to the location of your pass file (for my Glassfish is in *<Glassfish_home>/passfile*)
    2)
    asadmin> create-jdbc-resource --user admin --passwordfile c:/passfile --host localhost --port 4848 --connectionpoolid PetstorePool 
    --enabled=true jdbc/PetstoreDB
    with the result
    Command create-jdbc-resource executed successfully.

    From Netbeans "Clean and Build" the project.
    Now you can go to admin console (localhost:4848), select WebApplications and deploy the petstore WAR. (found in *<petstoreApp.home>/dist* folder)
1 2 Previous Next