java - CDI deployment failure:WELD-001408 when using CDI beans (Glassfish 4.1) -


Whenever I use cdI managed beans in my enterprise application project, I get a cDi deployment failure: WELD-001408 Exception This is what I get:

  The name of the injection method should start with the "set" mark: javax.preistence.PersistenceUnit Location: public javax.preistence.EntityManager de.syngenio.backend .beans.Resources (Javax.preistence.EntityManagerFactory)  

and exception:

  Exception during lifecycle processing org.glassfish.deployment.com.DeploymentException: CDI Deployment failure: Weld -1011408: Unset dissatisfaction with typing Entity manager financier with qualifier @ default injection point [BackdotatedParameter] parameter 1 [BackendNotated Mode] @ Products @ ConShipSpad @ Precision Unit Public DSNJenio Backend .bin.rishn S.Cent (Entity Managerfactor) D. Syngenio.backend.beans.Resources.create (resources.javaxx)  

This class is:

  public class resources {@Produces @ConversationScoped @ Precision Unit (Unit name = "mongodb-p") becomes public entity manager (EntityManagerFact Ory emf) {return emf.createEntityManager (); } Public Zero Closure (@DiscesAntity Manager) {em.close (); }}  

I'm injecting

  @ Inject Private EntityManager em;  

I am using Glassfish 4.1 and JDK 1.8.0_25-B17

Edit:

Meta-INF / Beans.XML (EJB Project):

  & lt ;? XML version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Beans xmlns = "http://xmlns.jcp.org/xml/ns/javaee" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" XSI: Schema location = "http: / /xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd "version =" 1.1 "Bean-Discovery-Mode =" All "& gt; & Lt; / Bean & gt;  

Meta-INF / persistence.xml:

  & lt ;? XML version = "1.0" encoding = "UTF-8"? & Gt; & Lt; Persistence version = "2.1" xmlns = "http://xmlns.jcp.org/xml/ns/produstence" xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" XSI: Schema Locations = "Http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"> & Lt; Strength unit name = "mongoode-pu" transaction type = "RESOURCE_LOCAL" & gt; & Lt; Provider & gt; Org.eclipse.persistence.jpa.PersistenceProvider & lt; / Provider & gt; & Lt; Properties & gt; & Lt; Property Name = "eclipselink.target-database" value = "org.eclipse.persistence.nosql.adapters.mongo.MongoPlatform" /> & Lt; Property Name = "eclipselink.nosql.connection-spec" value = "org.eclipse.persistence.nosql.adapters.mongo.MongoConnectionSpec" /> & Lt; Property Name = "eclipselink.nosql.property.mongo.port" value = "27017" /> & Lt; Property name = "eclipselink.nosql.property.mongo.host" value = "localhost" /> & Lt; Property Name = "eclipselink.nosql.property.mongo.db" value = "webshop" /> & Lt; Property name = "eclipselink.logging.level" value = "FINEST" /> & Lt; / Properties & gt; & Lt; / Persistence unit & gt; & Lt; / Persistence>  

Using EntityManagerFactory as a parameter in managed methods While doing, you should make sure that EntityManagerFactory will also be injected because your method is "made" managed, all the parameter values, where an @ injection is created in the same way. I do not know why your EntityManagerFactory is not an injection, nor is it the right way to get an example. My suggestion would be: 1. To get your EntityManagerFactory in any other way in your make-up 2. Or write a creator for your EntityManagerFactory and creates a new EntityManagerFactory .


Comments

Popular posts from this blog

HTML/CSS - Automatically set height width from background image? -

php - Mysql Show Process - Sleep Commands and what to do -

c - What is the address of buf (the local variable in the main function)? -