2015-09-03 96 views
0

我在尝试在Liferay 6.2中部署Portlet时遇到了问题。我对JAVA非常陌生,在处理这类错误时也是如此,所以如果我在处理这些问题时很天真,请原谅我。Liferay portlet部署Java错误

这些都是即时得到基于Eclipse的错误:

无法找到“http://java.sun.com/portlet”的标签库描述,对于这一行:

<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %> 

林也得到一个警示:“未知标签(门户:defineObjects)“关于这一行:

<portlet:defineObjects /> 

最后这个错误”,在这条线找到多个注释:地方不能解析到VARI能,的PortletConfig不能对此行解决”:

ResourceBundle resourceBundle = portletConfig.getResourceBundle(locale); 

我的继承人init.jsp(请阅读我的末注释):

<%@ page pageEncoding="UTF-8"%> 
<%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %> 
<%@ taglib uri="http://liferay.com/tld/portlet" prefix="liferay-portlet" %> 
<%@ taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %> 
<%@ taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %> 
<%@ taglib uri="http://liferay.com/tld/util" prefix="liferay-util" %> 

<%@ taglib uri="/WEB-INF/tld/c-rt.tld" prefix="c"%> 
<%@ taglib uri="/WEB-INF/tld/fmt.tld" prefix="fmt"%> 
<%@ taglib uri="/WEB-INF/tld/fn.tld" prefix="fn"%> 

<%@ page isELIgnored ="false" %> 

<%@ page import="java.util.ResourceBundle" %> 
<%@ page import="java.util.Locale" %> 
<%@ page import="java.util.Enumeration" %> 
<%@ page import="java.util.HashMap" %> 
<%@ page import="java.util.Iterator" %> 
<%@ page import="java.util.Map" %> 
<%@ page import="java.util.List" %> 

<%@ page import="java.text.SimpleDateFormat"%> 

<%@ page import="javax.portlet.PortletSession"%> 

<%@ page import="com.liferay.portal.kernel.dao.orm.QueryUtil"%> 
<%@ page import="com.liferay.portal.kernel.util.ParamUtil"%> 
<%@ page import="com.liferay.portal.kernel.util.LocaleUtil"%> 

<%@ page import="net.opentrends.caoc.portlet.valisa.util.*"%> 
<%@ page import="net.opentrends.caoc.portlet.valisa.model.*"%> 
<%@ page import="net.opentrends.caoc.portlet.valisa.support.model.*" %> 
<%@ page import="net.opentrends.caoc.portlet.valisa.portlet.missatges.*"%> 

<liferay-theme:defineObjects /> 
<portlet:defineObjects /> 

<% 
ResourceBundle resourceBundle = portletConfig.getResourceBundle(locale); 
PropsUtil mailProperties = PropsUtil.getInstance("/email.properties"); 
int maxFileSize = Integer.valueOf(mailProperties.getProperty("email.valisa.maxAttachmentSize")); 
String maxFileSizeText = mailProperties.getProperty("email.valisa.maxAttachmentSize.text"); 
int maxTotalFilesSize = Integer.valueOf(mailProperties.getProperty("email.valisa.maxTotalAttachmentSize")); 
String maxTotalFilesSizeText = mailProperties.getProperty("email.valisa.maxTotalAttachmentSize.text"); 
%> 
<script type="text/javascript"> 
<!-- 
// Variables 
var midaMaximaAnnex = <%= maxFileSize %>; 
var midaMaximaAnnexText = '<%= maxFileSizeText %>'; 
var midaMaximaTotalAnnexos = <%= maxTotalFilesSize %>; 
var missatgeErrorMidaMaximaCarregantAnnex = "No es pot carregar el document annex: la mida màxima admesa és de "+midaMaximaAnnexText + " per document."; 
var midaMaximaTotalAnnexosText = '<%= maxTotalFilesSizeText %>'; 
var missatgeInfoMidaMaximaAnnexPermesa = "<p>Atenció, tingui en compte que en cas que els annexos superin la mida de " + midaMaximaAnnexText + ", només s'enviarà el justificant com a annex del correu-e</p>"; 
var missatgeAlertaMidaMaximaTotalAnnexosSuperada = "<p>El document o documents annexos no s'enviaran perquè superen els " + midaMaximaTotalAnnexosText + " (màx. autoritzat)</p>"; 
var missatgeErrorMidaMaximaCarregantTotsAnnexos = "No es pot carregar el document annex: s'ha arribat al màxim de " + midaMaximaTotalAnnexosText + " permesos com a màxim per a tots els documents adjunts."; 
var valisaContexte = "${pageContext.request.contextPath}"; 
//--> 
</script> 

<c:set var="usuari" value="${sessionScope.VALISA_USER_BEAN }"/> 
<c:set var="menu" value="${sessionScope.VALISA_MENU_BEAN }"/> 

<portlet:actionURL var="processActionURL" /> 

<portlet:actionURL var="ajaxProcessActionURL" windowState="exclusive" /> 

<portlet:actionURL var="safataEntradaURL"> 
    <portlet:param name="<%=WebKeys.VALISA_CMD%>" value="<%= WebKeys.VALISA_CMD_SAFATA_ENTRADA %>" /> 
</portlet:actionURL> 

<portlet:actionURL var="safataHistoricEntradaURL"> 
    <portlet:param name="<%=WebKeys.VALISA_CMD%>" value="<%= WebKeys.VALISA_CMD_SAFATA_HISTORIC_ENTRADA %>" /> 
</portlet:actionURL> 

<portlet:actionURL var="safataEnviadesURL"> 
    <portlet:param name="<%=WebKeys.VALISA_CMD%>" value="<%= WebKeys.VALISA_CMD_SAFATA_ENVIADES %>" /> 
</portlet:actionURL> 

<portlet:actionURL var="safataHistoricEnviadesURL"> 
    <portlet:param name="<%=WebKeys.VALISA_CMD%>" value="<%= WebKeys.VALISA_CMD_SAFATA_HISTORIC_ENVIADES %>" /> 
</portlet:actionURL> 

<portlet:actionURL var="safataNoLlegidesEnTerminiURL"> 
    <portlet:param name="<%=WebKeys.VALISA_CMD%>" value="<%= WebKeys.VALISA_CMD_SAFATA_NO_LLEGIDES_TERMINI %>" /> 
</portlet:actionURL> 

<portlet:actionURL var="safataEsborranysURL"> 
    <portlet:param name="<%=WebKeys.VALISA_CMD%>" value="<%= WebKeys.VALISA_CMD_SAFATA_ESBORRANYS %>" /> 
</portlet:actionURL> 

<portlet:actionURL var="safataVistiplausURL"> 
    <portlet:param name="<%=WebKeys.VALISA_CMD%>" value="<%= WebKeys.VALISA_CMD_SAFATA_VISTIPLAUS %>" /> 
</portlet:actionURL> 

我知道很多错误的即时得到与缺少一些所需的tld相关,我试图将这些tld添加到我的webinf/tld文件夹中,但自那时以后,我开始在控制台上出现奇怪的ERROR消息,无法看到我的portlet正在工作(Portlet暂时不可用)。现在即时得到的deployement错误是这对于这条线:

ResourceBundle resourceBundle = portletConfig.getResourceBundle(locale); 

Duplicate local variable resourceBundle__60: <portlet:defineObjects />__61: __62: <%__63: ResourceBundle resourceBundle = portletConfig.getResourceBundle(locale); 

这些都是顶级域名的我有我的portlet的WEB-INF/TLD文件夹:

aui.tld 
c-rt.tld 
liferay-portlet-ext.tld 
liferay-security.tld 
liferay-theme.tld 
liferay-ui.tld 
liferay-util.tld 

我试图添加的Liferay -portlet.tld到这个文件夹,但它没有工作,要么,这是我的web.xml这里,你可以看到我定义portlet.tld

<?xml version="1.0" encoding="UTF-8"?> 
<web-app id="WebApp_ID" version="2.5" 

xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> 

<display-name>Valisa</display-name> 
<context-param> 
    <param-name>company_id</param-name> 
    <param-value>aoc</param-value> 
</context-param> 

<listener> 
    <listener-class>com.liferay.portal.kernel.servlet.PortletContextListener</listener-class> 
</listener> 

<listener> 
    <listener-class>net.opentrends.caoc.portlet.valisa.portlet.ListenerStartup</listener-class> 
</listener> 

<servlet> 
    <servlet-name>valisa</servlet-name> 
    <servlet-class>com.liferay.portal.kernel.servlet.PortletServlet</servlet-class> 
    <init-param> 
     <param-name>portlet-class</param-name> 
     <param-value>net.opentrends.caoc.portlet.valisa.portlet.ValisaPortlet</param-value> 
    </init-param> 
    <load-on-startup>0</load-on-startup> 
</servlet> 
<servlet> 
    <servlet-name>dwr-invoker</servlet-name> 
    <servlet-class>uk.ltd.getahead.dwr.DWRServlet</servlet-class> 
    <init-param> 
     <param-name>debug</param-name> 
     <param-value>true</param-value> 
    </init-param> 
</servlet> 
    <servlet> 
    <servlet-name>DescarregarDocumentAdjuntServlet</servlet-name> 
    <servlet-class>cat.aoc.eacatpl.valisa.servlet.DescarregarDocumentAdjuntServlet</servlet-class> 
</servlet> 
<servlet> 
    <servlet-name>ObtenirCorreuElectronicAjaxServlet</servlet-name> 
    <servlet-class>cat.aoc.eacatpl.valisa.servlet.ObtenirCorreuElectronicAjaxServlet</servlet-class> 
</servlet> 
<servlet-mapping> 
    <servlet-name>valisa</servlet-name> 
    <url-pattern>/valisa2014-portlet/*</url-pattern> 
</servlet-mapping> 
<servlet-mapping> 
    <servlet-name>dwr-invoker</servlet-name> 
    <url-pattern>/dwr/*</url-pattern> 
</servlet-mapping> 
<servlet-mapping> 
    <servlet-name>DescarregarDocumentAdjuntServlet</servlet-name> 
    <url-pattern>/ajax/descarregarDocumentAdjunt</url-pattern> 
</servlet-mapping> 
<servlet-mapping> 
    <servlet-name>ObtenirCorreuElectronicAjaxServlet</servlet-name> 
    <url-pattern>/ajax/obtenirCorreuContactes</url-pattern> 
</servlet-mapping> 


<jsp-config>  
    <taglib> 
     <taglib-uri>http://java.sun.com/portlet</taglib-uri> 
     <taglib-location>/WEB-INF/tld/liferay-portlet.tld</taglib-location> 
    </taglib> 
    <taglib> 
     <taglib-uri>http://liferay.com/tld/theme</taglib-uri> 
     <taglib-location>/WEB-INF/tld/liferay-theme.tld</taglib-location> 
    </taglib> 
    <taglib> 
     <taglib-uri>http://liferay.com/tld/ui</taglib-uri> 
     <taglib-location>/WEB-INF/tld/liferay-ui.tld</taglib-location> 
    </taglib> 
    <taglib> 
     <taglib-uri>http://liferay.com/tld/util</taglib-uri> 
     <taglib-location>/WEB-INF/tld/liferay-util.tld</taglib-location> 
    </taglib> 
</jsp-config> 

任何帮助将真正感激。

+0

请分享你pom.xml,我想它可能缺少依赖。 – astrohome

+0

你能让我知道那个文件吗? @astrohome。我无法在我的portlet档案中找到它。谢谢 ! – Lowtrux

+0

嗯,好的,也许你没有使用Maven作为你的依赖管理。你在这种情况下使用什么系统?常春藤? – astrohome

回答

0

尝试在你的web.xml改变这个:

<taglib> 
    <taglib-uri>http://java.sun.com/portlet</taglib-uri> 
    <taglib-location>/WEB-INF/tld/liferay-portlet.tld</taglib-location> 
</taglib> 

<taglib> 
    <taglib-uri>http://java.sun.com/portlet_2_0</taglib-uri> 
    <taglib-location>/WEB-INF/tld/liferay-portlet.tld</taglib-location> 
</taglib> 

取代它,因为portlet_2_0是这个标记库的实际namespace。冲洗重复 - 这将开始摆脱第一个错误 - 因为它是关于编译,通常修复根本原因修复更多的东西。如果没有,请回报。

0
  1. 顶级域名

Liferay的上部署自动添加顶级域名。只需查看容器中已部署的Portlet的目录,例如在tomcat中它会是${catalina.home}/webapps/your-portlet(它也改变了web.xml的一些,你可以看看更好的理解Liferay)。

当然Eclipse不会知道这件事,但是如果你把TLD放在同一个地方,你应该没问题。务必使用TLD来获得正确的Liferay版本 - 您可以简单地使用您将在部署的Portlet中找到的TLD。

  • 无法解析变量
  • Eclipse还具有很难推断从不同的标签的所有的副作用。一切都很可能是好的,因为localeportletConfigdefineObjects标记添加,我可以看到你在JSP中有。这些警告令人讨厌,但我真的不知道是否可以对它们做些什么。

  • 异常
  • 作为评价中的一个所提到的,你可能尝试定义已在别处定义的变量。可能在某些标签中,如第2点所述。请重命名您的变量或删除您的分配并使用已定义的分配。

    相关问题