应该使用的版本
/*
* Copyright (c) 2008, 2009, 2011 Oracle, Inc. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
* which accompanies this distribution. The Eclipse Public License is available
* at http://www.eclipse.org/legal/epl-v10.html and the Eclipse Distribution License
* is available at http://www.eclipse.org/org/documents/edl-v10.php.
*/
package javax.persistence.spi;
import javax.persistence.SharedCacheMode;
import javax.persistence.ValidationMode;
import javax.sql.DataSource;
import java.net.URL;
import java.util.List;
import java.util.Properties;
/**
* Interface implemented by the container and used by the
* persistence provider when creating an {@link javax.persistence.EntityManagerFactory}.
*
* @since Java Persistence 1.0
*/
public interface PersistenceUnitInfo
错误使用的版本
/*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the license at
* https://glassfish.dev.java.net/public/CDDLv1.0.html or
* glassfish/bootstrap/legal/CDDLv1.0.txt.
* See the License for the specific language governing
* permissions and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at glassfish/bootstrap/legal/CDDLv1.0.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* you own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
*/
package javax.persistence.spi;
import javax.sql.DataSource;
import java.net.URL;
import java.util.List;
import java.util.Properties;
/**
* Interface implemented by the container and used by the persistence provider
* when creating an {@link javax.persistence.EntityManagerFactory}.
*
* @since Java Persistence 1.0
*/
public interface PersistenceUnitInfo
他们区别在以第一个里面多一些方法,长这样的
** * Returns the specification of how the provider must use * a second-level cache for the persistence unit. * The result of this method corresponds to the <code>shared-cache-mode</code> * element in the <code>persistence.xml</code> file. * * @return the second-level cache mode that must be used by the * provider for the persistence unit * * @since Java Persistence 2.0 */ public SharedCacheMode getSharedCacheMode(); /** * Returns the validation mode to be used by the persistence * provider for the persistence unit. The validation mode * corresponds to the <code>validation-mode</code> element in the * <code>persistence.xml</code> file. * * @return the validation mode to be used by the * persistence provider for the persistence unit * * @since Java Persistence 2.0 */ public ValidationMode getValidationMode();
注意看
@since Java Persistence 2.0
这里有又有一个2.0的版本。
第二个接口里面是没有这些2.0的方法的,在linux下tomcat启动war包时,显示找不到这样的方法,报错了。
解决办法:
去WEB-INF/lib下,将没有2.0方法的jar删掉。成功启动。
浙公网安备 33010602011771号