-
1. Re: How to replace @Inject with @PersistanceContext?
mhi Jul 2, 2005 4:54 AM (in response to mhi)After some editing in the java file I managed to get te compiler to compile the source without any problems. I just cleaned up the code bij removing import statements and only adding the ones really nessesary.
However when I then deploy the application to the Jboss Server, I get the following error
INFO [Ejb3Module] EJB3 deployment time took: 4203
10:44:06,343 WARN [ServiceController] Problem starting service jboss.j2ee:service=EJB3,name=org.jboss.ejb3demo.AuthorsBean
java.lang.TypeNotPresentException: Type javax.ejb.Inject not present -
2. Re: How to replace @Inject with @PersistanceContext?
lordkaos Jul 3, 2005 1:50 AM (in response to mhi)Try removing the import of Inject from the top of your entity class.
Cheers,
Alex. -
3. Re: How to replace @Inject with @PersistanceContext?
engelme Jul 3, 2005 11:35 PM (in response to mhi)Jboss-IDE 1.5M1 has not been fixed to add EJB3-PERISISTENCE.JAR to the class path. This is where the @PersistenceContext is located. Add it to you class path and see what happens
-
4. Re: How to replace @Inject with @PersistanceContext?
mhi Jul 4, 2005 2:38 PM (in response to mhi)Thanks everybody for trying to help me out.
Unfortunatly all the suggested solutions didn't do the trick. Adding the ejb3-persistance.jar to the classpath helped a lot in so far that I could replace @inject with @PersistenceContext in AuthorsBean. However when I deploy the newly created *.war and *.ejb3 files to Jboss 4.0.2 (with EJB 3.0 Beta) Server I still get:
20:23:12,796 INFO [Ejb3Module] EJB3 deployment time took: 4500
20:23:12,890 ERROR [StatelessManager] Starting failed jboss.j2ee:service=EJB3,name=org.jboss.ejb3demo.AuthorsBean
java.lang.TypeNotPresentException: Type javax.ejb.Inject not present
at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:98)
I will try to figure it out, but some extra help will be appreciated.
Michiel -
5. Re: How to replace @Inject with @PersistanceContext?
elkner Jul 4, 2005 6:11 PM (in response to mhi)Use eclipse and make a Ctrl+Shift+O on each src file ;-)
-
6. Re: How to replace @Inject with @PersistanceContext?
bill.burke Jul 5, 2005 11:49 AM (in response to mhi)Delete *all* of your class files and recompile.
-
7. Re: How to replace @Inject with @PersistanceContext?
mhi Jul 5, 2005 5:16 PM (in response to mhi)Thanks everybody for helping me out. Deleting the class files did the trick.
Unfortunately I'm stuck with the next problem.
After the successful deployment of the application on Jboss 4.0.3 I get the following error after I press the articles button for the very first time:
javax.ejb.EJBException: null; CausedByException is:
detached entity passed to persist: org.jboss.ejb3demo.Author
org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:46)
org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:70)
org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:134)
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:72)
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:39)
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:63)
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:93)
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:183)
org.jboss.aop.Dispatcher.invoke(Dispatcher.java:107)
org.jboss.aspects.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:30)
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:79)
$Proxy73.addArticle(Unknown Source)
org.jboss.ejb3demo.web.AuthorServlet.createArticles(AuthorServlet.java:54)
org.jboss.ejb3demo.web.AuthorServlet.doPost(AuthorServlet.java:42)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81) -
8. Re: How to replace @Inject with @PersistanceContext?
elkner Jul 6, 2005 8:32 AM (in response to mhi)"MHI" wrote:
detached entity passed to persist: org.jboss.ejb3demo.Author
So, perhaps you need a refresh/merge instead of a persist ...