20060713 Thursday July 13, 2006

Alfresco: Failed to authenticate as Guest user

Was getting this error intermitently while trying to login to a new Alfresco installation:

org.alfresco.error.AlfrescoRuntimeException: Failed to authenticate as Guest user.
 org.alfresco.web.app.servlet.AuthenticationHelper.authenticate(AuthenticationHelper.java:209)
 org.alfresco.web.app.servlet.AuthenticationFilter.doFilter(AuthenticationFilter.java:67)

This problem also seemed to be related to an intermittent crash I was getting:

java.lang.NoSuchMethodError: java.lang.Object.getHibernateLazyInitializer()Lorg/hibernate/proxy/LazyInitializer;
org.hibernate.proxy.HibernateProxy$$EnhancerByCGLIB$$2bcce5c8.getHibernateLazyInitializer(<generated>)
org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:274)
org.hibernate.type.ManyToOneType.assemble(ManyToOneType.java:177)
org.hibernate.type.TypeFactory.assemble(TypeFactory.java:398)
org.hibernate.cache.entry.CacheEntry.assemble(CacheEntry.java:96)
org.hibernate.cache.entry.CacheEntry.assemble(CacheEntry.java:82)
org.hibernate.event.def.DefaultLoadEventListener.assembleCacheEntry(DefaultLoadEventListener.java:520)
org.hibernate.event.def.DefaultLoadEventListener.loadFromSecondLevelCache(DefaultLoadEventListener.java:474)
org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:328)
org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:123)
org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:177)
org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:87)
org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:862)

It turns out that this is a known bug, and the workaround is to use the server vm. You can invoke this when starting Tomcat by adding "-server" to the JAVA_OPTS environment variable.

If you are not sure if you are running the server vm or not (or if you think you have it setup properly but are still getting the error), follow my advice here to display the JVM properties using JSP to see what VM you are actually using.

Update:

After adding the -server option to the Tomcat startup options, I still ran into the "Failed to authenticate as Guest user" error. However, it went away when I refreshed the browser. When I checked the server logs, I got a different exception than the NoSuchMethodError from above.

java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: org.apache.myfaces.el.MethodBindingImpl
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1303)
at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1628)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1293)
at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1628)
...

This seems to be related to a different problem described in Alfresco case AWC-628. The fix for this is to edit <tomcat>/conf/context.xml and uncomment the following line:

<Manager pathname="" />

This will disable persistent sessions in Tomcat, which seems to be the cause of the problem.

So in short, to get Alfresco working with a war file deploy on Tomcat 5.5, make sure that you are running the server vm and that persistent sessions are disabled.

Posted by rickg ( Jul 13 2006, 01:29:47 AM PDT ) Permalink Comments [0]