Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add h2 quick start doc #4861

Closed
wants to merge 2 commits into from

Conversation

shoothzj
Copy link
Member

@shoothzj shoothzj commented May 6, 2023

What's the purpose of this PR

Since #4851 has been merged, add related docs.

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Read the Contributing Guide before making this pull request.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.

Copy link
Member

nobodyiam commented May 6, 2023

Hello, I am a code review bot on flows.network. Here are my reviews of code commits in this PR.


@codecov
Copy link

codecov bot commented May 6, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (ee1517b) 49.61% compared to head (76d482b) 49.62%.

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #4861   +/-   ##
=========================================
  Coverage     49.61%   49.62%           
- Complexity     1907     1908    +1     
=========================================
  Files           372      372           
  Lines         11559    11559           
  Branches       1127     1127           
=========================================
+ Hits           5735     5736    +1     
  Misses         5481     5481           
+ Partials        343      342    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@nobodyiam
Copy link
Member

I think we need to postpone this pr until the apollo-quick-start repo is updated with the latest version.

@stale
Copy link

stale bot commented Jun 8, 2023

This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 14 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@stale stale bot added the stale label Jun 8, 2023
@nobodyiam nobodyiam removed the stale label Jun 8, 2023
@stale
Copy link

stale bot commented Jul 9, 2023

This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 14 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions!

@stale stale bot added the stale label Jul 9, 2023
@shoothzj shoothzj removed the stale label Jul 9, 2023
@nobodyiam nobodyiam added this to the 2.2.0 milestone Aug 23, 2023
Copy link
Member

@nobodyiam nobodyiam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, since we're planning to release version 2.2.0 shortly, could you assist in writing the English documentation for the quick start guide?

docs/zh/deployment/quick-start.md Outdated Show resolved Hide resolved
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Dec 4, 2023
@nobodyiam
Copy link
Member

nobodyiam commented Dec 4, 2023

I built the apollo-all-in-one.jar using the lastest master code by following the manually build steps and run the start script with the following changes to the demo.sh:

# database platform
spring_profiles_group_github=${SPRING_PFOFILES_GROUP_GITHUB:-h2}

# apollo config db info
apollo_config_db_url=${APOLLO_CONFIG_DB_URL:-"jdbc:h2:mem:testdb;mode=mysql;DATABASE_TO_UPPER=FALSE;BUILTIN_ALIAS_OVERRIDE=TRUE;"}
apollo_config_db_username=${APOLLO_CONFIG_DB_USERNAME:-sa}
apollo_config_db_password=${APOLLO_CONFIG_DB_PASSWORD:-}

# apollo portal db info
apollo_portal_db_url=${APOLLO_PORTAL_DB_URL:-"jdbc:h2:mem:testdb;mode=mysql;DATABASE_TO_UPPER=FALSE;BUILTIN_ALIAS_OVERRIDE=TRUE;"}
apollo_portal_db_username=${APOLLO_PORTAL_DB_USERNAME:-sa}
apollo_portal_db_password=${APOLLO_PORTAL_DB_PASSWORD:-}

However, some errors occurred. I'm unsure why, as the same configurations function correctly when I run the quick start in the IDE.

  1. apollo-service.log
2023-12-04 20:38:09.705  WARN 55269 --- [Apollo-ReleaseMessageScanner-1] o.h.engine.jdbc.spi.SqlExceptionHelper   : SQL Error: 42102, SQLState: 42S02
2023-12-04 20:38:09.707 ERROR 55269 --- [Apollo-ReleaseMessageScanner-1] o.h.engine.jdbc.spi.SqlExceptionHelper   : Table "ReleaseMessage" not found; SQL statement:
select releasemes0_."Id" as id1_17_, releasemes0_."DataChange_LastTime" as datachan2_17_, releasemes0_."Message" as message3_17_ from "ReleaseMessage" releasemes0_ where releasemes0_."Id">? order by releasemes0_."Id" asc limit ? [42102-214]
2023-12-04 20:38:09.742 ERROR 55269 --- [Apollo-ReleaseMessageScanner-1] c.c.f.a.b.message.ReleaseMessageScanner  : Scan and send message failed

org.springframework.dao.InvalidDataAccessResourceUsageException: could not prepare statement; SQL [select releasemes0_."Id" as id1_17_, releasemes0_."DataChange_LastTime" as datachan2_17_, releasemes0_."Message" as message3_17_ from "ReleaseMessage" releasemes0_ where releasemes0_."Id">? order by releasemes0_."Id" asc limit ?]; nested exception is org.hibernate.exception.SQLGrammarException: could not prepare statement
    at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:259)
    at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:233)
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:551)
    at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:61)
    at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:242)
    at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:152)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:145)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:220)
    at com.sun.proxy.$Proxy204.findFirst500ByIdGreaterThanOrderByIdAsc(Unknown Source)
    at sun.reflect.GeneratedMethodAccessor62.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
    at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:89)
    at com.ctrip.framework.apollo.common.aop.RepositoryAspect.invokeWithCatTransaction(RepositoryAspect.java:43)
    at sun.reflect.GeneratedMethodAccessor54.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:634)
    at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:624)
    at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:72)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:220)
    at com.sun.proxy.$Proxy204.findFirst500ByIdGreaterThanOrderByIdAsc(Unknown Source)
    at com.ctrip.framework.apollo.biz.message.ReleaseMessageScanner.scanAndSendMessages(ReleaseMessageScanner.java:114)
    at com.ctrip.framework.apollo.biz.message.ReleaseMessageScanner.scanMessages(ReleaseMessageScanner.java:102)
    at com.ctrip.framework.apollo.biz.message.ReleaseMessageScanner.lambda$afterPropertiesSet$0(ReleaseMessageScanner.java:74)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
  1. apollo-portal.log
2023-12-04 20:38:39.490 ERROR 56817 --- [main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'methodValidationPostProcessor' defined in class path resource [org/springframework/boot/autoconfigure/validation/ValidationAutoConfiguration.class]: Unsatisfied dependency expressed through method 'methodValidationPostProcessor' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'restTemplateFactory' defined in URL [jar:file:/Users/jason/git/mine/apollo-build-scripts/portal/apollo-portal.jar!/BOOT-INF/lib/apollo-portal-2.2.0-SNAPSHOT.jar!/com/ctrip/framework/apollo/portal/component/RestTemplateFactory.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'portalConfig' defined in URL [jar:file:/Users/jason/git/mine/apollo-build-scripts/portal/apollo-portal.jar!/BOOT-INF/lib/apollo-portal-2.2.0-SNAPSHOT.jar!/com/ctrip/framework/apollo/portal/component/config/PortalConfig.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'portalDBPropertySource': Invocation of init method failed; nested exception is org.springframework.jdbc.datasource.init.ScriptStatementFailedException: Failed to execute SQL script statement #1 of class path resource [jpa/init.h2.sql]: INSERT INTO "ServerConfig" ("Key", "Cluster", "Value", "Comment", "DataChange_CreatedBy", "DataChange_CreatedTime") VALUES ('eureka.service.url', 'default', 'http://localhost:8080/eureka/', 'Eureka服务Url,多个service以英文逗号分隔', 'default', '1970-01-01 00:00:00'), ('namespace.lock.switch', 'default', 'false', '一次
发布只能有一个人修改开关', 'default', '1970-01-01 00:00:00'), ('item.key.length.limit', 'default', '128', 'item key 最大长度限制', 'default', '1970-01-01 00:00:00'), ('item.value.length.limit', 'default', '20000', 'item value最大长度限制', 'default', '1970-01-01 00:00:00'), ('config-service.cache.enabled', 'default', 'false', 'ConfigService是否开启缓存,开启后能提
高性能,但是会增大内存消耗!', 'default', '1970-01-01 00:00:00'); nested exception is org.h2.jdbc.JdbcSQLSyntaxErrorException: Column "Cluster" not found; SQL statement:
INSERT INTO "ServerConfig" ("Key", "Cluster", "Value", "Comment", "DataChange_CreatedBy", "DataChange_CreatedTime") VALUES ('eureka.service.url', 'default', 'http://localhost:8080/eureka/', 'Eureka服务Url,多个service以英文逗号分隔', 'default', '1970-01-01 00:00:00'), ('namespace.lock.switch', 'default', 'false', '一次发布只能有一个人修改开关', 'default', '1970-01-01 00:00:00'), ('item.key.length.limit', 'default', '128', 'item key 最大长度限制', 'default', '1970-01-01 00:00:00'), ('item.value.length.limit', 'default', '20000', 'item value最大
长度限制', 'default', '1970-01-01 00:00:00'), ('config-service.cache.enabled', 'default', 'false', 'ConfigService是否开启缓存,开启后能提高性能,但是会增大内存消耗!', 'default', '1970-01-01 00:00:00') [42122-214]
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:541)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:213)
    at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:258)
    at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:764)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:567)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:731)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
    at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:164)
    at com.ctrip.framework.apollo.assembly.ApolloApplication.main(ApolloApplication.java:74)
    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.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:108)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:65)

docs/zh/deployment/quick-start.md Outdated Show resolved Hide resolved
apollo_portal_db_username=用户名
apollo_portal_db_password=密码(如果没有密码,留空即可)
spring.profiles.group.github=h2
spring.datasource.url=jdbc:h2:mem:testdb;mode=mysql;DATABASE_TO_UPPER=FALSE;BUILTIN_ALIAS_OVERRIDE=TRUE;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is ok to use testdb same as apollo config db?

How about change it to portaldb here, and change above testdb to configdb?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I build and get apollo-portal-2.2.0-SNAPSHOT-github.zip

change database to h2, It start successflly.

But on runtime, when access http://localhost:8070/ it return HTTP Status 500 – Internal Server Error, in apollo-portal.log

2023-12-04 23:10:50.491 ERROR 1790 --- [http-nio-8070-exec-2] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception

org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [SELECT S.PRIMARY_ID, S.SESSION_ID, S.CREATION_TIME, S.LAST_ACCESS_TIME, S.MAX_INACTIVE_INTERVAL, SA.ATTRIBUTE_NAME, SA.ATTRIBUTE_BYTES FROM SPRING_SESSION S LEFT JOIN SPRING_SESSION_ATTRIBUTES SA ON S.PRIMARY_ID = SA.SESSION_PRIMARY_ID WHERE S.SESSION_ID = ?]; nested exception is org.h2.jdbc.JdbcSQLSyntaxErrorException: Table "SPRING_SESSION" not found; SQL statement:
SELECT S.PRIMARY_ID, S.SESSION_ID, S.CREATION_TIME, S.LAST_ACCESS_TIME, S.MAX_INACTIVE_INTERVAL, SA.ATTRIBUTE_NAME, SA.ATTRIBUTE_BYTES FROM SPRING_SESSION S LEFT JOIN SPRING_SESSION_ATTRIBUTES SA ON S.PRIMARY_ID = SA.SESSION_PRIMARY_ID WHERE S.SESSION_ID = ? [42102-214]

...

Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Table "SPRING_SESSION" not found; SQL statement:
SELECT S.PRIMARY_ID, S.SESSION_ID, S.CREATION_TIME, S.LAST_ACCESS_TIME, S.MAX_INACTIVE_INTERVAL, SA.ATTRIBUTE_NAME, SA.ATTRIBUTE_BYTES FROM SPRING_SESSION S LEFT JOIN SPRING_SESSION_ATTRIBUTES SA ON S.PRIMARY_ID = SA.SESSION_PRIMARY_ID WHERE S.SESSION_ID = ? [42102-214]

Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Table "SPRING_SESSION" not found

apollo_config_db_url="jdbc:mysql://localhost:3306/ApolloConfigDB?characterEncoding=utf8&serverTimezone=Asia/Shanghai"
apollo_config_db_username=用户名
apollo_config_db_password=密码(如果没有密码,留空即可)
spring.profiles.group.github=h2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when I change https://github.com/apolloconfig/apollo-quick-start/blob/master/demo.sh

and run

./demo.sh start

There are something wrong...

./demo.sh: line 33: spring.profiles.group.github=h2: command not found
./demo.sh: line 34: spring.datasource.url=jdbc:h2:mem:testdb: command not found
./demo.sh: line 35: spring.datasource.username=sa: command not found
./demo.sh: line 36: spring.datasource.password=: command not found
./demo.sh: line 39: spring.profiles.group.github=h2: command not found
./demo.sh: line 40: spring.datasource.url=jdbc:h2:mem:testdb: command not found
./demo.sh: line 41: spring.datasource.username=sa: command not found
./demo.sh: line 42: spring.datasource.password=: command not found

so it need to spring_profiles_group_github ?

Suggested change
spring.profiles.group.github=h2
spring_profiles_group_github =h2

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When use https://github.com/apolloconfig/apollo-quick-start/blob/master/demo.sh meet some error

Caused by: java.lang.RuntimeException: Failed to load driver class org.h2.Driver in either of HikariConfig class loader or Thread context classloader
	at com.zaxxer.hikari.HikariConfig.setDriverClassName(HikariConfig.java:491)

see apollo-service.log

@nobodyiam
Copy link
Member

I built the apollo-all-in-one.jar using the lastest master code by following the manually build steps and run the start script with the following changes to the demo.sh:

# database platform
spring_profiles_group_github=${SPRING_PFOFILES_GROUP_GITHUB:-h2}

# apollo config db info
apollo_config_db_url=${APOLLO_CONFIG_DB_URL:-"jdbc:h2:mem:testdb;mode=mysql;DATABASE_TO_UPPER=FALSE;BUILTIN_ALIAS_OVERRIDE=TRUE;"}
apollo_config_db_username=${APOLLO_CONFIG_DB_USERNAME:-sa}
apollo_config_db_password=${APOLLO_CONFIG_DB_PASSWORD:-}

# apollo portal db info
apollo_portal_db_url=${APOLLO_PORTAL_DB_URL:-"jdbc:h2:mem:testdb;mode=mysql;DATABASE_TO_UPPER=FALSE;BUILTIN_ALIAS_OVERRIDE=TRUE;"}
apollo_portal_db_username=${APOLLO_PORTAL_DB_USERNAME:-sa}
apollo_portal_db_password=${APOLLO_PORTAL_DB_PASSWORD:-}

However, some errors occurred. I'm unsure why, as the same configurations function correctly when I run the quick start in the IDE.

  1. apollo-service.log
2023-12-04 20:38:09.705  WARN 55269 --- [Apollo-ReleaseMessageScanner-1] o.h.engine.jdbc.spi.SqlExceptionHelper   : SQL Error: 42102, SQLState: 42S02
2023-12-04 20:38:09.707 ERROR 55269 --- [Apollo-ReleaseMessageScanner-1] o.h.engine.jdbc.spi.SqlExceptionHelper   : Table "ReleaseMessage" not found; SQL statement:
select releasemes0_."Id" as id1_17_, releasemes0_."DataChange_LastTime" as datachan2_17_, releasemes0_."Message" as message3_17_ from "ReleaseMessage" releasemes0_ where releasemes0_."Id">? order by releasemes0_."Id" asc limit ? [42102-214]
2023-12-04 20:38:09.742 ERROR 55269 --- [Apollo-ReleaseMessageScanner-1] c.c.f.a.b.message.ReleaseMessageScanner  : Scan and send message failed

org.springframework.dao.InvalidDataAccessResourceUsageException: could not prepare statement; SQL [select releasemes0_."Id" as id1_17_, releasemes0_."DataChange_LastTime" as datachan2_17_, releasemes0_."Message" as message3_17_ from "ReleaseMessage" releasemes0_ where releasemes0_."Id">? order by releasemes0_."Id" asc limit ?]; nested exception is org.hibernate.exception.SQLGrammarException: could not prepare statement
    at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:259)
    at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:233)
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:551)
    at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:61)
    at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:242)
    at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:152)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:145)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:220)
    at com.sun.proxy.$Proxy204.findFirst500ByIdGreaterThanOrderByIdAsc(Unknown Source)
    at sun.reflect.GeneratedMethodAccessor62.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
    at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:89)
    at com.ctrip.framework.apollo.common.aop.RepositoryAspect.invokeWithCatTransaction(RepositoryAspect.java:43)
    at sun.reflect.GeneratedMethodAccessor54.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:634)
    at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:624)
    at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:72)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:97)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:220)
    at com.sun.proxy.$Proxy204.findFirst500ByIdGreaterThanOrderByIdAsc(Unknown Source)
    at com.ctrip.framework.apollo.biz.message.ReleaseMessageScanner.scanAndSendMessages(ReleaseMessageScanner.java:114)
    at com.ctrip.framework.apollo.biz.message.ReleaseMessageScanner.scanMessages(ReleaseMessageScanner.java:102)
    at com.ctrip.framework.apollo.biz.message.ReleaseMessageScanner.lambda$afterPropertiesSet$0(ReleaseMessageScanner.java:74)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
  1. apollo-portal.log
2023-12-04 20:38:39.490 ERROR 56817 --- [main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'methodValidationPostProcessor' defined in class path resource [org/springframework/boot/autoconfigure/validation/ValidationAutoConfiguration.class]: Unsatisfied dependency expressed through method 'methodValidationPostProcessor' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'restTemplateFactory' defined in URL [jar:file:/Users/jason/git/mine/apollo-build-scripts/portal/apollo-portal.jar!/BOOT-INF/lib/apollo-portal-2.2.0-SNAPSHOT.jar!/com/ctrip/framework/apollo/portal/component/RestTemplateFactory.class]: Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'portalConfig' defined in URL [jar:file:/Users/jason/git/mine/apollo-build-scripts/portal/apollo-portal.jar!/BOOT-INF/lib/apollo-portal-2.2.0-SNAPSHOT.jar!/com/ctrip/framework/apollo/portal/component/config/PortalConfig.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'portalDBPropertySource': Invocation of init method failed; nested exception is org.springframework.jdbc.datasource.init.ScriptStatementFailedException: Failed to execute SQL script statement #1 of class path resource [jpa/init.h2.sql]: INSERT INTO "ServerConfig" ("Key", "Cluster", "Value", "Comment", "DataChange_CreatedBy", "DataChange_CreatedTime") VALUES ('eureka.service.url', 'default', 'http://localhost:8080/eureka/', 'Eureka服务Url,多个service以英文逗号分隔', 'default', '1970-01-01 00:00:00'), ('namespace.lock.switch', 'default', 'false', '一次
发布只能有一个人修改开关', 'default', '1970-01-01 00:00:00'), ('item.key.length.limit', 'default', '128', 'item key 最大长度限制', 'default', '1970-01-01 00:00:00'), ('item.value.length.limit', 'default', '20000', 'item value最大长度限制', 'default', '1970-01-01 00:00:00'), ('config-service.cache.enabled', 'default', 'false', 'ConfigService是否开启缓存,开启后能提
高性能,但是会增大内存消耗!', 'default', '1970-01-01 00:00:00'); nested exception is org.h2.jdbc.JdbcSQLSyntaxErrorException: Column "Cluster" not found; SQL statement:
INSERT INTO "ServerConfig" ("Key", "Cluster", "Value", "Comment", "DataChange_CreatedBy", "DataChange_CreatedTime") VALUES ('eureka.service.url', 'default', 'http://localhost:8080/eureka/', 'Eureka服务Url,多个service以英文逗号分隔', 'default', '1970-01-01 00:00:00'), ('namespace.lock.switch', 'default', 'false', '一次发布只能有一个人修改开关', 'default', '1970-01-01 00:00:00'), ('item.key.length.limit', 'default', '128', 'item key 最大长度限制', 'default', '1970-01-01 00:00:00'), ('item.value.length.limit', 'default', '20000', 'item value最大
长度限制', 'default', '1970-01-01 00:00:00'), ('config-service.cache.enabled', 'default', 'false', 'ConfigService是否开启缓存,开启后能提高性能,但是会增大内存消耗!', 'default', '1970-01-01 00:00:00') [42122-214]
    at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:541)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1352)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1195)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:582)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:213)
    at org.springframework.context.support.PostProcessorRegistrationDelegate.registerBeanPostProcessors(PostProcessorRegistrationDelegate.java:258)
    at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:764)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:567)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:147)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:731)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:408)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
    at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:164)
    at com.ctrip.framework.apollo.assembly.ApolloApplication.main(ApolloApplication.java:74)
    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.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:108)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:65)

@shoothzj
I submitted #5034 to fix the apollo-portal issue. Please help to take a look.
I'm not able to duplicate the apollo-service issue, will try later.

@nobodyiam
Copy link
Member

@Anilople

I've made some changes to the demo.sh script and it works perfectly on my laptop. Please give this version a try:

# database platform
spring_profiles_group_github=${SPRING_PROFILES_GROUP_GITHUB:-h2}

# apollo config db info
apollo_config_db_url=${APOLLO_CONFIG_DB_URL:-"jdbc:h2:mem:testdb;mode=mysql;DATABASE_TO_UPPER=FALSE;BUILTIN_ALIAS_OVERRIDE=TRUE;"}
apollo_config_db_username=${APOLLO_CONFIG_DB_USERNAME:-sa}
apollo_config_db_password=${APOLLO_CONFIG_DB_PASSWORD:-}

# apollo portal db info
apollo_portal_db_url=${APOLLO_PORTAL_DB_URL:-"jdbc:h2:mem:testdb;mode=mysql;DATABASE_TO_UPPER=FALSE;BUILTIN_ALIAS_OVERRIDE=TRUE;"}
apollo_portal_db_username=${APOLLO_PORTAL_DB_USERNAME:-sa}
apollo_portal_db_password=${APOLLO_PORTAL_DB_PASSWORD:-}

BTW, I'm considering using H2 as the default database for Apollo Quickstart. What are your thoughts on this?

@shoothzj
Copy link
Member Author

@nobodyiam I think it's reasonable to use h2 as default database in quick start. I created a draft PR: apolloconfig/apollo-quick-start#111
Once we merge this PR, we can simple start without any modify of demo.sh

@Anilople
Copy link
Contributor

@dosu-bot Caused by: java.lang.RuntimeException: Failed to load driver class org.h2.Driver in either of HikariConfig class loader or Thread context classloader

@nobodyiam
Copy link
Member

The quick start doc was updated in #5035

@nobodyiam nobodyiam closed this Mar 31, 2024
@dosubot dosubot bot removed this from the 2.2.0 milestone Mar 31, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Mar 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants