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.

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!

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)