smallufo wrote: > I can now pinpoint the error , > It's because I declare the PersistenceContextType > to PersistenceContextType.EXTENDED !!! > I don't know why resin cannot initialize EXTENDED PersistenceContext Because extended is only allowed when it's integrated with a stateful session bean and we haven't finished that part of EJB yet.
(I've never been certain that extended is a good idea. With connection pooling, the normal transaction should be equivalent.) -- Scott > > Maybe caucho should look into the PersistenceContextGenerator.java , > create() method > > try { > if (PersistenceContextType.EXTENDED.equals(_type)) { > _manager = create(EntityManager.class, > new AnnotationLiteral<JpaPersistenceContext>() { > public String value() { return _unitName; } > public boolean extended() { return true; } > }); > } > > > 2010/3/22 smallufo <small...@gmail.com <mailto:small...@gmail.com>> > > After a whole day work (but in vain) , I modified my code : > > I take off all hibernate-related settings/libraries from > persistence.xml and maven dependencies , I just want to first use > resin's Amber to test whether CanDI works... > > This is database settings in resin-web.xml : > > <database jndi-name="jdbc/mining"> > <driver type="com.mysql.jdbc.Driver"> > > > <url>jdbc:mysql://db/mining?useUnicode=true&characterEncoding=UTF8</url> > <user>adm</user> > <password>pwd</password> > </driver> > <max-connections>100</max-connections> > </database> > > > This is persistence.xml : > > <persistence xmlns="http://java.sun.com/xml/ns/persistence" > version="1.0"> > <persistence-unit name="mining" transaction-type="RESOURCE_LOCAL"> > <non-jta-data-source>jdbc/mining</non-jta-data-source> > <class>foo.Person</class> > </properties> > </persistence-unit> > </persistence> > > When resin inits , I can see Amber successfully get the connection > , and build the connection pool (ManagedPoolItem) . > > But I still cannot get PersonDao's implementation , it seems resin > cannot successfully create the PersistenceContext , here is the > FINER log dump : > > > > WebApp[http://test.smallufo.com/testapp-1] map (uri:/hello -> hello) > Dispatch '/hello' to > AccessLogFilterChain[http://test.smallufo.com/testapp-1, > next=WebAppFilterChain[http://test.smallufo.com/testapp-1, > next=ServletFilterChain[hello]]] > com.caucho.config.ConfigException: foo.HelloServlet.personDao: > foo.PersonDaoImpl.entityManager java.lang.NullPointerException > at > com.caucho.config.ConfigException.create(ConfigException.java:99) > at > com.caucho.config.ConfigException.create(ConfigException.java:125) > at > > com.caucho.config.inject.InjectionTargetImpl$FieldInjectProgram.inject(InjectionTargetImpl.java:811) > at > > com.caucho.config.inject.InjectionTargetImpl.inject(InjectionTargetImpl.java:266) > at > > com.caucho.server.dispatch.ServletConfigImpl.createServletImpl(ServletConfigImpl.java:1260) > at > > com.caucho.server.dispatch.ServletConfigImpl.createServlet(ServletConfigImpl.java:1142) > at > > com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:98) > at > > com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:183) > at > > com.caucho.server.webapp.AccessLogFilterChain.doFilter(AccessLogFilterChain.java:103) > at > > com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:286) > at > com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:775) > at > > com.caucho.server.connection.TcpConnection.dispatchRequest(TcpConnection.java:600) > at > > com.caucho.server.connection.TcpConnection.handleRequestsImpl(TcpConnection.java:566) > at > > com.caucho.server.connection.TcpConnection.handleRequests(TcpConnection.java:519) > at > > com.caucho.server.connection.TcpConnection$AcceptTask.doTask(TcpConnection.java:1100) > at > > com.caucho.server.connection.TcpConnection$ConnectionReadTask.runThread(TcpConnection.java:1037) > at > > com.caucho.server.connection.TcpConnection$AcceptTask.run(TcpConnection.java:1068) > at > com.caucho.util.ThreadPool$PoolThread.runTasks(ThreadPool.java:901) > at > com.caucho.util.ThreadPool$PoolThread.run(ThreadPool.java:866) > Caused by: com.caucho.config.ConfigException: > foo.PersonDaoImpl.entityManager java.lang.NullPointerException > at > com.caucho.config.ConfigException.create(ConfigException.java:102) > at > > com.caucho.config.j2ee.PersistenceContextGenerator.create(PersistenceContextGenerator.java:121) > at > > com.caucho.config.program.FieldGeneratorProgram.inject(FieldGeneratorProgram.java:84) > at > > com.caucho.config.inject.InjectionTargetImpl$FieldHandlerProgram.inject(InjectionTargetImpl.java:860) > at > > com.caucho.config.inject.InjectionTargetImpl.inject(InjectionTargetImpl.java:266) > at > com.caucho.config.inject.ManagedBeanImpl.create(ManagedBeanImpl.java:149) > at > > com.caucho.config.inject.InjectManager.getInstanceRec(InjectManager.java:1347) > at > > com.caucho.config.inject.InjectManager.getReference(InjectManager.java:1311) > at > > com.caucho.config.inject.InjectManager.getInjectableReference(InjectManager.java:1509) > at > > com.caucho.config.inject.InjectionTargetImpl$FieldInjectProgram.inject(InjectionTargetImpl.java:807) > ... 16 more > Caused by: java.lang.NullPointerException > at > > com.caucho.config.inject.InjectManager.getInstanceRec(InjectManager.java:1337) > at > > com.caucho.config.inject.InjectManager.getReference(InjectManager.java:1311) > at > com.caucho.config.j2ee.WebBeanGenerator.create(WebBeanGenerator.java:66) > at > > com.caucho.config.j2ee.PersistenceContextGenerator.create(PersistenceContextGenerator.java:108) > ... 24 more > Http[5] HTTP/1.1 500 Internal Server Error > > > I've stuck with this problem for days , but cannot find an answer ... > I'm very appreciated if somebody helps me... thanks. > > I am using Resin (non-Pro) 4.0.5 > > > ------------------------------------------------------------------------ > > _______________________________________________ > resin-interest mailing list > resin-interest@caucho.com > http://maillist.caucho.com/mailman/listinfo/resin-interest > _______________________________________________ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest