NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
tiv
Joined: 19 Aug 2010 Posts: 3
|
Posted: Thu Aug 19, 2010 11:54 pm Post subject: how can i test an EJB using netbeans? |
|
|
I have been struggling trying to test a super simple EJB project in netbeans. i have tried several examples form my java book, and an even simpler example i found online (http://javadude.wordpress.com/2010/02/22/tutorial-most-simple-test-application-for-embedded-glassfish-netbeans-hudson/). this is a super basic EJB that only just adds two numbers.. that's it!! it runs fine, but no matter how i try to test it, nothing works. even more puzzling, i get two different errors on the two different laptops i test it on. obviously i am doing something very wrong... any advice would be so appreciated.
one error i get is:
------------
Testcase: testAddNumbers(bean.MyBeanTest): Caused an ERROR No EJBContainer provider available: no provider names had been found.
javax.ejb.EJBException: No EJBContainer provider available: no provider names had been found.
------------------
and the other is:
-----------------
SEVERE: Exception while deploying the app java.lang.IllegalArgumentException: Invalid ejb jar [WebTestEmb.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.
------------------------
clearly, i do have an ejb in my project. it is built exactly as in the directions at the url i posted above.
thanks! |
|
| Back to top |
|
 |
jyeary
Joined: 21 Oct 2008 Posts: 606 Location: Simpsonville, SC
|
Posted: Fri Aug 20, 2010 10:53 pm Post subject: Re: how can i test an EJB using netbeans? |
|
|
Skip putting the libs in a separate file unless you understand the details. I did the project like it was indicated in the tutorial and it works.
Servlet AddServlet at /WebApplication1
3
On Thu, Aug 19, 2010 at 7:55 PM, tiv <address-removed ([email]address-removed[/email])> wrote:
| Quote: | I have been struggling trying to test a super simple EJB project in netbeans. i have tried several examples form my java book, and an even simpler example i found online (http://javadude.wordpress.com/2010/02/22/tutorial-most-simple-test-application-for-embedded-glassfish-netbeans-hudson/). this is a super basic EJB that only just adds two numbers.. that's it!! it runs fine, but no matter how i try to test it, nothing works. even more puzzling, i get two different errors on the two different laptops i test it on. obviously i am doing something very wrong... any advice would be so appreciated.
one error i get is:
------------
Testcase: testAddNumbers(bean.MyBeanTest): Caused an ERROR No EJBContainer provider available: no provider names had been found.
javax.ejb.EJBException: No EJBContainer provider available: no provider names had been found.
------------------
and the other is:
-----------------
SEVERE: Exception while deploying the app java.lang.IllegalArgumentException: Invalid ejb jar [WebTestEmb.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.
------------------------
clearly, i do have an ejb in my project. it is built exactly as in the directions at the url i posted above.
thanks!
|
--
John Yeary
--
http://javaevangelist.blogspot.com
"Far better it is to dare mighty things, to win glorious triumphs, even though checkered by failure, than to take rank with those poor spirits who neither enjoy much nor suffer much, because they live in the gray twilight that knows not victory nor defeat."
-- Theodore Roosevelt |
|
| Back to top |
|
 |
tiv
Joined: 19 Aug 2010 Posts: 3
|
Posted: Fri Aug 20, 2010 11:22 pm Post subject: |
|
|
hmmm, not sure what you bean by "skip putting the libs in a separate file"? i did the project exactly as it was in the tutorial. when i did "deply and run" it worked and showed things correctly in my browser. but when i tried the step "execute the test", i got the errors i mentioned above.
any thoughts? |
|
| Back to top |
|
 |
Kenneth Ganfield Posted via mailing list.
|
Posted: Mon Aug 23, 2010 7:30 pm Post subject: Re: how can i test an EJB using netbeans? |
|
|
The tutorial says to create a dedicated folder for project and server
libraries during the project creation step, but you can "skip" that
option. You do not need to create the dedicated library to run or test
the project.
I also had troubles and was getting the "no ejbcontainer provider" error
and did not understand why.
I did get it to run and pass the test after cleaning, redeploying to
server, and then running the test on the project. I am not sure why it
ran successfully after failing a few times with that error.
ken
On 2108//10 24:52 , John Yeary wrote:
| Quote: | Skip putting the libs in a separate file unless you understand the
details. I did the project like it was indicated in the tutorial and it
works.
Servlet AddServlet at /WebApplication1
3
On Thu, Aug 19, 2010 at 7:55 PM, tiv <address-removed
<mailto:address-removed>> wrote:
I have been struggling trying to test a super simple EJB project in
netbeans. i have tried several examples form my java book, and an
even simpler example i found online
(http://javadude.wordpress.com/2010/02/22/tutorial-most-simple-test-application-for-embedded-glassfish-netbeans-hudson/).
this is a super basic EJB that only just adds two numbers.. that's
it!! it runs fine, but no matter how i try to test it, nothing
works. even more puzzling, i get two different errors on the two
different laptops i test it on. obviously i am doing something very
wrong... any advice would be so appreciated.
one error i get is:
------------
Testcase: testAddNumbers(bean.MyBeanTest): Caused an ERROR No
EJBContainer provider available: no provider names had been found.
javax.ejb.EJBException: No EJBContainer provider available: no
provider names had been found.
------------------
and the other is:
-----------------
SEVERE: Exception while deploying the app
java.lang.IllegalArgumentException: Invalid ejb jar
[WebTestEmb.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.
------------------------
clearly, i do have an ejb in my project. it is built exactly as in
the directions at the url i posted above.
thanks!
--
John Yeary
--
http://javaevangelist.blogspot.com
"Far better it is to dare mighty things, to win glorious triumphs, even
though checkered by failure, than to take rank with those poor spirits
who neither enjoy much nor suffer much, because they live in the gray
twilight that knows not victory nor defeat."
-- Theodore Roosevelt |
|
|
| Back to top |
|
 |
tiv
Joined: 19 Aug 2010 Posts: 3
|
Posted: Mon Aug 23, 2010 9:01 pm Post subject: |
|
|
Never mind, looks like i finally got it working. i cant believe this took a week to figure out!
adding:
Map properties = new HashMap();
properties.put(EJBContainer.MODULES, new File("C:\\Documents and Settings\\tiv\\My Documents\\NetBeansProjects\\WebTestEmb\\build\\web\\WEB-INF\\classes"));
and then using those properties in the createEJBContainer() call fixes the error. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|