[jboss-user] [EJB 3.0] - Re: can any one help me - having a bad day with ejb3 server

wiggy do-not-reply at jboss.com
Mon May 28 12:52:52 EDT 2007


in fact its worse than that i cant DI to work in the embedded server at all - never mind between it and the 4.2 AS.

i created a very simple test local EJB all in the embedded server project like this .  


  | // test ejb business interface defintion 
  | import javax.ejb.Local;
  | 
  | 
  | @Local
  | public interface Test 
  | {
  | 	public void message (String msg);
  | }
  | 
  | 

with a bean implementation like this 


  | import javax.ejb.Stateless;
  | 
  | 
  | @Stateless 
  | public class TestBean implements Test
  | {
  | 
  | 	public void message (String msg)
  | 	{
  | 		System.out.println ("test bean\n");
  | 	}
  | 
  | }
  | 

I then try and get the DI bit to trigger from the main client section with the main entry point 
calling client : - all in the same project

  | ...
  | public class ClientApp 
  | {
  | 	@EJB (name="Test")
  | 	public Test test;
  | 
  | 	public ClientApp () {}
  | 
  | 	public static void main(String[] args) throws Exception 
  | 	{
  | ... up to 
  | 
  | 	    //try dependency injection!
  | 		
  | 		new ClientApp().init ();
  | 		
  | 	    
  | 
  | 		
  | 		//Shut down EJB container
  | 		EJB3StandaloneBootstrap.shutdown();
  | 
  | 	}
  | 	
  | 	public void init()
  | 	{
  | 		//trigger the DI for test
  | 		test.message("local DI test in embedded container");
  | 	}
  | 	
  | ...
  | 
  | 

this gets the same null pointer ref

anonymous wrote : 
  | 17:42:37,707 INFO  [MCKernelAbstraction] installing bean: jboss.j2ee:jar=bin,name=TestBean,service=EJB3 with dependencies:
  | 17:42:38,638 INFO  [EJBContainer] STARTED EJB: TestBean ejbName: TestBean
  | 17:42:38,779 INFO  [MCKernelAbstraction] installing bean: jboss.j2ee:jar=classes,name=HelloUserBean,service=EJB3 with dependencies:
  | 17:42:38,809 INFO  [EJBContainer] STARTED EJB: app.HelloUserBean ejbName: HelloUserBean
  | Exception in thread "main" java.lang.NullPointerException
  | 	at ClientApp.init(ClientApp.java:75)
  | 	at ClientApp.main(ClientApp.java:62)
  | 

all this code is running in the embedded as server 

what am i doing wrong here ?


Wiggy


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4049092#4049092

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4049092



More information about the jboss-user mailing list