[Liferay] exception: cocould not initialize class com. liferay. util. Portlet. portletprops

Source: Internet
Author: User

After the Portlet is deployed, an exception is reported-cocould not initialize class com. liferay. util. Portlet. portletprops.


Briefly describe the Portlet. properties. During the development of the Portlet, you can customize the configuration file-Portlet. properties similar to portal. properties.

The procedure is as follows:

1. Create the Portlet. properties in classpath, such as the WEB-INF/src directory

line.chart.types=line,spline,column,bar,timeline,spiderweb,area

2. Create portletpropskeys. Java

public class PortletPropsKeys {public static final String LINE_CHART_TYPES = "line.chart.types";}

3. Create portletpropsvalues. Java

import com.liferay.util.portlet.PortletProps;public class PortletPropsValues {public static final String[] LINE_CHART_TYPES = PortletProps.getArray(PortletPropsKeys.LINE_CHART_TYPES);}

You can call the method in portletprops as needed.


After three steps, you can directly call

String[] types = PortletPropsValues.LINE_CHART_TYPES;
Obtain the value of line. Chart. types.


If this exception occurs during compilation and running

Could not initialize class com.liferay.util.portlet.PortletProps

1. First check whether there is a util-java.jar In the Lib of the Portlet.

2. Determine the classpath of the Portlet. properties in the Portlet.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.