Hi,

Great that you've worked out all the kinks. Sorry to see that the code isn't
as refactorable as I hoped. Love the Criteria api of Hibernate, but using
strings remains an evil thing. I hope that the current incarnation of
webical fits your purposes after your alterations. Activity on the project
has been low for a long time, but I'm still hoping to get the time soon to
put some more effort into it.

In the meantime, let us know how if you need anything else.

Regards,
Ivo

On Wed, Sep 9, 2009 at 7:03 PM, Marks Andre <[email protected]> wrote:

>
> Update,
>
> I managed to find the offending line of code. In pacakge
> org.webical.dao.hibernateImpl the class SettingsDaoHibernateImpl has
> the following method:
>
> public UserSettings getUserSettings(User user) throws DaoException
> ...
>
> try {
>                        Criteria criteria = getSession().createCriteria
> (UserSettings.class);
>                        criteria.add(Restrictions.eq("user_settings",
> user)); //had to
> change the string "user" to "user_settings".
>                        return (UserSettings) criteria.uniqueResult();
>
> As you can see the Restrictions.eq method passed "user" as an explicit
> string and was not refactored. By changing this to the correct
> property, it prevents the exception.
>
> The application seems to be in a working state now with the Oracle 10g
> database. I'm sure that we will find further quirks as it now we enter
> in to full testing. My testing team will be hard at work and I will
> hope to continue posting in separate threads from now on.
>
> On Sep 9, 12:39 pm, Marks Andre <[email protected]> wrote:
> > Hello,
> >
> > Thanks for the tip. I managed to debug the login by activating the
> > debug flag you mention. Indeed is quite a pain but the fact that it
> > delegates authentication to Tomcat worked out perfect for my purpose.
> > Interestingly, I had to explicitly configure the realm in the
> > server.xml file for the Tomcat configuration (this is unfortunate as
> > is preferable that the application can be deployed without modifying
> > the server configuration). For some reason the aplication server is
> > ignoring the context.xml realm on META-INF.
> >
> > Now, it seems that the application its having problems initializing. I
> > manage to login to the aplication with the default webical user. It
> > will ofcourse, take me to the administrator page. I then have to login
> > with un: admin, pw: admin (I dont know why, I merely guessed it). I
> > then go on to configure the application wide settings.When I click the
> > save button, the application tries to take me to the user calendar
> > (Acording to the URL in the
> browserhttp://localhost:8080/webical/app/calendar)
> > and displays the friendly error page with the following information:
> >
> > The application returned the following error message:
> >
> > Could not retrieve application settings for user: webical
> >
> > Also I get the following stack trace:
> >
> > org.webical.web.app.WebicalWebAplicationException: Could not retrieve
> > application settings for user: webical
> >         at org.webical.web.app.WebicalSession.getUserSettings
> > (WebicalSession.java:158)
> >         at org.webical.web.app.WebicalSession.getUserSettings
> > (WebicalSession.java:232)
> > at
> >
> org.webical.web.component.settings.UserSettingsPanel.setupCommonComponents
> > (UserSettingsPanel.java:73)
> >         at org.webical.web.component.AbstractBasePanel.setupComponents
> > (AbstractBasePanel.java:113)
> >         at org.webical.web.component.AbstractBasePanel.onBeforeRender
> > (AbstractBasePanel.java:223)
> > .
> > .
> > .
> >
> > I have to restart Tomcat to kill the session and be able to try to
> > login again, but the same cycle occurs. Upon further investigation I
> > get the following entry in the log:
> >
> > 2009-09-09 10:57:04,927 ERROR SettingsDaoHibernateImpl - Could not
> > retreive settings for  user: org.webical.u...@10651eb
> > org.hibernate.QueryException: could not resolve property: user of:
> > org.webical.UserSettings
> >         at
> >
> org.hibernate.persister.entity.AbstractPropertyMapping.throwPropertyException
> > (AbstractPropertyMapping.java:43)
> >         at org.hibernate.persister.entity.AbstractPropertyMapping.toType
> > (AbstractPropertyMapping.java:37)...
> >
> > This is clearly due to the fact that somewhere in the code the
> > application is trying to make a reference to a "user" colum. Since
> > "user" is a reserved world in oracle, the whole hibernate
> > configuration and its mappings in the classes had to be refactored.
> > All the "user" references were replaced with "user_settings". I would
> > have to scour the source to find this outdated reference. Perhaps the
> > Eclipse refactoring tool didn't catch it.
> >
> > On Sep 5, 3:25 am, Ivo van Dongen <[email protected]> wrote:
> >
> > >   Hi,
> >
> > > Congratulations, seems like you're getting there. Debugging the log-in
> > > procedure is quite a pain I am sad to say. We choose to leave the login
> > > mechanism external, so it is managed by the container and can be easily
> > > swapped out. For tomcat it is managed in the context.xml file (either
> in
> > > src/main/webapp/META-INF or in the profile you choose to build the
> war).
> > > It looks like this:
> >
> > > <Context  path="/webical-refactoring"  docBase="webical"  debug="5"
>  reloadable="true"  crossContext="true">
> >
> > >          <!-- The database resource for hibernate -->
> > >          <Resource
> > >                  name="jdbc/calendarDataBase"
> > >                  auth="Container"
> > >                  type="javax.sql.DataSource"
> > >
>  factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
> > >                  username="webical"
> > >                  password="webical"
> > >                  driverClassName="com.mysql.jdbc.Driver"
> > >
>  url="jdbc:mysql://localhost:3306/webical?autoReconnect=true"  />
> >
> > > </Context>
> >
> > > You need to substitute the driver, url, username and password with your
> > > own values depending on your setup. Now for debugging it you have to
> > > place debug="99" either on the context or resource element, forgot
> witch
> > > one. Then the logging to catalina.out will be more verbose.
> >
> > > Good luck again,
> > > Ivo
> >
> > > On 9/4/09 11:50 PM, Marks Andre wrote:
> >
> > > > Well somehow I managed to mannualy set the correct configurations and
> > > > I'm able to attempt loging in to the application. I have the database
> > > > setup with the same schema model as the mysql example (with its
> oracle
> > > > variations). I'm trying to log in as the user webical but the login
> > > > attempt fails and redirects me back to the login page. What I hope to
> > > > find is where to look in terms of trying to debbug a loging attempt.
> I
> > > > know that it makes a http post to j_security_check but i havent able
> > > > to find my way from there. Thanks for any help in the matter.
> >
> > > > On Sep 2, 10:37 am, Marks Andre<[email protected]>  wrote:
> >
> > > >> Hello,
> >
> > > >> I believe I have managed to configure the application to
> successfully
> > > >> validate start-up of the context with the Oracle database. As you
> > > >> mention Oracle has too many quirks to what otherwise should have
> been
> > > >> a transparent process. I have encountered another roadblock in which
> > > >> the application presents the following exception when trying to
> access
> > > >> the login page:
> >
> > > >> Unexpected RuntimeException
> > > >> Root cause:org.webical.web.app.WebicalWebAplicationException: Could
> > > >> not retrieve application settings for user: jag     at
> > > >>
> org.webical.web.app.WebicalSession.getUserSettings(WebicalSession.java:
> > > >> 158)     at org.webical.web.app.WebicalSession.getUserSettings
> > > >> (WebicalSession.java:232)     at
> > > >> org.webical.web.component.calendar.CalendarPanel.<init>
> > > >> (CalendarPanel.java:142)     at
> org.webical.web.pages.BasePage$8.<init>
> > > >> (BasePage.java:343)
> >
> > > >> ...
> >
> > > >> I believe this is due to the fact that the application is still
> > > >> compiling in development mode (hence is performing the bootstrap of
> > > >> the development configuration). I read the pom.xml profiles and
> tried
> > > >> to utilize the -Denv=build switch but it then will complain that the
> > > >> "maven.test.skip=true" switch is not a valid profile or task. I
> wonder
> > > >> why if I just specify the -D switch it will let me disable the tests
> > > >> just fine but with the -Devn=build switch it will not.
> >
> > > >> On Sep 1, 10:56 am, Ivo van Dongen<[email protected]>  wrote:
> >
> > > >>> Hi,
> >
> > > >>> Good to hear you're making progress. Hope you'll get there.>  At
> first I
> >
> > > >>>> was a little confused by the command typos so for future reference
> to
> > > >>>> anyone reading, the command I used was:
> >
> > > >>>> mvn -D maven.test.skip=true package
> >
> > > >>> Strange. They weren't really typos. Don't know what went wrong
> there.
> > > >>> Thanks for the correction.>  I know that my development methodology
> is not what
> >
> > > >>>> Webical intends but changing the database type doesn't seem to be
> as
> > > >>>> seamless.
> >
> > > >>> I thought it would be less involved indeed. I've changed around the
> > > >>> settings a bit in the past (postgress, derby and hsqldb) and that
> went
> > > >>> without any effort beside changing the configuration a bit. I
> didn't
> > > >>> think that oracle had so much quirks. But I haven't really made use
> of
> > > >>> it since version 8 or so.>  Perhaps someone could point me in the
> right direction as to what I
> >
> > > >>>> would need to change depending on the scenarios (test, QA, Dev,
> Prod)
> > > >>>> and maybe what maven tasks to run etc. Thanks for any help and
> > > >>>> invested time.
> >
> > > >>> Well, there is a standard way of doing this indeed. I suggest you
> read
> > > >>> up a bit on maven as the problems you are encountering so far are
> really
> > > >>> basic maven stuff. But on the other hand, you can always ask here,
> it's
> > > >>> no problem to help out.
> > > >>> They way we go about managing the different configurations is
> through
> > > >>> the use of maven profiles. The configurations can be found under
> /etc.
> > > >>> These are copied over the exploded war before packaging depending
> on
> > > >>> which profile is selected (default none I think). Activation of a
> > > >>> profile is done through the use of an extra parameter: -Denv=...
> You can
> > > >>> find out what to use by checking out the profiles section of the
> pom.xml
> > > >>> file.
> >
> > > >>> If I need to be more specific, just let me know.
> >
> > > >>> Regards,
> > > >>> Ivo van Dongen
> >
>


-- 
Ivo van Dongen
Func. Internet Integration
W http://www.func.nl
T +31 20 4230000
F +31 20 4223500

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"webical-developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/webical-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to