使用Vaadin 7我创建了一个简单的登录表单,将用户名和密码传递给管理与Oracle系统的数据库连接的类。然后该类登录并创建会话。
以下凭据有效:
用户名:User1
密码:密码1
这些凭据会抛出错误:
用户名:user1@email.com
密码:密码1
两者都是数据库中的有效用户。我已经通过在Oracle SQL Developer中使用上述凭据证实了这一点。
我怀疑JDBC驱动程序不喜欢“@”或“。”在用户名中。有没有办法可以转义任何一个字符,以便JDBC驱动程序在连接字符串中忽略它?
堆栈追踪:
Jan 28, 2014 5:07:48 PM oracle.jdbc.driver.OracleDriver registerMBeans
SEVERE: Error while registering Oracle JDBC Diagnosability MBean.
javax.management.MalformedObjectNameException: Invalid character '
' in value part of property
at javax.management.ObjectName.construct(Unknown Source)
at javax.management.ObjectName.<init>(Unknown Source)
at oracle.jdbc.driver.OracleDriver.registerMBeans(OracleDriver.java:303)
at oracle.jdbc.driver.OracleDriver$1.run(OracleDriver.java:213)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.jdbc.driver.OracleDriver.<clinit>(OracleDriver.java:209)
at oracle.jdbc.pool.OracleDataSource.<clinit>(OracleDataSource.java:94)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at com.feith.core.Host.getUserConnection(Host.java:82)
at com.feith.core.FddSession.<init>(FddSession.java:96)
at com.feith.userregistration.DatabaseSessionController.DBConnect(DatabaseSessionController.java:123)
at com.feith.userregistration.DatabaseSessionController.<init>(DatabaseSessionController.java:59)
at com.feith.userregistration.UserLogin.login(UserLogin.java:158)
at com.feith.userregistration.UserLogin$1.buttonClick(UserLogin.java:95)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:508)
at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:198)
at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:161)
at com.vaadin.server.AbstractClientConnector.fireEvent(AbstractClientConnector.java:969)
at com.vaadin.ui.Button.fireClick(Button.java:355)
at com.vaadin.ui.Button.click(Button.java:344)
at com.vaadin.ui.Button$ClickShortcut.handleAction(Button.java:523)
at com.vaadin.event.ActionManager.handleAction(ActionManager.java:235)
at com.vaadin.event.ConnectorActionManager.handleAction(ConnectorActionManager.java:81)
at com.vaadin.event.ActionManager.handleAction(ActionManager.java:230)
at com.vaadin.event.ActionManager.handleActions(ActionManager.java:213)
at com.vaadin.ui.UI.changeVariables(UI.java:353)
at com.vaadin.server.communication.ServerRpcHandler.changeVariables(ServerRpcHandler.java:396)
at com.vaadin.server.communication.ServerRpcHandler.handleBurst(ServerRpcHandler.java:221)
at com.vaadin.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:111)
at com.vaadin.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:91)
at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:37)
at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1382)
at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:238)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source)
答案 0 :(得分:2)
根据Oracle,这是一个错误(BUG-6362104): JDBC驱动程序抛出MalformedObjectException或InstanceAlreadyExistsException 加载时。。尝试再次从OTN下载驱动程序。如果你想知道你是否有修补过的jar:
java -jar ojdbc6.jar
未修补的jar打印
Oracle 11.1.0.6.0-Production JDBC 5.0 complied with JDK1.6
和修补后的jar打印
Oracle 11.1.0.6.0-Production+ JDBC 5.0 complied with JDK1.6
请确保您拥有可用于Oracle数据库版本的最新JDBC驱动程序。