0
我正在實施FORM認證。我在server.xml文件中編輯了領域標記。我也改變了web.xml文件。但是,當我運行Web應用程序,並嘗試連接sql服務器時,引發異常。使用JDBCRealm進行基於FORM的認證
> om.microsoft.sqlserver.jdbc.SQLServerException: This driver is not
> configured for integrated authentication.
> ClientConnectionId:9a62dffc-956c-49e6-b3b4-0911fab60562 at
> com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:2399)
> at
> com.microsoft.sqlserver.jdbc.AuthenticationJNI.<init>(AuthenticationJNI.java:68)
> at
> com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:3131)
> at
> com.microsoft.sqlserver.jdbc.SQLServerConnection.access$100(SQLServerConnection.java:42)
> at
> com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServerConnection.java:3122)
> at
> com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7505)
> at
> com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2444)
> at
> com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:1980)
> at
> com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:1627)
> at
> com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:1458)
> at
> com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:772)
> at
> com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:1168)
> at java.sql.DriverManager.getConnection(DriverManager.java:664) at
> java.sql.DriverManager.getConnection(DriverManager.java:270) at
> Database.DAO.<clinit>(DAO.java:31) at
> classes.Job.loadJobs(Job.java:129) at
> Controllers.ContextListerner.contextInitialized(ContextListerner.java:16)
> at
> org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4717)
> at
> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5179)
> at
> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
> at
> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
> at
> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
> at
> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
> at
> org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1702)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498) at
> org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
> at
> com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
> at
> com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
> at
> org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:482)
> at
> org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:431)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498) at
> org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
> at
> com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
> at
> com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
> at
> javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468)
> at
> javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)
> at
> javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309)
> at
> javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1401)
> at
> javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498) at
> sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:324)
> at sun.rmi.transport.Transport$1.run(Transport.java:200) at
> sun.rmi.transport.Transport$1.run(Transport.java:197) at
> java.security.AccessController.doPrivileged(Native Method) at
> sun.rmi.transport.Transport.serviceCall(Transport.java:196) at
> sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
> at
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
> at
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)
> at java.security.AccessController.doPrivileged(Native Method) at
> sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> at java.lang.Thread.run(Thread.java:745) Caused by:
> java.lang.UnsatisfiedLinkError: Native Library C:\Program
> Files\Java\apache-tomcat-9.0.0.M13\bin\sqljdbc_auth.dll already loaded
> in another classloader
>
>
> Blockquote
我發送了web.xml和server.xml文件的代碼。再加上我試圖獲取數據庫連接的代碼。 server.xml中
<Realm className="org.apache.catalina.realm.JDBCRealm"
driverName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
connectionURL="jdbc:sqlserver://DESKTOP-ND3EINK\SQLEXPRESS;databaseName=HRSystem;integratedSecurity=true"
userTable="HR.users" userNameCol="user_name" userCredCol="user_pass"
userRoleTable="HR.user_roles" roleNameCol="role_name"/>
web.xml中,其中發生異常
static{
try{
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
con = DriverManager.getConnection("jdbc:sqlserver://DESKTOP-ND3EINK\\SQLEXPRESS;databaseName=HRSystem;integratedSecurity=true");
}
catch (Exception e){
e.printStackTrace();
}
}
請張貼您的代碼,其難以閱讀的圖像。 –
我已添加代碼。 –