1

当我在 Netbeans 中运行我的应用程序时,我没有问题,但是当我使用 java -jar filename.jar 运行它时,我得到以下信息:

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\ksk>java -jar C:\Users\ksk\Documents\Testing\StateMachine.jar

Oct 16, 2013 10:06:01 AM dtc.fileops.properties.MEISDirectoryManager createDirectories
INFO: Found MEIS Directory: C:\Users\ksk\MEIS
Trying config file in C:\Users\ksk\MEIS\StationApplication\config.txt
Exception in thread "AWT-EventQueue-0" java.lang.ExceptionInInitializerError
        at com.factoryserviceslibrary.db.EMGR.getInstance(EMGR.java:24)
        at statemachine.Context.startEMGR(Context.java:412)
        at statemachine.Main$3.run(Main.java:277)
        at java.awt.event.InvocationEvent.dispatch(Unknown Source)
        at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
        at java.awt.EventQueue.access$200(Unknown Source)
        at java.awt.EventQueue$3.run(Unknown Source)
        at java.awt.EventQueue$3.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: javax.persistence.PersistenceException: No Persistence provider for EntityManager named PU
        at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:85)
        at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
        at com.factoryserviceslibrary.db.EMGR.startEMGR(EMGR.java:41)
        at com.factoryserviceslibrary.db.EMGR.<init>(EMGR.java:32)
        at com.factoryserviceslibrary.db.EMGR.<init>(EMGR.java:16)
        at com.factoryserviceslibrary.db.EMGR$SingletonHolder.<clinit>(EMGR.java:64)
        ... 17 more

持久性.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="EngFoxProPU" transaction-type="RESOURCE_LOCAL">
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <class>com.....BOM</class>
    <class>com.....INV</class> (Other classes)
    <shared-cache-mode>NONE</shared-cache-mode>
    <properties>
      <property name="javax.persistence.jdbc.url" value="jdbc:dbf:/R:/DTCI/"/>
      <property name="javax.persistence.jdbc.driver" value="com.hxtt.sql.dbf.DBFDriver"/>
      <property name="javax.persistence.jdbc.user" value=""/>
      <property name="javax.persistence.jdbc.password" value=""/>
      <property name="eclipselink.platform.class.name" value="com.hxtt.support.eclipselink.DbfPlatform"/>
    </properties>
  </persistence-unit>
</persistence>

请注意,我的数据库链接到网络驱动器,它只是从文件中读取数据,而不是实际的数据库服务器。

我已验证类路径包含 eclipselink.jar 和 javax.persistence.jar。我希望有人能给我一些新的尝试。非常感谢。

4

0 回答 0