02-22-2008 12:14 PM
The Web Script /alfresco/168s/ui/myspaces has responded with a status of 500 - Internal Error.
500 Description: An error inside the HTTP server which prevented it from fulfilling the request.
Message: Transaction must be active and synchronization is required
Exception: org.alfresco.error.AlfrescoRuntimeException - Transaction must be active and synchronization is required
org.alfresco.repo.transaction.AlfrescoTransactionSupport.registerSynchronizations(AlfrescoTransactionSupport.java:389)
org.alfresco.repo.transaction.AlfrescoTransactionSupport.getSynchronization(AlfrescoTransactionSupport.java:374)
org.alfresco.repo.transaction.AlfrescoTransactionSupport.bindDaoService(AlfrescoTransactionSupport.java:237)
org.alfresco.repo.transaction.TransactionalDaoInterceptor.invoke(TransactionalDaoInterceptor.java:66)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
$Proxy306.getNode(Unknown Source)
org.alfresco.repo.node.db.DbNodeServiceImpl.exists(DbNodeServiceImpl.java:166)
sun.reflect.GeneratedMethodAccessor312.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:281)
org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:187)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:154)
org.alfresco.repo.transaction.TransactionResourceInterceptor.invoke(TransactionResourceInterceptor.java:129)
org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:176)
org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:210)
$Proxy308.exists(Unknown Source) […]
02-25-2008 01:51 PM
02-25-2008 02:14 PM
02-26-2008 12:31 PM
02-26-2008 02:24 PM
02-27-2008 11:13 AM
02-27-2008 11:28 AM
02-27-2008 11:49 AM
02-29-2008 12:25 PM
/*
* Bassed off of org.alfresco.web.scripts.portlet.WebClientPortletAuthenticator
*
* Sets and gets the Authenticated user directly off the session rather then the
* application scope of the session.
*
*
*/
package com.tca.authentication;
import javax.portlet.PortletSession;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.security.AuthenticationService;
import org.alfresco.web.app.servlet.AuthenticationHelper;
import org.alfresco.web.bean.repository.User;
import org.alfresco.web.scripts.WebScriptContext;
import org.alfresco.web.scripts.WebScriptDescription.RequiredAuthentication;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
// TCA Added
import javax.portlet.PortletContext;
import org.alfresco.web.scripts.portlet.WebScriptPortletAuthenticator;
import org.alfresco.web.scripts.portlet.WebScriptPortletRequest;
import org.alfresco.service.cmr.security.PersonService;
import org.alfresco.service.cmr.repository.NodeService;
import org.springframework.context.ApplicationContext;
import org.springframework.web.portlet.context.PortletApplicationContextUtils;
/**
* Portlet authenticator which synchronizes with the Alfresco Web Client authentication
*
* @author davidc
*/
public class WebClientPortletAuthenticator implements WebScriptPortletAuthenticator
{
// Logger
private static final Log logger = LogFactory.getLog(WebClientPortletAuthenticator.class);
// dependencies
private AuthenticationService authenticationService;
private WebScriptContext scriptContext;
/**
* @param authenticationService
*/
public void setAuthenticationService(AuthenticationService authenticationService)
{
this.authenticationService = authenticationService;
}
/**
* @param scriptContext
*/
public void setScriptContext(WebScriptContext scriptContext)
{
this.scriptContext = scriptContext;
}
/* (non-Javadoc)
* @see org.alfresco.web.scripts.portlet.WebScriptPortletAuthenticator#authenticate(org.alfresco.web.scripts.WebScriptDescription.RequiredAuthentication, boolean, javax.portlet.RenderRequest, javax.portlet.RenderResponse)
*/
public boolean authenticate(RequiredAuthentication required, boolean isGuest, RenderRequest req, RenderResponse res)
{
logger.debug("Starting authenticate - RequiredAuthentication: " + required + " - isGuest: " + isGuest);
logger.debug("Using authentication service: " +authenticationService);
PortletSession session = req.getPortletSession();
// first look for the username key in the session - we add this by hand for some portals
// when the WebScriptPortletRequest is created
String portalUser = (String)req.getPortletSession().getAttribute(WebScriptPortletRequest.ALFPORTLETUSERNAME);
logger.debug("User Name from request: "+portalUser);
if (portalUser == null)
{
portalUser = req.getRemoteUser();
logger.debug("User Name from session: "+portalUser);
}
if (logger.isDebugEnabled())
{
logger.debug("JSR-168 Remote user: " + portalUser);
}
if (isGuest || portalUser == null)
{
if (logger.isDebugEnabled())
logger.debug("Authenticating as Guest");
// authenticate as guest
AuthenticationUtil.setCurrentUser(AuthenticationUtil.getGuestUserName());
if (logger.isDebugEnabled())
logger.debug("Setting Web Client authentication context for guest");
createWebClientUser(session);
removeSessionInvalidated(session);
}
else
{
if (logger.isDebugEnabled())
logger.debug("Authenticating as user " + portalUser);
AuthenticationUtil.setCurrentUser(portalUser);
// determine if Web Client context needs to be updated
User user = getWebClientUser(session);
if (user == null || !portalUser.equals(user.getUserName()))
{
if (logger.isDebugEnabled())
logger.debug("Setting Web Client authentication context for user: " + portalUser);
createWebClientUser(session);
removeSessionInvalidated(session);
}
}
return true;
}
/**
* Helper. Remove Web Client session invalidated flag
*
* @param session
*/
private void removeSessionInvalidated(PortletSession session)
{
if (logger.isDebugEnabled())
{
logger.debug("Invalidating session: " + AuthenticationHelper.SESSION_INVALIDATED);
}
//session.removeAttribute(AuthenticationHelper.SESSION_INVALIDATED, PortletSession.APPLICATION_SCOPE);
session.removeAttribute(AuthenticationHelper.SESSION_INVALIDATED);
}
/**
* Helper. Create Web Client session user
*
* @param session
*/
private void createWebClientUser(PortletSession session)
{
try{
String loginUser = authenticationService.getCurrentUserName();
String loginTicket = authenticationService.getCurrentTicket();
if (logger.isDebugEnabled())
{
logger.debug("Starting createWebClientUser for user: " + loginUser + " and ticket " + loginTicket);
}
PortletContext portletContext = session.getPortletContext();
if (logger.isDebugEnabled())
logger.debug("##portletContext " + portletContext);
ApplicationContext appContext = PortletApplicationContextUtils.getRequiredWebApplicationContext(portletContext);
if (logger.isDebugEnabled())
logger.debug("##appContext " + appContext);
PersonService personService = (PersonService)appContext.getBean("personService");
if (logger.isDebugEnabled())
logger.debug("##personService " + personService);
NodeService nodeService = (NodeService)appContext.getBean("nodeService");
if (logger.isDebugEnabled())
logger.debug("##nodeService " + nodeService);
NodeRef personRef = personService.getPerson(loginUser);
if (logger.isDebugEnabled())
{
logger.debug("##Successfully retrieved person reference: " + personRef);
}
User user = new User(loginUser, authenticationService.getCurrentTicket(), personRef);
if (logger.isDebugEnabled())
{
logger.debug("##Successfully created the user: " + user);
logger.debug("##Setting on session: " + session);
}
//session.setAttribute(AuthenticationHelper.AUTHENTICATION_USER, user, PortletSession.APPLICATION_SCOPE);
session.setAttribute(AuthenticationHelper.AUTHENTICATION_USER, user);
if (logger.isDebugEnabled())
{
logger.debug("Successfully set the user on the session ###");
}
}
catch(Exception e)
{
logger.error("Error in createWebClientUser: " + e.toString());
e.printStackTrace();
}
}
/**
* Helper. Get Web Client session user
*
* @param session
* @return
*/
private User getWebClientUser(PortletSession session)
{
if (logger.isDebugEnabled())
{
logger.debug("Getting the user from the session: " + AuthenticationHelper.AUTHENTICATION_USER);
}
/* Removed and get globally at the session
* return (User)session.getAttribute(AuthenticationHelper.AUTHENTICATION_USER, PortletSession.APPLICATION_SCOPE);
*/
//return (User)session.getAttribute(AuthenticationHelper.AUTHENTICATION_USER, PortletSession.APPLICATION_SCOPE);
return (User)session.getAttribute(AuthenticationHelper.AUTHENTICATION_USER);
}
}
06-27-2008 07:47 AM
I have the same problem with Alfresco 2.9B and Liferay 4.4.1. Haven't been able to figure out what it is yet …
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.