Ironic, in writing tests I added a constructor to inject the container but
forgot to add the default constructor to that one class. Feeling pleased
with myself at my use of TDD I then assumed it was going to 1.10.0-SNAPSHOT
that was the source of the error.

On Mon, Oct 26, 2015 at 7:51 AM, Stephen Cameron <[email protected]
> wrote:

> Oops, embarrasement++ No public no-args constructor!
>
> On Sun, Oct 25, 2015 at 10:09 PM, Stephen Cameron <
> [email protected]> wrote:
>
>> Just removing the 'offending' class allows the webapp to run... Will try
>> to figure out what it might be that is offensive tomorrow.
>>
>> On Sun, Oct 25, 2015 at 7:05 AM, Stephen Cameron <
>> [email protected]> wrote:
>>
>>> Seems its not a classpath issue, the built jetty-console jar has the
>>> same problem, that has the app dom jar inside it. Not solved but I looking
>>> for an answer in the wrong place it appears.
>>>
>>> On Sat, Oct 24, 2015 at 9:32 PM, Dan Haywood <
>>> [email protected]> wrote:
>>>
>>>> With Eclipse (as I'm sure you know) the m2e plugin generates the
>>>> .project
>>>> and .classpath files from the maven pom.xml files.  Doing an update
>>>> project
>>>> from the context menu of the package explorer view is generally pretty
>>>> reliable.  Thereafter Eclipse just uses its .classpath and .project.
>>>>
>>>> Another thing to do is to look at the dependency tree tab of the
>>>> pom.xml,
>>>> check it looks correct.  It's also possible to view the dependencies as
>>>> per
>>>> the .classpath file, by viewing the build path, eg [1]
>>>>
>>>> When you run the app up, the Debug view (IIRC) shows the actual Java
>>>> command that Eclipse constructs, along with all the JARs constructed
>>>> from
>>>> the classpath.  That might also provide some clues.
>>>>
>>>> HTH
>>>> Dan
>>>>
>>>>
>>>> [1] http://www.tutorialspoint.com/eclipse/eclipse_java_build_path.htm
>>>>
>>>> On 24 October 2015 at 11:27, Stephen Cameron <
>>>> [email protected]>
>>>> wrote:
>>>>
>>>> > Hi
>>>> >
>>>> > I'll have another go tomorrow, I am using Eclipse and can get the
>>>> simpleapp
>>>> > on Isis 1.10.0 imported and webapp starting fine, its just when I try
>>>> to go
>>>> > from there by adding my dom classes and changing the dom module
>>>> 'marker'
>>>> > class something breaks, also going from a fresh install of my app and
>>>> > updating the poms from the simpleapp too.
>>>> >
>>>> > I assume if Guice cannot find a class file it gives that error, so its
>>>> > seems my classes are not be on the classpath, but as to why is where
>>>> my
>>>> > knowledge is not very good. I was just hoping someone else might have
>>>> had
>>>> > the same thing happen.
>>>> >
>>>> > On Sat, Oct 24, 2015 at 9:16 PM, Jeroen van der Wal <
>>>> [email protected]>
>>>> > wrote:
>>>> >
>>>> > > And removing ~/,m2/repository/org/apache/isis before mvn clean
>>>> install is
>>>> > > also worth trying.
>>>> > >
>>>> > > On 24 October 2015 at 12:13, Jeroen van der Wal <
>>>> [email protected]>
>>>> > > wrote:
>>>> > >
>>>> > > > You could try a mvn clean install and reimport the project into
>>>> > Intellij.
>>>> > > >
>>>> > > > On 24 October 2015 at 03:01, Stephen Cameron <
>>>> > [email protected]
>>>> > > >
>>>> > > > wrote:
>>>> > > >
>>>> > > >> What do I have to change to go from 1.9.0 to 1.10.0-SNAPSHOT?
>>>> > > >>
>>>> > > >>  I just changed version number in pom.xml but then I get the
>>>> dreaded
>>>> > > guice
>>>> > > >> cannot instantiate class ... error, last time I fixed this by
>>>> updating
>>>> > > >> simpleapp with my classes.  Now it looks like the same thing is
>>>> > required
>>>> > > >> again to get a working version :(
>>>> > > >>
>>>> > > >>
>>>> > > >>
>>>> > > >> On Thu, Oct 22, 2015 at 12:44 AM, Cesar Lugo <
>>>> > [email protected]>
>>>> > > >> wrote:
>>>> > > >>
>>>> > > >> > Great!
>>>> > > >> >
>>>> > > >> > -----Original Message-----
>>>> > > >> > From: Dan Haywood [mailto:[email protected]]
>>>> > > >> > Sent: Wednesday, October 21, 2015 2:57 AM
>>>> > > >> > To: users
>>>> > > >> > Subject: Re: Automatic created-by and modified-by property
>>>> updates
>>>> > > >> >
>>>> > > >> > Just to close off this thread... in 1.10.0-SNAPSHOT there is
>>>> > built-in
>>>> > > >> > support for this feature... just implement Timetstampable [1]
>>>> > > >> >
>>>> > > >> > Cheers
>>>> > > >> > Dan
>>>> > > >> >
>>>> > > >> > [1] http://isis.apache.org/guides/rg.html#_rg_classes_roles
>>>> > > >> >
>>>> > > >> > On 28 September 2015 at 04:01, Stephen Cameron <
>>>> > > >> [email protected]
>>>> > > >> > >
>>>> > > >> > wrote:
>>>> > > >> >
>>>> > > >> > > Hi Dan,
>>>> > > >> > >
>>>> > > >> > > I tried this and its not correct, I get the open and close
>>>> methods
>>>> > > >> > > being called over and over whenever I open and close an
>>>> object in
>>>> > > the
>>>> > > >> > > UI. but the jdo listener method preStore
>>>> (InstanceLifecycleEvent
>>>> > > >> > > event) never gets called.
>>>> > > >> > >
>>>> > > >> > > I pictured open()  and close() being called just once as the
>>>> > DOMAIN
>>>> > > >> > > service singleton is created by Isis and then it listens on
>>>> the
>>>> > JDO
>>>> > > >> > > events as each entity goes through its lifecycle.
>>>> > > >> > >
>>>> > > >> > >  I will put this aside as its not the main priority. I'll
>>>> read up
>>>> > > and
>>>> > > >> > > understand the jdo events to find an answer, this must be
>>>> close to
>>>> > > >> > correct.
>>>> > > >> > >
>>>> > > >> > >
>>>> > > >> > > On Wed, Sep 16, 2015 at 4:02 PM, Dan Haywood
>>>> > > >> > > <[email protected]
>>>> > > >> > > >
>>>> > > >> > > wrote:
>>>> > > >> > >
>>>> > > >> > > > Hi Steve,
>>>> > > >> > > >
>>>> > > >> > > > Although there isn't any direct support for this, it's
>>>> should be
>>>> > > >> > > relatively
>>>> > > >> > > > easy to do by using the underlying JDO API.
>>>> > > >> > > >
>>>> > > >> > > > As a quick code sketch:
>>>> > > >> > > >
>>>> > > >> > > > public interface CreateTrackingEntity {
>>>> > > >> > > >     void setCreatedBy(String createdBy);
>>>> > > >> > > >     void setCreatedOn(DateTime createdOn); }
>>>> > > >> > > >
>>>> > > >> > > > public interface ModifyTrackingEntity {
>>>> > > >> > > >     void setModifiedBy(String username);
>>>> > > >> > > >     void setModifiedOn(DateTime modifiedOn); }
>>>> > > >> > > >
>>>> > > >> > > >
>>>> > > >> > > > Your entity should implement one or both of the above.
>>>> > > >> > > >
>>>> > > >> > > > Then, define a service such as:
>>>> > > >> > > >
>>>> > > >> > > > @RequestScoped
>>>> > > >> > > > @DomainService(nature=NatureOfService.DOMAIN)
>>>> > > >> > > > public class UpdateableEntityServices implements
>>>> > > >> > > > javax.jdo.listener.StoreLifecycleListener {
>>>> > > >> > > >
>>>> > > >> > > >     @PostConstruct
>>>> > > >> > > >     public void open() {
>>>> > > >> > > >
>>>> > > >> > > >
>>>> > > >> > > >
>>>> > > >> > >
>>>> > > >> >
>>>> > > >>
>>>> > >
>>>> >
>>>> isisJdoSupport.getJdoPersistenceManager().addInstanceLifecycleListener(this);
>>>> > > >> > > >     }
>>>> > > >> > > >
>>>> > > >> > > >     @PreDestroy
>>>> > > >> > > >     public void close() {
>>>> > > >> > > >
>>>> > > >> > > >
>>>> > > >> > > >
>>>> > > >> > >
>>>> > > >> >
>>>> > > >>
>>>> > >
>>>> >
>>>> isisJdoSupport.getJdoPersistenceManager().removeInstanceLifecycleListener(this);
>>>> > > >> > > >     }
>>>> > > >> > > >
>>>> > > >> > > >     @Programmatic
>>>> > > >> > > >     public void preStore (InstanceLifecycleEvent event) {
>>>> > > >> > > >
>>>> > > >> > > >         final Object pi = event.getPersistentInstance();
>>>> > > >> > > >
>>>> > > >> > > >         if(pi instanceof
>>>> > org.datanucleus.enhancement.Persistable)
>>>> > > {
>>>> > > >> > > >             boolean isPersistent =
>>>> > > >> > > >
>>>> ((org.datanucleus.enhancement.Persistable)pi).dnIsPersistent();
>>>> > > >> > > >
>>>> > > >> > > >             if(!isPersistent) {
>>>> > > >> > > >                 if(pi instanceof CreateTrackingEntity) {
>>>> > > >> > > >
>>>> > > >> > > >
>>>> > ((CreateTrackingEntity)pi).setCreatedBy(container.getUserName());
>>>> > > >> > > >
>>>> > > >> > > >
>>>> > > >>
>>>> ((CreateTrackingEntity)pi).setCreatedOn(clockService.nowAsDateTime());
>>>> > > >> > > >                 }
>>>> > > >> > > >             } else {
>>>> > > >> > > >                 if(pi instanceof ModifyTrackingEntity) {
>>>> > > >> > > >
>>>> > > >> > > >
>>>> > > ((ModifyTrackingEntity)pi).setModifiedBy(container.getUserName());
>>>> > > >> > > >
>>>> > > >> > > >
>>>> > > >>
>>>> ((ModifyTrackingEntity)pi).setModifedOn(clockService.nowAsDateTime());
>>>> > > >> > > >                 }
>>>> > > >> > > >             }
>>>> > > >> > > >         }
>>>> > > >> > > >     }
>>>> > > >> > > >
>>>> > > >> > > >     @Programmatic
>>>> > > >> > > >     public void postStore (InstanceLifecycleEvent event) {
>>>> > > >> > > >         // no-op
>>>> > > >> > > >     }
>>>> > > >> > > >
>>>> > > >> > > >     @Inject
>>>> > > >> > > >     private DomainObjectContainer container;
>>>> > > >> > > >
>>>> > > >> > > >     @Inject
>>>> > > >> > > >     private ClockService clockService;
>>>> > > >> > > >
>>>> > > >> > > >     @Inject
>>>> > > >> > > >     private IsisJdoSupport isisJdoSupport;
>>>> > > >> > > > }
>>>> > > >> > > >
>>>> > > >> > > >
>>>> > > >> > > >
>>>> > > >> > > > ~~~~~~~~~~~~
>>>> > > >> > > > There is actually a ticket in JIRA for this [1], so I'll
>>>> > formalize
>>>> > > >> this
>>>> > > >> > > as
>>>> > > >> > > > a service in Isis 1.10.0.
>>>> > > >> > > >
>>>> > > >> > > > HTH
>>>> > > >> > > > Dan
>>>> > > >> > > >
>>>> > > >> > > > [1] https://issues.apache.org/jira/browse/ISIS-867
>>>> > > >> > > >
>>>> > > >> > > >
>>>> > > >> > > > On 16 September 2015 at 05:18, Stephen Cameron <
>>>> > > >> > > [email protected]
>>>> > > >> > > > >
>>>> > > >> > > > wrote:
>>>> > > >> > > >
>>>> > > >> > > > > Hi,
>>>> > > >> > > > >
>>>> > > >> > > > > Could someone please assist me in adding this
>>>> capability, to
>>>> > > >> automate
>>>> > > >> > > the
>>>> > > >> > > > > creation and update of values in these standard fields
>>>> > > >> > > > >
>>>> > > >> > > > > created_by
>>>> > > >> > > > > created_on
>>>> > > >> > > > > modified_by
>>>> > > >> > > > > modified_on
>>>> > > >> > > > >
>>>> > > >> > > > > That is I need to set the first two on creating a new
>>>> object,
>>>> > > and
>>>> > > >> the
>>>> > > >> > > > last
>>>> > > >> > > > > two on modifying an object.
>>>> > > >> > > > >
>>>> > > >> > > > > Thanks
>>>> > > >> > > > > Steve Cameron
>>>> > > >> > > > >
>>>> > > >> > > >
>>>> > > >> > >
>>>> > > >> >
>>>> > > >> >
>>>> > > >> > ---
>>>> > > >> > This email has been checked for viruses by Avast antivirus
>>>> software.
>>>> > > >> > https://www.avast.com/antivirus
>>>> > > >> >
>>>> > > >> >
>>>> > > >>
>>>> > > >
>>>> > > >
>>>> > >
>>>> >
>>>>
>>>
>>>
>>
>

Reply via email to