[opencms-dev] CmsTemplateBean cannot be resolved to a type

Paul-Inge Flakstad flakstad at npolar.no
Wed Sep 9 14:08:44 CEST 2015


Hi Ricardo,

First of all, you should fix the duplicate/redundant imports. (It’s probably not the cause, but let’s just rule it out.)

Import either the package (once):
<%@ page import="org.opencms.frontend.templateone.*" %>
... OR – if you want to be more specific – the class (once):
<%@ page import="org.opencms.frontend.templateone.CmsTemplateBean" %>

Same goes for the opencms taglib. Declare it once:
                <%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>

Then test to see if the error went away.

Now, assuming the error is still there:
The “cannot be resolved to a type” error means that the package/class is not “available” – the compiler doesn’t recognize it. A likely cause would be that templateone hasn’t been installed, or that Tomcat hasn’t been restarted after the install.

You may be able to fix it by following these steps:
* On your server, list the folder {TOMCAT_HOME}/webapps/your-opencms-webapp/WEB-INF/lib
* Do you see the templateone .jar file in there?
  * If yes: make sure there’s only ONE version of it – remove any duplicates / outdated versions.
  * If no: (re)install templateone. (Or, alternatively: manually place the .jar in the /lib folder.)
* Restart Tomcat.

HTH. Good luck :)

Cheers,
Paul

From: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Ricardo Sanchez
Sent: 9. september 2015 10:37
To: opencms-dev at opencms.org
Subject: Re: [opencms-dev] CmsTemplateBean cannot be resolved to a type

Hello Paul-Inge:

First of all, thanks for your response.

I did everything you mentioned me, import templateone related modules and directives related to the jsp and now I get the following error:

Unable to compile class for JSP:

An error occurred at line: [18] in the generated java file: [C: \ SAE \ Tomcat 7.0.63\work\Catalina\localhost\opencms\org\apache\jsp\WEB_002dINF\jsp\offline\system\modules\org_opencms_module_acucyl\elements\copyright_jsp.java]
Only a type can be imported. Resolves to a package org.opencms.frontend.templateone.CmsTemplateBean

An error occurred at line 26 in the jsp file: /WEB-INF/jsp/offline/system/modules/org.opencms.module.acucyl/elements/copyright.jsp
CmsTemplateBean can not be resolved to a type
2. 3:
24:
25: <%
26: CmsTemplateBean cms = new CmsTemplateBean (pageContext, request, response);
27: cms.init (pageContext, request, response);
28: CmsMessages messages = cms.getMessages ("org / / opencms / module / acucyl / workplace" request.getLocale () + "");
29:%>

The head of my JSP is as follows:

<%@ page pageEncoding="UTF-8" %><%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="org.opencms.jsp.*" %>
<%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>
<%@page buffer="none" session="true" import="java.util.*,org.opencms.frontend.templateone.*" %<mailto:%25 at page%20buffer=%22none%22%20session=%22true%22%20import=%22java.util.*,org.opencms.frontend.templateone.*%22%20%25>>
<%@ page import="org.opencms.frontend.templateone.*" %>
<%@ page import="org.opencms.frontend.templateone.CmsTemplateBean" %>
<%@ page import="org.opencms.jsp.CmsJspXmlContentBean" %>
<%@ page import="org.opencms.jsp.CmsJspActionElement" %>
<%@ page import="org.opencms.i18n.*" %>
<%@ page import="org.opencms.file.CmsUser" %>
<%@ page import="org.opencms.file.CmsGroup" %>
<%@ page import="org.opencms.file.CmsObject" %>

What can I do?

Best regards and thank you.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20150909/0d56608b/attachment.htm>


More information about the opencms-dev mailing list