有谁知道我为什么会收到以下错误?
javax.persistence.PersistenceException: Exception [EclipseLink-4003] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException
Exception Description: Configuration error. Class [com.microsoft.sqlserver.jdbc.SQLServerDriver] not found.
org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:517)
org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(Entity ManagerFactoryDelegate.java:188)
org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:277)
org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:294)
org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:272)
mobilelink.entityservice.CheckVouchService.findAllCheckVouch(CheckVouchService.java:21)
warehouseservice.jaxrs.StockTake.getStockTakeTasks(StockTake.java:40)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:187)
com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:70)
com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:279)
com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:86)
com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:136)
com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:74)
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1357)
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1289)
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1239)
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1229)
com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:420)
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:497)
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:684)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
我的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="MobileLink" transaction-type="RESOURCE_LOCAL">
<class>mobilelink.entity.ComputationUnit</class>
<class>mobilelink.entity.Inventory</class>
<class>mobilelink.entity.InventoryClass</class>
<class>mobilelink.entity.CheckVouch</class>
<class>mobilelink.entity.CheckVouchs</class>
<class>mobilelink.entity.Department</class>
<class>mobilelink.entity.Person</class>
<class>mobilelink.entity.Warehouse</class>
<properties>
<property name="javax.persistence.jdbc.url" value="jdbc:sqlserver://localhost:1433;databaseName=UFDATA_666_2009"/>
<property name="javax.persistence.jdbc.user" value="sa"/>
<property name="javax.persistence.jdbc.password" value="160497"/>
<property name="javax.persistence.jdbc.driver" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
<property name="eclipselink.cache.shared.default" value="false"/>
</properties>
</persistence-unit>
在项目构建路径中,我已经包含了从Microsoft下载的sqljdbc4.jar。
感谢您的帮助。
答案 0 :(得分:5)
将 sqljdbc4.jar 移动到app-server中包含libs的文件夹。