- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
大部分代码都是从旧项目复制过来的,除了这次我用 Gradle 而不是 maven。
当我通过 IntelliJ 在我的本地机器上运行项目时,会创建新表并且一切正常。
但是,当我将其上传到tomcat时,我看不到数据库中的表。
当我检查端点并尝试保存新数据时,这是可能的,保存后我可以访问它们。
当项目在tomcat中时,数据是可以访问的。一旦我重新加载/取消部署并再次部署,数据就会丢失,我无法通过服务访问数据。直到我保存新数据。
也许它与“内存数据库”有关。
应用程序属性:
spring.jpa.hibernate.ddl-auto=update
spring.datasource.driverClassName=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/database_name?autoReconnect=true&useSSL=false&createDatabaseIfNotExist=true
spring.datasource.username=username
spring.datasource.password=password
spring.jta.enabled=true
spring.datasource.hikari.minimum-idle=10
spring.datasource.hikari.maximum-pool-size=300
spring.datasource.hikari.idleTimeout=30000
spring.datasource.hikari.maxLifetime=2000000
spring.datasource.hikari.connectionTimeout=30000
我检查了几个小时,找不到问题。
org.hibernate.SQL : create table table_name ...
主类在 x.y 包中,实体在 x.y.database.tables 中。
30-May-2021 23:15:40.921 INFO [ajp-nio-8009-exec-356] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
30-May-2021 23:15:41.009 INFO [ajp-nio-8009-exec-356] org.apache.catalina.core.ApplicationContext.log 2 Spring WebApplicationInitializers detected on classpath
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.5.0)
2021-05-30 23:15:41.778 INFO 1454 --- [o-8009-exec-356] com.global.ServletInitializer : Starting ServletInitializer using Java 1.8.0_292 on ubuntu-droplet1 with PID 1454 (/opt/tomcat/temp/50-global##10049/WEB-INF/classes started by tomcat in /)
2021-05-30 23:15:41.782 INFO 1454 --- [o-8009-exec-356] com.global.ServletInitializer : No active profile set, falling back to default profiles: default
2021-05-30 23:15:42.051 WARN 1454 --- [kground-preinit] o.s.h.c.j.Jackson2ObjectMapperBuilder : For Jackson Kotlin classes support please add "com.fasterxml.jackson.module:jackson-module-kotlin" to the classpath
2021-05-30 23:15:43.027 INFO 1454 --- [o-8009-exec-356] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2021-05-30 23:15:43.150 INFO 1454 --- [o-8009-exec-356] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 105 ms. Found 1 JPA repository interfaces.
30-May-2021 23:15:43.881 INFO [ajp-nio-8009-exec-356] org.apache.catalina.core.ApplicationContext.log Initializing Spring embedded WebApplicationContext
2021-05-30 23:15:43.881 INFO 1454 --- [o-8009-exec-356] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 2023 ms
2021-05-30 23:15:43.931 TRACE 1454 --- [o-8009-exec-369]
2021-05-30 23:15:44.372 INFO 1454 --- [o-8009-exec-356] com.zaxxer.hikari.HikariDataSource : HikariPool-28 - Starting...
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
2021-05-30 23:15:44.704 INFO 1454 --- [o-8009-exec-356] com.zaxxer.hikari.HikariDataSource : HikariPool-28 - Start completed.
2021-05-30 23:15:44.796 INFO 1454 --- [o-8009-exec-356] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2021-05-30 23:15:44.910 INFO 1454 --- [o-8009-exec-356] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.31.Final
2021-05-30 23:15:45.199 INFO 1454 --- [o-8009-exec-356] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2021-05-30 23:15:45.504 INFO 1454 --- [o-8009-exec-356] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
2021-05-30 23:15:46.812 INFO 1454 --- [o-8009-exec-356] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2021-05-30 23:15:46.829 INFO 1454 --- [o-8009-exec-356] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2021-05-30 23:15:47.884 WARN 1454 --- [o-8009-exec-356] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2021-05-30 23:15:48.265 INFO 1454 --- [o-8009-exec-356] o.s.s.web.DefaultSecurityFilterChain : Creating filter chain: Ant [pattern='/**'], [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@1177a1e1, org.springframework.security.web.context.SecurityContextPersistenceFilter@3f4454d9, org.springframework.security.web.header.HeaderWriterFilter@132a4fd3, org.springframework.security.web.authentication.logout.LogoutFilter@24276bb0, org.springframework.security.web.authentication.www.BasicAuthenticationFilter@5f273afb, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@5ef67d5b, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@7361a373, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@5e9936ce, org.springframework.security.web.session.SessionManagementFilter@3e4a0114, org.springframework.security.web.access.ExceptionTranslationFilter@14437cb5, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@1ca8217d]
2021-05-30 23:15:49.023 INFO 1454 --- [o-8009-exec-356] com.global.ServletInitializer : Started ServletInitializer in 7.871 seconds (JVM running for 24656.257)
2021-05-30 23:15:49.025 INFO 1454 --- [o-8009-exec-356] o.s.b.a.ApplicationAvailabilityBean : Application availability state LivenessState changed to CORRECT
2021-05-30 23:15:49.028 INFO 1454 --- [o-8009-exec-356] o.s.b.a.ApplicationAvailabilityBean : Application availability state ReadinessState changed to ACCEPTING_TRAFFIC
30-May-2021 23:15:49.036 INFO [ajp-nio-8009-exec-356] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [/opt/tomcat/some_name/global##10049.war] has finished in [11,445] ms
30-May-2021 23:15:49.036 INFO [ajp-nio-8009-exec-356] org.apache.catalina.core.ApplicationContext.log HTMLManager: list: Listing contexts for virtual host '**domain**'
30-May-2021 23:16:01.419 INFO [ajp-nio-8009-exec-369] org.apache.catalina.core.ApplicationContext.log HTMLManager: list: Listing contexts for virtual host '**domain**'
30-May-2021 23:16:02.012 INFO [ajp-nio-8009-exec-372] org.apache.catalina.core.ApplicationContext.log HTMLManager: list: Listing contexts for virtual host '**domain**'
30-May-2021 23:16:04.502 INFO [ajp-nio-8009-exec-371] org.apache.catalina.core.ApplicationContext.log Initializing Spring DispatcherServlet 'dispatcherServlet'
2021-05-30 23:16:04.503 INFO 1454 --- [o-8009-exec-371] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2021-05-30 23:16:04.505 INFO 1454 --- [o-8009-exec-371] o.s.web.servlet.DispatcherServlet : Completed initialization in 2 ms
最佳答案
您缺少某些配置,例如 generate-dll
.请尝试以下操作:
spring.datasource.url=jdbc:mysql://localhost:3306/dbName
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.username=username
spring.datasource.password=password
spring.jpa.generate-ddl=true
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
我使用了不同的驱动程序类,因为不推荐使用来自您的属性的驱动程序类(这与您的问题无关)。
update
不应在生产中使用。我什至不会依赖 hibernate 来管理我的数据库模式,而是使用像 flyway/liquibase 这样的工具。
关于java - Spring boot 执行没有错误,但是,没有在服务器上创建表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67765588/
我有一台 MySQL 服务器和一台 PostgreSQL 服务器。 需要从多个表中复制或重新插入一组数据 MySQL 流式传输/同步到 PostgreSQL 表。 这种复制可以基于时间(Sync)或事
如果两个表的 id 彼此相等,我尝试从一个表中获取数据。这是我使用的代码: SELECT id_to , email_to , name_to , status_to
我有一个 Excel 工作表。顶行对应于列名称,而连续的行每行代表一个条目。 如何将此 Excel 工作表转换为 SQL 表? 我使用的是 SQL Server 2005。 最佳答案 这取决于您使用哪
我想合并两个 Django 模型并创建一个模型。让我们假设我有第一个表表 A,其中包含一些列和数据。 Table A -------------- col1 col2 col3 col
我有两个表:table1,table2,如下所示 table1: id name 1 tamil 2 english 3 maths 4 science table2: p
关闭。此题需要details or clarity 。目前不接受答案。 想要改进这个问题吗?通过 editing this post 添加详细信息并澄清问题. 已关闭 1 年前。 Improve th
下面两个语句有什么区别? newTable = orginalTable 或 newTable.data(originalTable) 我怀疑 .data() 方法具有性能优势,因为它在标准 AX 中
我有一个表,我没有在其中显式定义主键,它并不是真正需要的功能......但是一位同事建议我添加一个列作为唯一主键以随着数据库的增长提高性能...... 谁能解释一下这是如何提高性能的? 没有使用索引(
如何将表“产品”中的产品记录与其不同表“图像”中的图像相关联? 我正在对产品 ID 使用自动增量。 我觉得不可能进行关联,因为产品 ID 是自动递增的,因此在插入期间不可用! 如何插入新产品,获取产品
我有一个 sql 表,其中包含关键字和出现次数,如下所示(尽管出现次数并不重要): ____________ dog | 3 | ____________ rat | 7 | ____
是否可以使用目标表中的LAST_INSERT_ID更新源表? INSERT INTO `target` SELECT `a`, `b` FROM `source` 目标表有一个自动增量键id,我想将其
我正在重建一个搜索查询,因为它在“我看到的”中变得多余,我想知道什么 (albums_artists, artists) ( ) does in join? is it for boosting pe
以下是我使用 mysqldump 备份数据库的开关: /usr/bin/mysqldump -u **** --password=**** --single-transaction --databas
我试图获取 MySQL 表中的所有行并将它们放入 HTML 表中: Exam ID Status Assigned Examiner
如何查询名为 photos 的表中的所有记录,并知道当前用户使用单个查询将哪些结果照片添加为书签? 这是我的表格: -- -- Table structure for table `photos` -
我的网站都在 InnoDB 表上运行,目前为止运行良好。现在我想知道在我的网站上实时发生了什么,所以我将每个页面浏览量(页面、引荐来源网址、IP、主机名等)存储在 InnoDB 表中。每秒大约有 10
我在想我会为 mysql 准备两个表。一个用于存储登录信息,另一个用于存储送货地址。这是传统方式还是所有内容都存储在一张表中? 对于两个表...有没有办法自动将表 A 的列复制到表 B,以便我可以引用
我不是程序员,我从这个表格中阅读了很多关于如何解决我的问题的内容,但我的搜索效果不好 我有两张 table 表 1:成员 id*| name | surname -------------------
我知道如何在 ASP.NET 中显示真实表,例如 public ActionResult Index() { var s = db.StaffInfoDBSet.ToList(); r
我正在尝试运行以下查询: "insert into visits set source = 'http://google.com' and country = 'en' and ref = '1234
我是一名优秀的程序员,十分优秀!