[英]Database Url not specified even though I have a liquibase.properties file
[英]“unknow database” even though i have created database correctly
我正在研究Java Web应用程序。 我正在使用jboss wildfly 10.x服务器,并保持休眠状态。 问题是,当我启动服务器时,它说有一个unknow database "DATABASE"
,我没有创建该unknow database "DATABASE"
,也没有在任何地方给出有关DATABASE
的名称,但是如果我创建DATABASE
它将起作用并填充正确的数据库。
这是我的* -ds.xml:
<datasources>
<datasource jndi-name="java:jboss/datasources/atlantisDS"
pool-name="atlantisPool">
<connection-url>jdbc:mysql://localhost/atlantis?characterEncoding=UTF8
</connection-url>
<driver>mysql</driver>
<pool>
<min-pool-size>1</min-pool-size>
<max-pool-size>5</max-pool-size>
<prefill>true</prefill>
</pool>
<security>
<user-name>were</user-name>
<password>142536</password>
</security>
</datasource>
</datasources>
这是persistence.xml:
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"
version="2.1">
<persistence-unit name="atlantisPU" transaction-type="JTA">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<jta-data-source>java:jboss/datasources/atlantisDS</jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect" />
<property name="hibernate.hbm2ddl.auto" value="update" />
</properties>
</persistence-unit>
</persistence>
我已经在每个*.xml
文件中查找了DATABASE
但找不到线索。 那么问题是什么,我该如何解决?
因为您已经添加了这一行
<jta-data-source>java:jboss/datasources/atlantisDS</jta-data-source>
它告诉容器在jboss配置文件或* -ds.xml中寻找数据源
因此,请打开jboss的独立文件,然后在* -ds.xml中查找类似这样的代码
<datasource jndi-name="java:jboss/datasources/sampleDS" pool-name="sampleDS" enabled="true" use-java-context="true">
<connection-url>jdbc:mysql://192.168.155.110:3306/databasename</connection-url>
<driver>mysql</driver>
<security>
<user-name>root</user-name>
<password>root</password>
</security>
</datasource>
您已将数据库名称定义为亚特兰蒂斯
无论是否自动创建表,数据库都必须存在于Mysql中
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.