Miles to go …

July 20, 2010

Screencast #30: Java EE 6 & GlassFish 3 using NetBeans 6.9 – 5 screencasts

Filed under: General — arungupta @ 5:38 am

This 5-part screencast shows how NetBeans 6.9 provides comprehensive tooling for Java EE 6 & GlassFish 3. The video tutorial starts with building a simple Java EE 6 application and evolves to add features from several new technologies such as Java Persistence API 2, Java Server Faces 2, Contexts & Dependency Injection, and Java API for RESTful Web services from the platform. Specifically, the different parts show:

  1. How to create a simple Java EE 6 application using JSP, Servlets 3, and EJB 3.1
  2. Reading values from a database table using Java Persistence API 2 POJO entities
  3. Create a template-based website using Facelets with Java Server Faces 2
  4. Use Contexts & Dependency Injection with JSF 2
  5. Publish a RESTful Web service using JAX-RS

Enjoy!

Note, this is a playlist of all the videos so click on little arrows (shown as "<" or ">") to view the different videos.

Please give us feedback on GlassFish Forums.

Technorati: screencast javaee6 glassfish tutorial netbeans

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • email
  • StumbleUpon
  • Technorati
  • Twitter
  • Slashdot
Related posts:
  1. Screencast #31: Java EE 6 using GlassFish and Eclipse 3.6 – Oracle Enterprise Pack for Eclipse 11.1.1.6 is now available – 5 new screencasts
  2. Java EE 6 with NetBeans and GlassFish – FREE Webinar on Jan 20th
  3. Screencast #32: OSGi-enabled Java EE Applications using NetBeans and GlassFish
  4. Screencast #WS1: Web services development using NetBeans IDE and GlassFish
  5. Screencast #33: NetBeans 7.0 M2 and GlassFish 3.1 Features

34 Comments »

  1. Super! Thank you for screen-casts!

    Comment by Alexander Lipatov — July 20, 2010 @ 12:49 pm

  2. I am trying to convert a web app to a client server app. I am using JavaFx and Netbeans 6.9. I have put Oracle’s JDBC driver in the projects classpath. I generate code through the JavaFx composer but I can’t seem to get the DeviceDriver to reconisze the driver.

    Comment by Ian Parkin — July 23, 2010 @ 6:41 am

  3. Ian,

    DeviceDriver is on the client or server-side ?

    Comment by Arun Gupta — July 28, 2010 @ 3:04 pm

  4. The DeviceDriver is on the client side. I resolved the problem by downloading a more updated JDBC driver. I was using Java 6 and the driver I was pointing to was ojdbc14.jar I downloaded ojdbc6.jar and it worked. Thanks.

    Comment by Ian Parkin — July 29, 2010 @ 6:16 am

  5. I enjoyed your presentaion yesterday at Dallas Tech Fest. Thank you so much!

    I am working your examples, but cannot get the jUnit tests to work. I see tons of stuff on google with the same type warnings but cann’t seem to find a fix. Have you seen this before?

    init:
    deps-module-jar:
    deps-ear-jar:
    deps-jar:
    library-inclusion-in-archive:
    library-inclusion-in-manifest:
    compile:
    Compiling 1 source file to C:\guptaDemo\HelloWorld\build\test\classes
    compile-test-single:
    WARNING: multiple versions of ant detected in path for junit
    jar:file:/C:/Program%20Files%20(x86)/NetBeans%206.9/java/ant/lib/ant.jar!/org/apache/tools/ant/Project.class
    and jar:file:/C:/Program%20Files%20(x86)/glassfish-3.0.1/glassfish/modules/ant.jar!/org/apache/tools/ant/Project.class
    Testsuite: server.HelloBeanTest
    sayHello
    Jul 31, 2010 3:35:40 PM com.sun.enterprise.v3.server.AppServerStartup run
    INFO: GlassFish Server Open Source Edition 3.0.1 (22) startup time : Embedded(2102ms) startup services(534ms) total(2636ms)
    Jul 31, 2010 3:35:40 PM org.glassfish.admin.mbeanserver.JMXStartupService$JMXConnectorsStarterThread run
    INFO: JMXStartupService: JMXConnector system is disabled, skipping.
    Jul 31, 2010 3:35:40 PM com.sun.enterprise.transaction.JavaEETransactionManagerSimplified initDelegates
    INFO: Using com.sun.enterprise.transaction.jts.JavaEETransactionManagerJTSDelegate as the delegate
    Jul 31, 2010 3:35:41 PM AppServerStartup run
    INFO: [Thread[GlassFish Kernel Main Thread,5,main]] started
    Jul 31, 2010 3:35:43 PM com.sun.enterprise.deployment.archivist.Archivist readAnnotations
    WARNING: Error in annotation processing: java.lang.NoClassDefFoundError: build/web/WEB-INF/classes/server/HelloServlet (wrong name: server/HelloServlet)
    Jul 31, 2010 3:35:43 PM org.glassfish.api.ActionReport failure
    SEVERE: Exception while deploying the app
    java.lang.IllegalArgumentException: Invalid ejb jar [HelloWorld.jar]: it contains zero ejb.
    Note:
    1. A valid ejb jar requires at least one session, entity (1.x/2.x style), or message-driven bean.
    2. EJB3+ entity beans (@Entity) are POJOs and please package them as library jar.
    3. If the jar file contains valid EJBs which are annotated with EJB component level annotations (@Stateless, @Stateful, @MessageDriven, @Singleton), please check server.log to see whether the annotations were processed properly.
    at com.sun.enterprise.deployment.util.EjbBundleValidator.accept(EjbBundleValidator.java:72)
    at com.sun.enterprise.deployment.util.ApplicationValidator.accept(ApplicationValidator.java:124)
    at com.sun.enterprise.deployment.EjbBundleDescriptor.visit(EjbBundleDescriptor.java:722)
    at com.sun.enterprise.deployment.Application.visit(Application.java:1744)
    at com.sun.enterprise.deployment.archivist.ApplicationArchivist.validate(ApplicationArchivist.java:774)
    at com.sun.enterprise.deployment.archivist.ApplicationArchivist.openWith(ApplicationArchivist.java:253)
    at com.sun.enterprise.deployment.archivist.ApplicationFactory.openWith(ApplicationFactory.java:222)
    at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:152)
    at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:79)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.loadDeployer(ApplicationLifecycle.java:612)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:554)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:262)
    at org.glassfish.kernel.embedded.EmbeddedDeployerImpl.deploy(EmbeddedDeployerImpl.java:214)
    at org.glassfish.kernel.embedded.EmbeddedDeployerImpl.deploy(EmbeddedDeployerImpl.java:144)
    at org.glassfish.ejb.embedded.EJBContainerImpl.deploy(EJBContainerImpl.java:128)
    at org.glassfish.ejb.embedded.EJBContainerProviderImpl.createEJBContainer(EJBContainerProviderImpl.java:120)
    at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:102)
    at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:78)
    at server.HelloBeanTest.testSayHello(HelloBeanTest.java:49)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
    at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
    at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)
    at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:518)
    at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1052)
    at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:906)
    Jul 31, 2010 3:35:43 PM org.glassfish.ejb.embedded.EJBContainerProviderImpl createEJBContainer
    INFO: [EJBContainerProviderImpl] Cleaning up on failure …
    Jul 31, 2010 3:35:43 PM org.glassfish.admin.mbeanserver.JMXStartupService shutdown
    INFO: JMXStartupService and JMXConnectors have been shut down.
    Jul 31, 2010 3:35:43 PM com.sun.enterprise.v3.server.AppServerStartup stop
    INFO: Shutdown procedure finished
    Jul 31, 2010 3:35:43 PM AppServerStartup run
    INFO: [Thread[GlassFish Kernel Main Thread,5,main]] exiting
    Jul 31, 2010 3:35:43 PM org.glassfish.ejb.embedded.EJBContainerProviderImpl createEJBContainer
    SEVERE: ejb.embedded.exception_instantiating
    javax.ejb.EJBException: Failed to deploy EJB modules – see log for details
    at org.glassfish.ejb.embedded.EJBContainerImpl.deploy(EJBContainerImpl.java:135)
    at org.glassfish.ejb.embedded.EJBContainerProviderImpl.createEJBContainer(EJBContainerProviderImpl.java:120)
    at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:102)
    at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:78)
    at server.HelloBeanTest.testSayHello(HelloBeanTest.java:49)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
    at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
    at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)
    at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:518)
    at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1052)
    at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:906)
    Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 6.282 sec

    ————- Standard Output —————
    sayHello
    ————- —————- —————
    ————- Standard Error —————–
    Jul 31, 2010 3:35:40 PM com.sun.enterprise.v3.server.AppServerStartup run
    INFO: GlassFish Server Open Source Edition 3.0.1 (22) startup time : Embedded(2102ms) startup services(534ms) total(2636ms)
    Jul 31, 2010 3:35:40 PM org.glassfish.admin.mbeanserver.JMXStartupService$JMXConnectorsStarterThread run
    INFO: JMXStartupService: JMXConnector system is disabled, skipping.
    Jul 31, 2010 3:35:40 PM com.sun.enterprise.transaction.JavaEETransactionManagerSimplified initDelegates
    INFO: Using com.sun.enterprise.transaction.jts.JavaEETransactionManagerJTSDelegate as the delegate
    Jul 31, 2010 3:35:41 PM AppServerStartup run
    INFO: [Thread[GlassFish Kernel Main Thread,5,main]] started
    Jul 31, 2010 3:35:43 PM com.sun.enterprise.deployment.archivist.Archivist readAnnotations
    WARNING: Error in annotation processing: java.lang.NoClassDefFoundError: build/web/WEB-INF/classes/server/HelloServlet (wrong name: server/HelloServlet)
    Jul 31, 2010 3:35:43 PM org.glassfish.api.ActionReport failure
    SEVERE: Exception while deploying the app
    java.lang.IllegalArgumentException: Invalid ejb jar [HelloWorld.jar]: it contains zero ejb.
    Note:
    1. A valid ejb jar requires at least one session, entity (1.x/2.x style), or message-driven bean.
    2. EJB3+ entity beans (@Entity) are POJOs and please package them as library jar.
    3. If the jar file contains valid EJBs which are annotated with EJB component level annotations (@Stateless, @Stateful, @MessageDriven, @Singleton), please check server.log to see whether the annotations were processed properly.
    at com.sun.enterprise.deployment.util.EjbBundleValidator.accept(EjbBundleValidator.java:72)
    at com.sun.enterprise.deployment.util.ApplicationValidator.accept(ApplicationValidator.java:124)
    at com.sun.enterprise.deployment.EjbBundleDescriptor.visit(EjbBundleDescriptor.java:722)
    at com.sun.enterprise.deployment.Application.visit(Application.java:1744)
    at com.sun.enterprise.deployment.archivist.ApplicationArchivist.validate(ApplicationArchivist.java:774)
    at com.sun.enterprise.deployment.archivist.ApplicationArchivist.openWith(ApplicationArchivist.java:253)
    at com.sun.enterprise.deployment.archivist.ApplicationFactory.openWith(ApplicationFactory.java:222)
    at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:152)
    at org.glassfish.javaee.core.deployment.DolProvider.load(DolProvider.java:79)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.loadDeployer(ApplicationLifecycle.java:612)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.setupContainerInfos(ApplicationLifecycle.java:554)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:262)
    at org.glassfish.kernel.embedded.EmbeddedDeployerImpl.deploy(EmbeddedDeployerImpl.java:214)
    at org.glassfish.kernel.embedded.EmbeddedDeployerImpl.deploy(EmbeddedDeployerImpl.java:144)
    at org.glassfish.ejb.embedded.EJBContainerImpl.deploy(EJBContainerImpl.java:128)
    at org.glassfish.ejb.embedded.EJBContainerProviderImpl.createEJBContainer(EJBContainerProviderImpl.java:120)
    at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:102)
    at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:78)
    at server.HelloBeanTest.testSayHello(HelloBeanTest.java:49)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
    at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
    at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)
    at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:518)
    at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1052)
    at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:906)
    Jul 31, 2010 3:35:43 PM org.glassfish.ejb.embedded.EJBContainerProviderImpl createEJBContainer
    INFO: [EJBContainerProviderImpl] Cleaning up on failure …
    Jul 31, 2010 3:35:43 PM org.glassfish.admin.mbeanserver.JMXStartupService shutdown
    INFO: JMXStartupService and JMXConnectors have been shut down.
    Jul 31, 2010 3:35:43 PM com.sun.enterprise.v3.server.AppServerStartup stop
    INFO: Shutdown procedure finished
    Jul 31, 2010 3:35:43 PM AppServerStartup run
    INFO: [Thread[GlassFish Kernel Main Thread,5,main]] exiting
    Jul 31, 2010 3:35:43 PM org.glassfish.ejb.embedded.EJBContainerProviderImpl createEJBContainer
    SEVERE: ejb.embedded.exception_instantiating
    javax.ejb.EJBException: Failed to deploy EJB modules – see log for details
    at org.glassfish.ejb.embedded.EJBContainerImpl.deploy(EJBContainerImpl.java:135)
    at org.glassfish.ejb.embedded.EJBContainerProviderImpl.createEJBContainer(EJBContainerProviderImpl.java:120)
    at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:102)
    at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:78)
    at server.HelloBeanTest.testSayHello(HelloBeanTest.java:49)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
    at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
    at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)
    at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:518)
    at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1052)
    at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:906)
    ————- —————- —————
    Testcase: testSayHello(server.HelloBeanTest): Caused an ERROR
    No EJBContainer provider available
    The following providers:
    org.glassfish.ejb.embedded.EJBContainerProviderImpl
    Returned null from createEJBContainer call.

    javax.ejb.EJBException: No EJBContainer provider available
    The following providers:
    org.glassfish.ejb.embedded.EJBContainerProviderImpl
    Returned null from createEJBContainer call.

    at javax.ejb.embeddable.EJBContainer.reportError(EJBContainer.java:186)
    at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:121)
    at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:78)
    at server.HelloBeanTest.testSayHello(HelloBeanTest.java:49)

    Test server.HelloBeanTest FAILED
    C:\guptaDemo\HelloWorld\nbproject\build-impl.xml:902: Some tests failed; see details above.
    BUILD FAILED (total time: 10 seconds)

    Comment by Michael Dudley — July 31, 2010 @ 1:40 pm

  6. Michael,

    Strangely I’ve not seen this error before. Any help to reproduce this would be useful.

    Here are my environment settings:

    ~ >echo $JAVA_HOME
    /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home
    ~ >uname -a
    Darwin Macintosh-187.local 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386 i386
    ~ >java -version
    java version "1.6.0_20"
    Java(TM) SE Runtime Environment (build 1.6.0_20-b02-279-9M3165)
    Java HotSpot(TM) 64-Bit Server VM (build 16.3-b01-279, mixed mode)

    I also see the following warning message in your log:

    WARNING: Error in annotation processing: java.lang.NoClassDefFoundError: build/web/WEB-INF/classes/server/HelloServlet (wrong name: server/HelloServlet)

    Does this project also have a Servlet ?

    Have you tried creating a simple Web project, added only an EJB there, created the unit tests, and run them ?

    -Arun

    Comment by Arun Gupta — July 31, 2010 @ 3:19 pm

  7. Here is my system information.

    Product Version: NetBeans IDE 6.9 (Build 201006101454)
    Java: 1.6.0_18; Java HotSpot(TM) Client VM 16.0-b13
    System: Windows Vista version 6.0 running on x86; Cp1252; en_US (nb)

    Yes, there is a Servlet in the project as well. I was following along with your web cast. I will try your suggestion about creating a new project with only the EJB and see what happens.

    Thank you, Michael

    Comment by Michael Dudley — July 31, 2010 @ 3:51 pm

  8. As you suggested I created a project with only the EJB. When testing I still have the same errors.

    Next I updated my jdk to the following but still had the same errors.

    Product Version: NetBeans IDE 6.9 (Build 201006101454)
    Java: 1.6.0_21; Java HotSpot(TM) 64-Bit Server VM 17.0-b17
    System: Windows Vista version 6.0 running on amd64; Cp1252; en_US (nb)

    I was able to right click and choose "debug test file." When I did this everything runs and the test passes. But when I right click "run file" and right click "test file" both fail.

    I am not sure where to go from here. I will keep googling.

    Comment by Michael Dudley — July 31, 2010 @ 6:23 pm

  9. I broke up the jndi call in my test to get a better idea of where the issue is …

    @Test
    public void testSayHello() throws Exception {
    System.out.println("sayHello");
    String name = "Duke";

    EJBContainer ejbc = EJBContainer.createEJBContainer();
    Context ctx = ejbc.getContext();
    HelloBean instance = (HelloBean) ctx.lookup("java:global/classes/HelloBean");
    //HelloBean instance = (HelloBean)javax.ejb.embeddable.EJBContainer.createEJBContainer().getContext().lookup("java:global/classes/HelloBean");

    String expResult = "Hello Duke";
    String result = instance.sayHello(name);
    assertEquals(expResult, result);

    It is erroring out on this line:
    EJBContainer ejbc = EJBContainer.createEJBContainer();

    Comment by Michael Dudley — July 31, 2010 @ 7:50 pm

  10. Michael,

    Sorry for the issues you are facing. Here is a command-line version of embeddable EJB, see if this works ?

    http://blogs.sun.com/arungupta/entry/totd_128_ejbcontainer_createejbcontainer_embedded

    -Arun

    Comment by Arun Gupta — August 3, 2010 @ 11:34 am

  11. Something is probably wrong as screencast 3 to 5 are based on Eclipse and not NetBeans.

    Comment by Koenraad Van Acker — August 5, 2010 @ 12:11 pm

  12. Koenraad,

    I changed the source of videos and that’s why the order got messed up, now fixed.

    Thanks for the catch!

    Comment by Arun Gupta — August 5, 2010 @ 12:22 pm

  13. Your tutorials are VERY helpful and thanks for providing them.

    I was able to follow first 2 and when I started the 3rd set, I am having problem with my NetBeans IDE, when I need to add folder to WEB-INF. I am missing option to add a folder and it does not show the following options:
    <Interceptor Bindinding Type, Facelets Template Client, Facelets Template, Folder, Java Interfaces>. I downloaded full version and installed sucessfully.
    How do I enable the IDE to show the missing options with right click and New ?

    Comment by baheti — August 10, 2010 @ 8:59 am

  14. baheti,

    Select "New", "Other …", "Other", "Folder" to create the folder.

    Comment by Arun Gupta — August 10, 2010 @ 9:45 am

  15. try to turn off email67

    Comment by Ian Parkin — August 10, 2010 @ 9:53 am

  16. I posted earlier about how to have other options showup in the right click and I figured that out myself. It shows after we use it once from ‘other’.

    Thanks for your great tutorials.

    Comment by baheti — August 10, 2010 @ 10:09 am

  17. I tried to build RESTful Web services from Database and I ended with errors in in the generated code and I deleted those .java files and wanted to rebuild (I am not sure what is the best way to remove the services, once deployed) but how do I get back to be able to rebuild with database?
    Any help is appreciated.

    Thanks

    Comment by baheti — August 10, 2010 @ 3:36 pm

  18. baheti,

    Try creating a new project :-)

    Comment by Arun Gupta — August 10, 2010 @ 3:50 pm

  19. I am not able to retrieve data from Oracle 10g from NetBeans with entity class. Getting SQL exception. Any ideas?

    Thanks

    Comment by baheti — August 20, 2010 @ 7:18 am

  20. I am not able to retrieve data from Oracle 10g from NetBeans with entity class. Getting SQL exception. Any ideas?

    Thanks

    Comment by baheti — August 23, 2010 @ 7:34 am

  21. Hi,
    I found solution to my earlier 3 posts about connecting Oracle 10g from IDE and the SQL exceptions that were problem. I needed to add the driver to the project libraries.

    Thanks.

    Comment by baheti — August 23, 2010 @ 1:00 pm

  22. Thanks for the tutorial, you made complicated thing is easy to understand

    Comment by ndra — September 8, 2010 @ 10:13 am

  23. Hi Arun,

    Good job with the screencasts… very straight and to the point! Very helpful with getting started with both Netbeans and JEE.

    Henlo

    Comment by Henlo — October 5, 2010 @ 6:42 am

  24. Hi, very nice tutorials. I started following your lessons, I was able to finsih part 1, however when I started part 2 I got stuck because I was not able to find the script for the database tables (STATES) you use in your screencast. In fact, I checked my jdbc/sample, I have only "CUSTOMER, DISCOUNT_CODE, MANUFACTURER, MICR_MARKET, PRODUCT, PRODUCT_CODE, PURCHASE_ORDER).

    Question, once the script available, how can we execute those scripts against the DB
    In netbeans ?
    Thanks for your help

    Comment by eliassal — November 30, 2010 @ 12:42 pm

  25. eliassal,

    You can pick any of the available tables to proceed with the screencast.

    Comment by Arun Gupta — December 1, 2010 @ 3:41 am

  26. Arun, regarding 3rd part,i followed our steps and wrote exactly same code in Welcome.java and input.xhtml, when i do a run i get the following error
    /input.xhtml @18,56 value="#{welcome.name}": Target Unreachable, identifier ‘welcome’ resolved to null
    By te way,is it possible to debug xhtml files in Netbeans?
    Thanks for your help

    Comment by eliassal — December 5, 2010 @ 2:16 pm

  27. Arun – Very good tutorial. It all works for me except the JUnit test. I am also getting the same error Michael Dudley reported when running the JUNIT test.
    Any suggestions of ideas how to fix?
    Tks
    Suresh Kumar

    Comment by Suresh Kumar — December 10, 2010 @ 6:38 pm

  28. Arun – I have this problem fixed now, this is what I did, I uninstalled my earlier version of NetBeans6.8 and GF3 server. Also I noticed that the EJB bean and servlet classes to be on the same package, if else it fails.
    Suresh

    Comment by Suresh Kumar — December 10, 2010 @ 7:01 pm

  29. eliassal,

    Have you added @Named annotation on Welcome class ?

    Comment by Arun Gupta — December 14, 2010 @ 5:20 pm

  30. Arun, excellent screencast, I’ve been using tomcat with eclipse for the majority of my projects so was interested to see how NetBeans and GlassFish compared.

    Michael, I know you’ve probably long forgotton about the testing issue, but I had the same issue and found a solution (although not a very elegant one) which I thought I would post in case anyone else faced the same problem. I managed to fix the issue by adding/changing the following lines of code:

    Map properties = new HashMap();
    properties.put(EJBContainer.MODULES, new File("C:\\Development\\Java\\src\\HelloWorld\\build\\web\\WEB-INF\\classes"));
    HelloBean instance = (HelloBean)EJBContainer.createEJBContainer(properties).getContext().lookup("java:global/classes/HelloBean");

    Arun, any ideas why I would have to do this?

    Many Thanks

    Comment by Andrew — February 10, 2011 @ 3:17 am

  31. Andrew,

    Not sure, I need to try it on a Windows environment and then will report back.

    Can you file a bug on netbeans.org/community/issues.html if its reproducible ?

    Comment by Arun Gupta — February 13, 2011 @ 3:41 am

  32. Hi Arun, Thank you for their tutorial are fantastic, I carry out the video 3 because I need user’s login validated against a DataBase …. but when i did your exercising it doesn’t work it leaves this error:

    An Error Occurred:
    /input.xhtml @15,115 value="#{welcome.name}": Target Unreachable, identifier ‘welcome’ resolved to null

    (pd: sorry for my english)

    Comment by Angie — February 15, 2011 @ 2:27 pm

  33. Angie,

    Have you added @Named or @Model annotation on Welcome.java ?

    Comment by Arun Gupta — February 18, 2011 @ 10:14 am

  34. Hi Andrew,
    thanks for your comments. I had the same problem as yours. When I’ve put "properties", the problems were finished!

    Thank you!

    Comment by Serpa — March 19, 2011 @ 3:34 pm

RSS feed for comments on this post. TrackBack URL

Leave a comment

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.
Powered by WordPress