PersistenceUnitInfo 因为所处jar不同 导致在不同环境下tomcat启动报错

应该使用的版本

/*
 * 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删掉。成功启动。

转载于:https://www.cnblogs.com/yulonglyw/p/9340495.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值