Hi What's your persistence.xml look like? <-- Here it it: (as per the JPA integration instruction)?
<?xml version="1.0" encoding="UTF-8"?> <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0"> <persistence-unit name="DemoUnit" transaction-type="RESOURCE_LOCAL"> <properties> <property name="javax.persistence.jdbc.driver" value="org.h2.Driver" /> <property name="javax.persistence.jdbc.url" value="jdbc:h2:mem:test" /> <property name="javax.persistence.jdbc.username" value="sa" /> <property name="eclipselink.ddl-generation" value="create-tables"/> <property name="eclipselink.logging.level" value="fine"/> </properties> </persistence-unit> </persistence> Where exactly should the persistence.xml file be located? In the doc it says: "and is expected to be located on the classpath in the * META-INF* directory." Is that under the WEB-INF directory? Do you get login messages int he logs for EclipseLink? <-- No. What are the contents of your WEB-INF/lib? <-- There is no lib older under WEB-INF in my sample app? AppModule.java? <-- Here is it (much the same as in the Hibernate / Tutorial sample app). (I didn't add any of the configuration code mentioned in the JPA instructions as I understood this was needed only in XML-less JPA configuration package com.example.jpa.services; import java.io.IOException; import org.apache.tapestry5.*; import org.apache.tapestry5.ioc.Configuration; import org.apache.tapestry5.ioc.MappedConfiguration; import org.apache.tapestry5.ioc.OrderedConfiguration; import org.apache.tapestry5.ioc.ServiceBinder; import org.apache.tapestry5.ioc.annotations.Contribute; import org.apache.tapestry5.ioc.annotations.Local; import org.apache.tapestry5.services.Request; import org.apache.tapestry5.services.RequestFilter; import org.apache.tapestry5.services.RequestHandler; import org.apache.tapestry5.services.Response; import org.slf4j.Logger; /** * This module is automatically included as part of the Tapestry IoC Registry, it's a good place to * configure and extend Tapestry, or to place your own service definitions. */ public class AppModule { public static void bind(ServiceBinder binder) { // binder.bind(MyServiceInterface.class, MyServiceImpl.class); // Make bind() calls on the binder object to define most IoC services. // Use service builder methods (example below) when the implementation // is provided inline, or requires more initialization than simply // invoking the constructor. } public static void contributeApplicationDefaults( MappedConfiguration<String, String> configuration) { // Contributions to ApplicationDefaults will override any contributions to // FactoryDefaults (with the same key). Here we're restricting the supported // locales to just "en" (English). As you add localised message catalogs and other assets, // you can extend this list of locales (it's a comma separated series of locale names; // the first locale name is the default when there's no reasonable match). configuration.add(SymbolConstants.SUPPORTED_LOCALES, "en"); // The factory default is true but during the early stages of an application // overriding to false is a good idea. In addition, this is often overridden // on the command line as -Dtapestry.production-mode=false configuration.add(SymbolConstants.PRODUCTION_MODE, "false"); // The application version number is incorprated into URLs for some // assets. Web browsers will cache assets because of the far future expires // header. If existing assets are changed, the version number should also // change, to force the browser to download new versions. configuration.add(SymbolConstants.APPLICATION_VERSION, "1.0-SNAPSHOT"); } /** * This is a service definition, the service will be named "TimingFilter". The interface, * RequestFilter, is used within the RequestHandler service pipeline, which is built from the * RequestHandler service configuration. Tapestry IoC is responsible for passing in an * appropriate Logger instance. Requests for static resources are handled at a higher level, so * this filter will only be invoked for Tapestry related requests. * * <p> * Service builder methods are useful when the implementation is inline as an inner class * (as here) or require some other kind of special initialization. In most cases, * use the static bind() method instead. * * <p> * If this method was named "build", then the service id would be taken from the * service interface and would be "RequestFilter". Since Tapestry already defines * a service named "RequestFilter" we use an explicit service id that we can reference * inside the contribution method. */ public RequestFilter buildTimingFilter(final Logger log) { return new RequestFilter() { public boolean service(Request request, Response response, RequestHandler handler) throws IOException { long startTime = System.currentTimeMillis(); try { // The responsibility of a filter is to invoke the corresponding method // in the handler. When you chain multiple filters together, each filter // received a handler that is a bridge to the next filter. return handler.service(request, response); } finally { long elapsed = System.currentTimeMillis() - startTime; log.info(String.format("Request time: %d ms", elapsed)); } } }; } /** * This is a contribution to the RequestHandler service configuration. This is how we extend * Tapestry using the timing filter. A common use for this kind of filter is transaction * management or security. The @Local annotation selects the desired service by type, but only * from the same module. Without @Local, there would be an error due to the other service(s) * that implement RequestFilter (defined in other modules). */ public void contributeRequestHandler(OrderedConfiguration<RequestFilter> configuration, @Local RequestFilter filter) { // Each contribution to an ordered configuration has a name, When necessary, you may // set constraints to precisely control the invocation order of the contributed filter // within the pipeline. configuration.add("Timing", filter); } } On Wed, Aug 10, 2011 at 7:34 PM, Lenny Primak <lpri...@hope.nyc.ny.us>wrote: > I think your issue is environmental. What's your persistence.xml look > like? > AppModule.java? Do you get login messages int he logs for EclipseLink? > What are the contents of your WEB-INF/lib? > > > On Aug 10, 2011, at 12:27 PM, Igor Drobiazko wrote: > > > Looks like your PersistenceManager is null. You need to share some of > your > > code with us in order to get help. > > > > On Wed, Aug 10, 2011 at 5:35 PM, mat -- <mat...@gmail.com> wrote: > > > >> Hi > >> > >> Also make sure your entities are in he correct entities package <-- I > think > >> I have same files structure as in the Tapestry tutorial: > >> > >> - Address.java in entities package > >> - Index.java in pages package > >> - CreateAddress.java in pages.address package > >> - AppModule.java in services package > >> > >> Can you give a full exception listing <--- Here is it: > >> > >> > >> - locationclasspath:com/example/jpa/pages/Index.tml, line 29 > >> - java.lang.NullPointerExceptionHide uninteresting stack framesStack > >> trace > >> - com.example.jpa.pages.Index.getAddresses(Index.java:33) > >> - > >> > >> > org.apache.tapestry5.internal.bindings.PropBinding.get(PropBinding.java:59) > >> - > >> > >> > org.apache.tapestry5.internal.transform.ParameterWorker$2$1.readFromBinding(ParameterWorker.java:328) > >> - > >> > >> > org.apache.tapestry5.internal.transform.ParameterWorker$2$1.get(ParameterWorker.java:427) > >> - > >> > >> > org.apache.tapestry5.internal.transform.BridgeClassTransformation$BridgeTransformField$WrapFieldHandleForFieldValueConduitAsFieldConduit.get(BridgeClassTransformation.java:210) > >> - > >> > >> > org.apache.tapestry5.corelib.components.Grid.getfieldvalue_source(Grid.java) > >> - > >> > >> > org.apache.tapestry5.corelib.components.Grid.setupDataSource(Grid.java:459) > >> - > >> > >> org.apache.tapestry5.corelib.components.Grid.setupRender(Grid.java:445) > >> - > >> > org.apache.tapestry5.corelib.components.Grid$Shim_2ba81c88b285.invoke(Unknown > >> Source) > >> - > >> > >> > org.apache.tapestry5.internal.plastic.MethodHandleImpl.invoke(MethodHandleImpl.java:48) > >> - > >> > >> > org.apache.tapestry5.internal.transform.BridgeClassTransformation$WrapMethodHandleAsMethodAccess.invoke(BridgeClassTransformation.java:84) > >> - > >> > >> > org.apache.tapestry5.internal.transform.RenderPhaseMethodWorker$Invoker.invoke(RenderPhaseMethodWorker.java:117) > >> - > >> > >> > org.apache.tapestry5.internal.transform.RenderPhaseMethodWorker$RenderPhaseMethodAdvice.advise(RenderPhaseMethodWorker.java:86) > >> - > >> > >> > org.apache.tapestry5.internal.transform.BridgeClassTransformation$WrapMethodAdviceAsComponentMethodAdvice.advise(BridgeClassTransformation.java:348) > >> - > >> > >> > org.apache.tapestry5.internal.plastic.AbstractMethodInvocation.proceed(AbstractMethodInvocation.java:86) > >> - > org.apache.tapestry5.corelib.components.Grid.setupRender(Grid.java) > >> - > >> > >> > org.apache.tapestry5.internal.structure.ComponentPageElementImpl$SetupRenderPhase.invokeComponent(ComponentPageElementImpl.java:230) > >> - > >> > >> > org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPhase.invoke(ComponentPageElementImpl.java:191) > >> - > >> > >> > org.apache.tapestry5.internal.structure.ComponentPageElementImpl$SetupRenderPhase.render(ComponentPageElementImpl.java:237) > >> - > >> > >> > org.apache.tapestry5.internal.services.RenderQueueImpl.run(RenderQueueImpl.java:72) > >> - > >> > >> > org.apache.tapestry5.internal.services.PageRenderQueueImpl.render(PageRenderQueueImpl.java:127) > >> - > >> > >> > org.apache.tapestry5.internal.services.MarkupRendererTerminator.renderMarkup(MarkupRendererTerminator.java:37) > >> - > >> > >> > org.apache.tapestry5.services.TapestryModule$30.renderMarkup(TapestryModule.java:2147) > >> - > >> > >> > org.apache.tapestry5.services.TapestryModule$29.renderMarkup(TapestryModule.java:2131) > >> - > >> > >> > org.apache.tapestry5.services.TapestryModule$28.renderMarkup(TapestryModule.java:2113) > >> - > >> > >> > org.apache.tapestry5.services.TapestryModule$27.renderMarkup(TapestryModule.java:2098) > >> - > >> > >> > org.apache.tapestry5.services.TapestryModule$26.renderMarkup(TapestryModule.java:2084) > >> - > >> > >> > org.apache.tapestry5.services.TapestryModule$25.renderMarkup(TapestryModule.java:2066) > >> - > >> > >> > org.apache.tapestry5.services.TapestryModule$24.renderMarkup(TapestryModule.java:2047) > >> - > >> > >> > org.apache.tapestry5.internal.services.PageMarkupRendererImpl.renderPageMarkup(PageMarkupRendererImpl.java:47) > >> - > >> > >> > org.apache.tapestry5.internal.services.PageResponseRendererImpl.renderPageResponse(PageResponseRendererImpl.java:67) > >> - > >> > >> > org.apache.tapestry5.internal.services.PageRenderRequestHandlerImpl.handle(PageRenderRequestHandlerImpl.java:64) > >> - > >> > >> > org.apache.tapestry5.services.TapestryModule$37.handle(TapestryModule.java:2376) > >> - > >> > >> > org.apache.tapestry5.internal.services.ComponentRequestHandlerTerminator.handlePageRender(ComponentRequestHandlerTerminator.java:48) > >> - > >> > >> > org.apache.tapestry5.services.InitializeActivePageName.handlePageRender(InitializeActivePageName.java:47) > >> - > >> > >> > org.apache.tapestry5.internal.services.PageRenderDispatcher.dispatch(PageRenderDispatcher.java:45) > >> - > >> > >> > org.apache.tapestry5.services.TapestryModule$RequestHandlerTerminator.service(TapestryModule.java:434) > >> - com.example.jpa.services.AppModule$1.service(AppModule.java:94) > >> - > >> > >> > org.apache.tapestry5.internal.services.RequestErrorFilter.service(RequestErrorFilter.java:26) > >> - > >> > >> > org.apache.tapestry5.services.TapestryModule$3.service(TapestryModule.java:1055) > >> - > >> > >> > org.apache.tapestry5.services.TapestryModule$2.service(TapestryModule.java:1045) > >> - > >> > >> > org.apache.tapestry5.internal.services.StaticFilesFilter.service(StaticFilesFilter.java:90) > >> - > >> > >> > org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:105) > >> - > >> > >> > org.apache.tapestry5.internal.services.CheckForUpdatesFilter$2.invoke(CheckForUpdatesFilter.java:95) > >> - > >> > >> > org.apache.tapestry5.ioc.internal.util.ConcurrentBarrier.withRead(ConcurrentBarrier.java:85) > >> - > >> > >> > org.apache.tapestry5.internal.services.CheckForUpdatesFilter.service(CheckForUpdatesFilter.java:119) > >> - > >> > >> > org.apache.tapestry5.services.TapestryModule$HttpServletRequestHandlerTerminator.service(TapestryModule.java:385) > >> - > >> > >> > org.apache.tapestry5.internal.gzip.GZipFilter.service(GZipFilter.java:53) > >> - > >> > >> > org.apache.tapestry5.internal.services.IgnoredPathsFilter.service(IgnoredPathsFilter.java:62) > >> - > >> > >> > org.apache.tapestry5.services.TapestryModule$1.service(TapestryModule.java:1005) > >> - > >> > org.apache.tapestry5.TapestryFilter.doFilter(TapestryFilter.java:147) > >> > >> Tapestry FrameworkTapestry Version5.3.0Application Version1.0-SNAPSHOT > >> > >> On Wed, Aug 10, 2011 at 6:18 PM, Lenny Primak <lpri...@hope.nyc.ny.us > >>> wrote: > >> > >>> Can you give a full exception listing? Also make sure your entities > are > >> in > >>> he correct entities package. > >>> > >>> > >>> > >>> On Aug 10, 2011, at 11:02 AM, mat -- <mat...@gmail.com> wrote: > >>> > >>>> Hi there, > >>>> > >>>> I have run the Hibernate version of the Tapestry tutorial: > >>>> http://tapestry.apache.org/using-tapestry-with-hibernate.html and it > >>> works > >>>> fine for me. > >>>> > >>>> I am now trying to integrate it with the new 5,3 Tapestry version, > >>> running > >>>> JPA instead of Hibernate. > >>>> > >>>> I have read instructions at > >>>> http://tapestry.apache.org/integrating-with-jpa.html, but I am not > >> sure > >>> I > >>>> understand how to put the different parts together. > >>>> > >>>> Since I no longer use Hibernate session, I have replaced in Index.java > >>> page: > >>>> > >>>> ... this code: > >>>> > >>>> /* @Inject > >>>> private Session session; > >>>> public List<Address> getAddresses() > >>>> { > >>>> return session.createCriteria(Address.class).list(); > >>>> }*/ > >>>> > >>>> ... with this one: > >>>> > >>>> @PersistenceContext > >>>> private EntityManager em; > >>>> public List<Address> getAddresses() > >>>> { > >>>> Query query = em.createQuery("SELECT a FROM Address a"); > >>>> return query.getResultList(); > >>>> } > >>>> > >>>> But I am getting this error in <t:grid source="addresses"/> of > >> Index.tml: > >>>> > >>>> Render queue error in SetupRender[Index:grid]: Failure reading > >> parameter > >>>>> 'source' of component Index:grid: > >>>>> org.apache.tapestry5.ioc.internal.util.TapestryException > >>>> > >>>> > >>>> Could someone explain what is the issue in the above code? > >>>> > >>>> Also, could someone briefly list/describe the tasks which are needed > to > >>>> switch the Tapestry tutorial from Hibernate to JPA support. > >>>> > >>>> Regards > >>>> > >>>> Mat > >>> > >>> --------------------------------------------------------------------- > >>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > >>> For additional commands, e-mail: users-h...@tapestry.apache.org > >>> > >>> > >> > > > > > > > > -- > > Best regards, > > > > Igor Drobiazko > > http://tapestry5.de > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > >