Cannot find bean: "emm.layout" in scope

Use this forum for questions regarding installation, upgrading and configuration of OpenEMM

Moderator: moderator

aviereck
Posts: 3
Joined: Mon Feb 04, 2008 9:27 am

Cannot find bean: "emm.layout" in scope

Post by aviereck »

We have installed OpenEMM 5.3.1 on the following environment:

- AMD64
- Debian GNU/Linux 4.0
- Linux 2.6.18
- MySQL 4.1.22
- OpenEMM 5.3.1 und 5.3.2
- Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_14-b03)
- JDK Arch for 32 as well as 64bit testet

After that, we opened the user interface URL:
www.meinedomain.de:8080/logon.do?action=0

The following HTML output appeared:

An error occurred
Cause: javax.servlet.ServletException: javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot find bean: "emm.layout" in scope: "request"


Info from the error log:

[17:43:27.706]javax.servlet.ServletException:
javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot
find bean: "emm.layout" in scope: "request"
[17:43:27.706] at
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:286)


The UI redirects to logon.jsp regarding the action mapping of struts-config.xml

In the JSP file the following code ist placed before the <head> tag:

Code: Select all

<%@ page language="java" import="java.util.*, [color=red]org.agnitas.beans.EmmLayout[/color], org.agnitas.web.*, org.apache.struts.action.*, org.agnitas.util.*, org.springframework.context.*, org.springframework.orm.hibernate3.*, org.springframework.web.context.support.WebApplicationContextUtils" pageEncoding="UTF-8"%>
<jsp:directive.page import="org.agnitas.beans.VersionObject"/>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>

<html:html>
<%
   LogonForm aForm=(LogonForm)request.getAttribute("logonForm");
   ApplicationContext aContext=WebApplicationContextUtils.getWebApplicationContext(application);
   
   HibernateTemplate aTemplate=new HibernateTemplate((org.hibernate.SessionFactory)aContext.getBean("sessionFactory"));
   
   [color=red]EmmLayout aLayout=(EmmLayout)AgnUtils.getFirstResult(aTemplate.find("from EmmLayout where companyID=0 and layoutID=?", new Integer(aForm.getLayout())));
   request.setAttribute("emm.layout", aLayout);[/color]
   
   VersionObject latestVersion = ( VersionObject )request.getAttribute( "latestVersion" );
   boolean isLatestVersion = true;
   if ( latestVersion != null && !latestVersion.isLatestVersion() ) {
   	isLatestVersion = false;
   }
%>
request.setAttribute("emm.layout", aLayout) does set the "baseURL" property of the following bean within the <head>:

<link rel="stylesheet" href="<bean:write name="emm.layout" property="baseUrl" scope="request"/>stylesheet.css">

The bean needs the image path "images/emm" (See openemm.sql dump) from the MySQL database. The query log shows the following query statement (we have formatted it for better reading):

Code: Select all

SELECT
     emmlayout0_.layout_id       AS layout1_6_,
     emmlayout0_.company_id      AS company2_6_,
     emmlayout0_.header_url      AS header3_6_,
     emmlayout0_.footer_url      AS footer4_6_,
     emmlayout0_.base_url        AS base5_6_,
     emmlayout0_.normal_color    AS normal6_6_,
     emmlayout0_.highlight_color AS highlight7_6_
FROM
     emm_layout_tbl emmlayout0_
WHERE
     emmlayout0_.company_id=0
AND emmlayout0_.layout_id=196864
Why does the query filters to Layout ID 196864 ? Isn´t that strange?

After we "hardcoded" the stylesheet directory "images/emm/" calling logon.jsp works. Now the standard username (admin) and passwort (openemm) does not work.

The problem was mentioned already in the following posts, but never resolved:
http://www.openemm.org/forums/viewtopic ... light=bean
http://www.openemm.org/forums/ftopic135.html
http://www.openemm.org/forums/ftopic133.html

Does somebody has an idea why the beans does not work?
Last edited by aviereck on Wed Feb 20, 2008 3:14 pm, edited 2 times in total.
ar
Posts: 5
Joined: Wed Oct 11, 2006 9:28 am

Error reproduced with missing entry in emm_layout_tbl.

Post by ar »

I was able to reproduce the mentioned error by removing the entry with layout_id 0 from emm_layout_tbl in the database. My output of select * from emm_layout_tbl on a working installation is:

Code: Select all

+-----------+------------+------------+------------+-------------+--------------+-----------------+
| layout_id | company_id | header_url | footer_url | base_url    | normal_color | highlight_color |
+-----------+------------+------------+------------+-------------+--------------+-----------------+
|         0 |          0 | header.jsp | footer.jsp | images/emm/ | #D2D7D2      | #73A2D0         |
+-----------+------------+------------+------------+-------------+--------------+-----------------+
1 row in set (0.00 sec)
aviereck
Posts: 3
Joined: Mon Feb 04, 2008 9:27 am

MySQL as localhost and other JDBC driver resolved problem

Post by aviereck »

I would like to share our solution:

By paying for agnitas support we resolved the problem by installing MySQL on localhost and replaced the JDBC driver by the "best working version for OpenEMM".

Our servers are clustered, therefore the database was on a separate db server and not installed on localhost. OpenEMM does not support distributed server environments so far.
Post Reply