我开发了一个公开 web 服务的应用程序,该应用程序部署在 weblogic 12c 中,我从 java web 客户端调用 web 服务,当我运行 java 客户端时抛出这个异常:
Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: EJB Exception: ; nested exception is:
javax.persistence.PersistenceException: Exception [EclipseLink-7060] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Cannot acquire data source [sqlServer].
Internal Exception: javax.naming.NameNotFoundException: Unable to resolve 'sqlServer'. Resolved ''; remaining name 'sqlServer'
at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:178)
at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:111)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:108)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107)
at $Proxy34.loginService(Unknown Source)
at main.Main.loginService(Main.java:32)
at main.Main.main(Main.java:22)
我在 Weblogic 12c 的管理控制台中配置了一个 jdbc 资源,JNDI 被命名为 sqlServer... 在应用程序中也有一个持久性单元 xml 文件,如下所示:
<persistence-unit name="BancaSimulacionIBancariaPU" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>sqlServer</jta-data-source>
<class>entities.Account</class>
<class>entities.Bank</class>
<class>entities.BeneficiaryBankItself</class>
<class>entities.BeneficiaryThird</class>
<class>entities.CreditCard</class>
<class>entities.Movement</class>
<class>entities.RuleType</class>
<class>entities.ServiceBank</class>
<class>entities.TransactionRule</class>
<class>entities.UserApplication</class>
<class>entities.Money</class>
<properties>
<property name="javax.persistence.jdbc.url" value="jdbc:sqlserver://servertb:1433;databaseName=BancaSimulacion"/>
<property name="javax.persistence.jdbc.password" value="(*******)"/>
<property name="javax.persistence.jdbc.driver" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
<property name="javax.persistence.jdbc.user" value="sa"/>
</properties>
我将驱动程序sqljdbc4.jar
放在wl_server/lib
文件夹中并配置commEnv.cmd
...我将for替换64sqljdbc.dll
为sqljdbc.dll
同一文件夹wl_server/lib
中...
但我不知道哪些设置适合与我的数据库连接......我测试了我的数据库并且是正确的......有什么问题?