java 无法分配连接,因为:用户 ID 长度 (0) 超出 1 到 255 的范围
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15426853/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Connection could not be allocated because: User id length (0) is outside the range of 1 to 255
提问by cloud
I'm creating a login interface using Netbeans with JSF, EJB and JPA. When I try to deploy the project, it throws the below exception:
我正在使用 Netbeans 和 JSF、EJB 和 JPA 创建一个登录界面。当我尝试部署项目时,它抛出以下异常:
Internal Exception: java.sql.SQLException:
Error in allocating a connection. Cause: Connection could not be allocated because: User id length (0) is outside the range of 1 to 255.
Error Code: 0. Please see server.log for more details.
C:\Users\Dell\Desktop\assignmenttask2\nbproject\build-impl.xml:1033: The module has not been deployed.
See the server log for details.
How is this caused and how can I solve it?
这是怎么引起的,我该如何解决?
回答by PSR
回答by Hertzel Guinness
@PSR answer's did the trick for me, here's more on that:
@PSR 的回答对我有用,这里有更多内容:
netbeans (reproduced on 7.4 build 201310111528) JPA's persistance unit creation wizard does not enforce giving a username password.
Problem is it does not work with Java DB (derby). Biggerproblem that you get this awkward error regarding user id length, which is another one of those really-not-helpfulerror messages.
netbeans(在 7.4 build 201310111528 上复制)JPA 的持久性单元创建向导不强制提供用户名密码。
问题是它不适用于 Java DB (derby)。更大的问题是,您会遇到有关用户 ID 长度的尴尬错误,这是另一个真正无用的错误消息。
So, to solve this, either recreate the persistence unit (persistence.xml) with a user name password, or add the two lines manually under <properites>
in the xml:
因此,要解决此问题,请使用用户名密码重新创建持久性单元 ( persistence.xml),或<properites>
在 xml下手动添加两行:
<properties>
<property name="javax.persistence.jdbc.user" value="APP"/>
<property name="javax.persistence.jdbc.password" value="APP"/>
</properties>
HTH
HTH