1

IBMのWebsphereサーバーを使用してradでj2eeアプリケーションを作成するとエラーが発生します

Caused by: org.xml.sax.SAXParseException: cvc-complex-type.3.1: Value '2.0' of attribute 'version' of element 'persistence' is not valid with respect to the corresponding attribute use. Attribute 'version' has a fixed value of '1.0'.
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaValidator.reportSchemaError(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaValidator.processOneAttribute(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaValidator.processAttributes(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source)
at org.apache.xerces.impl.xs.XMLSchemaValidator.startElement(Unknown Source)
at org.apache.xerces.jaxp.validation.ValidatorHandlerImpl.startElement(Unknown Source)
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.ValidatingUnmarshaller.startElement(ValidatingUnmarshaller.java:85)
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:113)
at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:202)

編集:自動生成されたpersistence.xmlを以下に示します。

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
    <persistence-unit name="PLHService">
        <class>plh.jpa.entity.User</class>
    </persistence-unit>
</persistence>

接続パラメータをpersistence.xmlに追加してみました。http://forum.springsource.org/showthread.php?89055-jpa-2-0-persistence-xml-does-not-validate
の記事をチェックアウトしましたが、Hibernateを使用しませんでした。

ビルドパスは、radおよびwebsphere7.0で設定されているデフォルトです。

4

2 に答える 2

2

ビルドパスは、radおよびwebsphere7.0で設定されているデフォルトです。

デフォルトでは、Websphere7.0はラップされたバージョンのOpenJPA1.0を使用します。これを修正したい場合は、persistence.xmlファイルで1.0を使用するか、RADとWASで永続性プロバイダーを切り替えるか、JPA2.0機能パックを適用することもできます。

于 2012-02-26T18:25:13.780 に答える
2

WebSphere7.0はJPA2.0をサポートしていますか。

答えはノーです!。Terrellが提案しているように、JPA 2.0 Feature Packを使用して検討する必要があります。その場合、JPA2.0を使用できるはずです。

この投稿もご覧ください

websphere 7および(アプリケーションベースの)open-jpa 2

また、wsjpaversionを調べて、セットアップでのJPAのサポートを確認することをお勧めします。

http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=%2Fcom.ibm.websphere.jpafep.multiplatform.doc%2Finfo%2Fae%2Fae%2Frejb_wsjpaversion.html&resultof=%22newfeat% 22%20

これらがあなたに良い指針を提供することを願っています。

于 2012-02-27T01:18:28.907 に答える