[jboss-user] [EJB/JBoss] - Annotation Excepton durng Deployment

ashusri000 do-not-reply at jboss.com
Mon Jul 9 00:53:02 EDT 2007


Hi All ...
I am getting this exception while deploying an ear which contains a call to the entity bean from a session bean , does anybody have an idea where the things are going wrong :

    code:

      09:44:13,765 WARN  [ServiceController] Problem starting service jboss.j2ee:service=EJB3,module=persist.jar
    java.lang.RuntimeException: You did not specify a @Resource.mappedName() on private javax.persistence.EntityManagerFactory src.FirstSessionBean.emf and there is no binding for enc name env/src.FirstSessionBean/emf in XML
    	at org.jboss.injection.ResourceHandler.handlePropertyAnnotation(ResourceHandler.java:506)
    	at org.jboss.injection.ResourceHandler.handleFieldAnnotations(ResourceHandler.java:325)
    	at org.jboss.injection.InjectionUtil.processFieldAnnotations(InjectionUtil.java:137)
    	at org.jboss.injection.InjectionUtil.processAnnotations(InjectionUtil.java:174)
    	at org.jboss.ejb3.EJBContainer.processMetadata(EJBContainer.java:354)
    	at org.jboss.ejb3.SessionContainer.processMetadata(SessionContainer.java:120)
    	at org.jboss.ejb3.Ejb3Deployment.processEJBContainerMetadata(Ejb3Deployment.java:288)
    	at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:338)
    	at org.jboss.ejb3.Ejb3Module.startService(Ejb3Module.java:91)
    	at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
    	at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
    	at sun.reflect.GeneratedMethodAccessor17.invoke(Unknown Source)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    	at java.lang.reflect.Method.invoke(Unknown Source)
    	at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
    	at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
    	at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
    	at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
    	at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
    	at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
    	at $Proxy0.start(Unknown Source)
    	at org.jboss.system.ServiceController.start(ServiceController.java:417)
    	at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)  



My code goes like this (I have put it in a servlet) ::


    code:

      	
    	// set the JNDI Properties
    		Properties props = new Properties();
     	    props.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
     	    props.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
       	    props.setProperty("java.naming.provider.url", "localhost:1099");
    //   	    Session mySession= SessionManager.getManager().getSession("comics");
    //   	    ((JNDIConnector)((Session) mySession).getLogin().getConnector()).setLookupType(JNDIConnector.STRING_LOOKUP);
            
       	    
       	 
        // invoke the session bean object 	
       	    try {
       	        Context context = new InitialContext(props);
    //    	    DatabaseLogin login = (DatabaseLogin)mySession.getProject().getLogin();
    //    	    javax.sql.DataSource ds = (javax.sql.DataSource) context.lookup("java:system");
    //    	    System.out.println("Data Source "+ds);
    //    	    JNDIConnector connector = new JNDIConnector(ds);
    //    	    login.setConnector(connector);
       	        
    			src.FirstSession myBeabObj = (src.FirstSession) context.lookup("sample123/FirstSessionBean/remote");
    			myBeabObj.sayHello(Name, Age, Dept);
       	        PrintWriter pwWriter = response.getWriter();
       	        pwWriter.println("Before calling Persistence");
                
       	        
    //   	        new entityCaller().persistEntity(Name, iAge);
       	        
       	        
       	        pwWriter.println("After calling Persistence");
    			pwWriter.println("new Deployment"+System.currentTimeMillis());
    			pwWriter.println("You submitted Age"+Name);
    			pwWriter.println("You submitted Age"+Age);
    			pwWriter.println("You submitted Age"+Dept);
    //			pwWriter.println("The Bean returned this value"+myBeabObj.sayHello(Name , Age , Dept ));
    			System.out.println("Finished Transaction");
    		} catch (NamingException e) {
    			
    			System.out.println("Exception Reached");
    			e.printStackTrace();
    		}// end of try catch block  

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

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



More information about the jboss-user mailing list