• Как подключить классы и методы одного модуля к другому?

    @mr_molyar Автор вопроса
    DVamp1r3,
    Залил на гитхаб пример того, что я пытаюсь воплотить
    https://github.com/simonishviliM/WorkWithModules
    А вот команды которыми я всё запускаю
    javac -d appmodules/first_module first_module/module-info.java first_module/src/main/java/ru/mikhail/Utils/StyleUtils.java
    javac --module-path appmodules -d appmodules/second_module second_module/module-info.java second_module/src/main/java/ru/mikhail/Main.java
    java -p appmodules -m second_module/ru.mikhail.Main

    Собственно вопрос в том, как это всё запаковать в war через maven?
    P.S. Прошу прощения за такой долгий ответ
  • Не получается подключить spring config-server к postgresql?

    @mr_molyar Автор вопроса
    spoiler

    . ____ _ __ _ _
    /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
    ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
    \\/ ___)| |_)| | | | | || (_| | ) ) ) )
    ' |____| .__|_| |_|_| |_\__, | / / / /
    =========|_|==============|___/=/_/_/_/
    :: Spring Boot :: (v2.2.4.RELEASE)

    2020-04-14 19:45:01.884 INFO 5956 --- [ main] r.m.c.ConfigServerApplication : The following profiles are active: native
    2020-04-14 19:45:02.755 INFO 5956 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
    2020-04-14 19:45:02.772 INFO 5956 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 9ms. Found 0 JPA repository interfaces.
    2020-04-14 19:45:02.878 WARN 5956 --- [ main] o.s.boot.actuate.endpoint.EndpointId : Endpoint ID 'service-registry' contains invalid characters, please migrate to a valid format.
    2020-04-14 19:45:03.030 INFO 5956 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=5f712c10-005d-30ea-9965-267eb4090bb7
    2020-04-14 19:45:03.181 INFO 5956 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagem
    entConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
    2020-04-14 19:45:03.653 INFO 5956 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8888 (http)
    2020-04-14 19:45:03.664 INFO 5956 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
    2020-04-14 19:45:03.664 INFO 5956 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.30]
    2020-04-14 19:45:03.825 INFO 5956 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
    2020-04-14 19:45:03.825 INFO 5956 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1918 ms
    2020-04-14 19:45:03.913 WARN 5956 --- [ main] c.n.c.sources.URLConfigurationSource : No URLs will be polled as dynamic configuration sources.
    2020-04-14 19:45:03.913 INFO 5956 --- [ main] c.n.c.sources.URLConfigurationSource : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.

    2020-04-14 19:45:03.923 INFO 5956 --- [ main] c.netflix.config.DynamicPropertyFactory : DynamicPropertyFactory is initialized with configuration sources: com.netflix.config.ConcurrentCompositeConfiguration@6070775e
    2020-04-14 19:45:04.099 ERROR 5956 --- [ main] o.s.b.web.embedded.tomcat.TomcatStarter : Error starting Tomcat context. Exception: org.springframework.beans.factory.BeanCreationException. Message: Error creating bean with name 'servletEndpointRegistrar'
    defined in class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfiguration$WebMvcServletEndpointManagementContextConfiguration.class]: Bean instantiation via factory method failed; nested exception is o
    rg.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.endpoint.web.ServletEndpointRegistrar]: Factory method 'servletEndpointRegistrar' threw exception; nested exception is org.springframework.beans.factory.Uns
    atisfiedDependencyException: Error creating bean with name 'healthEndpoint' defined in class path resource [org/springframework/boot/actuate/autoconfigure/health/HealthEndpointConfiguration.class]: Unsatisfied dependency expressed through method 'healthEndpoint' pa
    rameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'healthContributorRegistry' defined in class path resource [org/springframework/boot/actuate/autoconfigure/health/HealthEndpointConfiguration.class
    ]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.health.HealthContributorRegistry]: Factory method 'healthContributorRegistry' threw ex
    ception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dbHealthContributor' defined in class path resource [org/springframework/boot/actuate/autoconfigure/jdbc/DataSourceHealthContributorAutoConfiguratio
    n.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.actuate.health.HealthContributor]: Factory method 'dbHealthContributor' threw exception
    ; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiat
    ion via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfig
    ure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class
    2020-04-14 19:45:04.119 INFO 5956 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
    2020-04-14 19:45:04.128 WARN 5956 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server
    ; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
    2020-04-14 19:45:04.149 INFO 5956 --- [ main] ConditionEvaluationReportLoggingListener :

    Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
    2020-04-14 19:45:04.158 ERROR 5956 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :

    ***************************
    APPLICATION FAILED TO START
    ***************************

    Description:

    Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.

    Reason: Failed to determine a suitable driver class

    Action:

    Consider the following:
    If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
    If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).

    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 8.720 s
    [INFO] Finished at: 2020-04-14T19:45:04+03:00
    [INFO] Final Memory: 47M/164M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.2.4.RELEASE:run (default-cli) on project config-server: Application finished with exit code: 1 -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] cwiki.apache.org/confluence/display/MAVEN/MojoExec...
  • Не получается подключить spring config-server к postgresql?

    @mr_molyar Автор вопроса
    сергей кузьмин, проблема которую вы описали была связана с тем, что когда я работал через mvn clean spring-boot:run , то он пытался работать с 8 версией, а в помнике стояла 11, я подправил, добавив в pom плагин mvn с таргетом на 11, теперь запуская через mvn clean spring-boot:run ошибка следующая
  • Не получается подключить spring config-server к postgresql?

    @mr_molyar Автор вопроса
    сергей кузьмин,
    spoiler

    [INFO] Scanning for projects...
    [INFO]
    [INFO] ------------------------------------------------------------------------
    [INFO] Building config-server 0.0.1-SNAPSHOT
    [INFO] ------------------------------------------------------------------------
    [INFO]
    [INFO] >>> spring-boot-maven-plugin:2.2.4.RELEASE:run (default-cli) > test-compile @ config-server >>>
    [INFO]
    [INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ config-server ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] Copying 2 resources
    [INFO] Copying 2 resources
    [INFO]
    [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ config-server ---
    [INFO] Nothing to compile - all classes are up to date
    [INFO]
    [INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) @ config-server ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] skip non existing resourceDirectory C:\Users\Admin\IdeaProjects\LoveFood\config-server\src\test\resources
    [INFO]
    [INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ config-server ---
    [INFO] No sources to compile
    [INFO]
    [INFO] <<< spring-boot-maven-plugin:2.2.4.RELEASE:run (default-cli) < test-compile @ config-server <<<
    [INFO]
    [INFO]
    [INFO] --- spring-boot-maven-plugin:2.2.4.RELEASE:run (default-cli) @ config-server ---
    [INFO] Attaching agents: []
    Error: A JNI error has occurred, please check your installation and try again
    Exception in thread "main" java.lang.UnsupportedClassVersionError: ru/mikhail/configserver/ConfigServerApplication has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file
    versions up to 52.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:495)
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 2.902 s
    [INFO] Finished at: 2020-04-13T23:05:34+03:00
    [INFO] Final Memory: 28M/68M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.2.4.RELEASE:run (default-cli) on project config-server: Application finished with exit code: 1 -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] cwiki.apache.org/confluence/display/MAVEN/MojoExec...

    C:\Users\Admin\IdeaProjects\LoveFood\config-server>mvn clean spring-boot:run
    [INFO] Scanning for projects...
    [INFO]
    [INFO] ------------------------------------------------------------------------
    [INFO] Building config-server 0.0.1-SNAPSHOT
    [INFO] ------------------------------------------------------------------------
    [INFO]
    [INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ config-server ---
    [INFO] Deleting C:\Users\Admin\IdeaProjects\LoveFood\config-server\target
    [INFO]
    [INFO] >>> spring-boot-maven-plugin:2.2.4.RELEASE:run (default-cli) > test-compile @ config-server >>>
    [INFO]
    [INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ config-server ---
    [INFO] Using 'UTF-8' encoding to copy filtered resources.
    [INFO] Copying 2 resources
    [INFO] Copying 2 resources
    [INFO]
    [INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ config-server ---
    [INFO] Changes detected - recompiling the module!
    [INFO] Compiling 1 source file to C:\Users\Admin\IdeaProjects\LoveFood\config-server\target\classes
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 2.372 s
    [INFO] Finished at: 2020-04-13T23:05:42+03:00
    [INFO] Final Memory: 27M/65M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project config-server: Fatal error compiling: invalid target release: 11 -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] cwiki.apache.org/confluence/display/MAVEN/MojoExec...

  • Не получается подключить spring config-server к postgresql?

    @mr_molyar Автор вопроса
    сергей кузьмин, спасибо за комментарий, к сожалению и это не помогло(
  • Не получается подключить spring config-server к postgresql?

    @mr_molyar Автор вопроса
    Спасибо за ваш ответ, но к сожалению он не дал никаких видимых результатов