4 Pics Showing How to Reuse an EJB in a NetBeans Platform Application!

I went through the Java EE Application Client on top of the NetBeans Platform Tutorial document today. Aside from outdated screenshots, it all seemed to work as advertized.

The idea is that you have an EJB like this:

Then, as a bridge between the Java EE world and the NetBeans Platform world, you have an application client that exposes the EJB and starts up the NetBeans Platform application...

...which contains a NetBeans module that consumes the EJB via the application client:

Once all the NetBeans Platform JARs are on the classpath of the application client, as described in the abovementioned document, you can simply run it. And the result is as follows:

Once you have your application client as described in the abovementioned document, you can do some more experimentation with calling the EJB, as described here. Reuse of existing EJBs should be pretty sweet following this approach!

Comments:

Geertjan,

Have you tried doing the tutorial on NB 6.9? I failed to build a client on NB Platform following the tutorial.

Following is the steps I took to build the app, please tell me what went wrong in my steps. Thanks in advance!
1. Since I'm using Netbeans 6.9 installed with Glassfish Server3, I skipped the Installation and Configuration part. I created a Netbeans Application Platform project called "dbreader".
2. Created customers module as shown in the guide. (Note: Generate XML layer was not checked)
3. Created dbreader-ear with server sets to Glassfish Server 3 and java version sets to Java EE 6
4. Added contents in Build Script Modifying (6.x) to build.xml of dbreader-ear
5. Completed "Generating Entity Classes From Database" part using default settings
6. Completed "Creating Session Bean" part without adding @Override annotation as suggested by the IDE
7. Run "Build JNLP Application" for dbreader
8. Completed "Modify Application Client" (Fixed imports with java.io.File and java.util.List)
9. Completed "Create Window Component" (Note: I do not know why CustomerAction.java was not created)
10. Completed "Write Customers Top Component Logic" with errors.(Failed to fix imports for Main and Customer.. I thought this would be solved by the next step during compilation)
11. Completed "Set up Module" part and following is the content of my project.properties:
C:/<some_path_with_space>/dbreader/dbreader-ear/dbreader-ear-ejb/dist/dbreader-ear-ejb.jar':\\
'C:/<some_path_with_space>/dbreader/dbreader-ear/dbreader-ear-app-client/dist/dbreader-ear-app-client.jar':\\
C:/glassfishv3/glassfish/lib/javaee.jar
12. Ran dbreader-ear

And I got the following errors:
...
compile:
[nb-javac] Compiling 1 source file to C:\\<some_path_with_space>\\dbreader\\customers\\build\\classes
[nb-javac] warning: [path] bad path element "C:\\<some_path_with_space>\\dbreader\\dbreader-ear\\dbreader-ear-app-client\\dist\\dbreader-ear-ejb.jar": no such file or directory
...<some not-so-important-lines>
[nb-javac] Note: generated layer entry: xml/entities/org_yourorg_customers/Customers
[nb-javac] Note: generated layer entry: xml/lookups/org_yourorg_customers/Customers.instance
[nb-javac] Note: generated layer entry: xml/memory/org/yourorg/customers/CustomersTopComponent
[nb-javac] C:\\<some_path_with_space>\\dbreader\\customers\\src\\org\\yourorg\\customers\\CustomersTopComponent.java:39: cannot find symbol
[nb-javac] symbol : class Customer
[nb-javac] location: class org.yourorg.customers.CustomersTopComponent
[nb-javac] List<Customer> data = Main.getCustomers();
[nb-javac] \^
[nb-javac] C:\\<some_path_with_space>\\dbreader\\customers\\src\\org\\yourorg\\customers\\CustomersTopComponent.java:39: cannot find symbol
[nb-javac] symbol : variable Main
[nb-javac] location: class org.yourorg.customers.CustomersTopComponent
[nb-javac] List<Customer> data = Main.getCustomers();
[nb-javac] \^
[nb-javac] C:\\<some_path_with_space>\\dbreader\\customers\\src\\org\\yourorg\\customers\\CustomersTopComponent.java:44: cannot find symbol
[nb-javac] symbol : class Customer
[nb-javac] location: class org.yourorg.customers.CustomersTopComponent
[nb-javac] for (Customer c : data) {
[nb-javac] \^
[nb-javac] 3 errors

BUILD FAILED
C:\\Program Files\\NetBeans 6.9\\harness\\suite.xml:175: The following error occurred while executing this line:
C:\\Program Files\\NetBeans 6.9\\harness\\common.xml:202: Compile failed; see the compiler error output for details.

Total time: 7 seconds
C:\\<some_path_with_space>\\dbreader\\dbreader-ear\\build.xml:64: Java returned: 1
BUILD FAILED (total time: 8 seconds)

Please tell me what went wrong.... =(

Regards,
Joanie

Posted by Joanie on August 06, 2010 at 02:07 PM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
12
13
14
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today