legacy-knowledge-base
公開されました Sep. 10, 2025

SAXParserの例外を避ける

written-by

Christopher Lui

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

legacy-article

learn-legacy-article-disclaimer-text

デフォルトでは、LiferayプラットフォームはSAXParserを定義しません。

注:SAXParserには、XMLファイルを解析するロジックが含まれています。

特定の設定(Weblogicなど)にSAXParserがすでに存在する可能性があるため、LiferayはSAXParserを定義していません。Liferayでそれらを無効にしようとすると、重大な問題が発生する可能性があります。ただし、Tomcatなどのアプリケーションサーバーには、独自のSAXParserがありません。したがって、S3StoreとLiferay DXP 7.0および7.1を使用してDocuments&Mediaを操作すると、次のようなエラーが表示されます。

ERROR [http-nio-10080-exec-1][PortletServlet:109] javax.portlet.PortletException: com.amazonaws.AmazonClientException: Couldn't initialize a SAX driver to create an XMLReader
javax.portlet.PortletException: com.amazonaws.AmazonClientException: Couldn't initialize a SAX driver to create an XMLReader

org.xml.sax.SAXException: Can't create default XMLReader; is system property org.xml.sax.driver set? This error indicates that an XMLReader has not been defined.

Caused by: org.xml.sax.SAXException: SAX2 driver class org.apache.xerces.parsers.SAXParser not found_java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser cannot be found by com.liferay.journal.web_1.4.0 [Sanitized]
       at org.xml.sax.helpers.XMLReaderFactory.loadClass(XMLReaderFactory.java:230)
       at org.xml.sax.helpers.XMLReaderFactory.createXMLReader(XMLReaderFactory.java:191)
       at com.amazonaws.services.s3.model.transform.XmlResponsesSaxParser.<init>(XmlResponsesSaxParser.java:114)
       ... 229 more

Resolution

この問題を解決するには、SAXParserを手動で定義する必要があります。

次の手順を実行して、system-ext.propertiesファイル内にファイルを設定すると簡単に実行できます。

  1. system-ext.propertiesファイルを作成する
  2. org.xml.sax.driver=com.sun.org.apache.xerces.internal.parsers.SAXParserに追加する
  3. /webapps/$LIFERAY_WAR/WEB-INF/classessystem-ext.properties を配置する
  4. Liferay DXPプラットフォームを再起動します。

開始ログ内のsystem-ext.propertiesロードアップを確認し、S3Storeで作業しているときには、任意のSAXParserのエラーが起こらないはずです。

did-this-article-resolve-your-issue

legacy-knowledge-base