docker-compose for artifactory and mysql images - mysql

I am using docker-compose to set up Artifactory pro with MySQL as the storage database.
Here is my docker-compose.yml
artifactory:
build: artifactory
links:
- mysql
mysql:
image: stain/mysql-for-artifactory
And here is artifactory/Dockerfile
#Dockerfile for Artifactory Pro
FROM stain/artifactory-with-mysql
ADD ./artifactory.war /tomcat/webapps
When I run the command 'docker-compose up' I get the following exception:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'aclServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.artifactory.storage.db.DbService org.artifactory.storage.db.security.service.AclServiceImpl.dbService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dbServiceImpl': Invocation of init method failed; nested exception is com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
what am I missing?

Related

Groovy/Grails Hibernate failed to create bean transaction

This is the error I get when I launch tomcat w/ my webapp. Im sure it has something to do w/ the hibernate plugin.
I had the web application running on version 12.04 LTS ubuntu and now have upgraded to 18.04 LTS. I have the grails web-app compiled as a .war and have not recompiled the war. I figured it would continue to work from one version of ubuntu to another.
15-Jun-2018 12:22:32.580 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log No Spring WebApplicationInitializer types detected on classpath
15-Jun-2018 12:22:33.287 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log Initializing Spring root WebApplicationContext
15-Jun-2018 12:22:38.637 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.listenerStart Exception sending context initialized event to listener instance of class [org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener]
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.HibernateException: Unable to get the default Bean Validation factory
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:514)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:844)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.HibernateException: Unable to get the default Bean Validation factory
... 5 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Invocation of init method failed; nested exception is org.hibernate.HibernateException: Unable to get the default Bean Validation factory
... 5 more
Caused by: org.hibernate.HibernateException: Unable to get the default Bean Validation factory
... 5 more
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
... 5 more
Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
at javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:111)
... 7 more
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
... 8 more
15-Jun-2018 12:22:38.647 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log Closing Spring root WebApplicationContext
15-Jun-2018 12:22:38.955 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextInitialized()
15-Jun-2018 12:22:38.955 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextInitialized()
15-Jun-2018 12:22:38.956 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: attributeAdded('StockTicker', 'async.Stockticker#306acdc')
Thanks for any help or tips!!
The key line is this one Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
It appears that the Java runtime you are running this under on your new version of Ubuntu is different. Is it by chance Java 9? If so you probably have the problem described here How to resolve java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException in Java 9
You could fix the problem as described in that answer, or install a previous version of Java and use that to run your Grails application

Grails 3 urlMappingsReport failed

I have created a Grails 3 Restful application, using MySQL as my database. The endpoints are working fine when I hit them with Rest Clients like Postman.
I am using this blog for reference. But it fails when I try to run the command grails url-mappings-report.
Here is the output:
:compileJava NO-SOURCE
:compileGroovy
:buildProperties UP-TO-DATE
:processResources
:classes
:findMainClass
:urlMappingsReport
Configuring Spring Security Core ...
... finished configuring Spring Security Core
Configuring Spring Security REST 2.0.0.M2...
... finished configuring Spring Security REST
... with GORM support
2017-10-01 17:45:24.867 ERROR --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
The dependencies of some of the beans in the application context form a cycle:
restTokenValidationFilter
↓
restAuthenticationProvider
↓
tokenStorageService
↓
userDetailsService
┌─────┐
| hibernateDatastore
↑ ↓
| userPasswordEncoderListener
└─────┘
Context failed to load: Error creating bean with name 'restTokenValidationFilter': Cannot resolve reference to bean 'restAuthenticationProvider' while setting bean property 'restAuthenticationProvider'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'restAuthenticationProvider': Cannot resolve reference to bean 'tokenStorageService' while setting bean property 'tokenStorageService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tokenStorageService': Cannot resolve reference to bean 'userDetailsService' while setting bean property 'userDetailsService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDetailsService': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateDatastore': Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.grails.orm.hibernate.HibernateDatastore]: Constructor threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userPasswordEncoderListener': Cannot resolve reference to bean 'hibernateDatastore' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'hibernateDatastore': Requested bean is currently in creation: Is there an unresolvable circular reference?
:urlMappingsReport FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':urlMappingsReport'.
> Process 'command '/usr/lib/jvm/java-8-openjdk-amd64/bin/java'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 37.453 secs
| Error Command [url-mappings-report] error: Could not execute build using Gradle distribution 'https://services.gradle.org/distributions/gradle-3.4.1-bin.zip'. (Use --stacktrace to see the full trace)
Grails Version: 3.2.10
Groovy Version: 2.4.10
JVM Version: 1.8.0_131
Try using GORM version >= 6.1
I get the same issue with GORM version 6.0.12.RELEASE

Spring boot junit test cannot get command line argument (Eclipse - STS)

I did a Spring Boot application, and use some command line arguments. I read them in services like
#Value("${v}")
private String vertical;
Application works and see value passed from command line. I added same command line arguments to all JUnit tests run configurations
--spring.profiles.active=development --m=keyword --v=Healthcare --i=keyword_update.json
But when I try to run test it crashes with message, that means application context cannot get command line attribute:
2016-05-28 17:16:00.924 ERROR 4204 --- [ main]
o.s.boot.SpringApplicat ion : Application startup failed
org.springframework.beans.factory.BeanCreationException: Error
creating bean wit h name 'application': Injection of autowired
dependencies failed; nested excepti on is
org.springframework.beans.factory.BeanCreationException: Could not
autowir e field: healthjobs.service.Catalog
healthjobs.app.Application.catalog; nested e xception is
org.springframework.beans.factory.BeanCreationException: Error creat
ing bean with name 'catalogImpl': Injection of autowired dependencies
failed; ne sted exception is
org.springframework.beans.factory.BeanCreationException: Could not
autowire field: healthjobs.service.CatalogPage
healthjobs.service.CatalogIm pl.catalogPage; nested exception is
org.springframework.beans.factory.BeanCreati onException: Error
creating bean with name 'catalogPageImpl': Injection of autow ired
dependencies failed; nested exception is
org.springframework.beans.factory. BeanCreationException: Could not
autowire field: private java.lang.String health
jobs.service.CatalogPageImpl.vertical; nested exception is
java.lang.IllegalArgu mentException: Could not resolve placeholder 'v'
in string value "${v}"
Why? How to run tests with command line arguments in spring boot?
PS full stack trace appears too long to attach here. When I run mvn package I get same error about test, but mvn run config does not have ability to input command line arguments. My environment:
Spring Tool Suite Version: 3.7.2.RELEASE Build Id: 201511261048
Platform: Eclipse Mars.1 (4.5.1)

grails test-app MetaDataAccessException after upgrade to mysql-connector-java:5.1.34

I recently upgraded to the mysql:mysql-connector-java:5.1.34 connector. My Grails version is 2.2.4. MySQL version is 5.6.10. Upgrading went very smoothly, and the application itself seems to go fine. However, one of my test apps is failing.
The following error happens:
Error Error executing script TestApp:
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'transactionManagerPostProcessor':
Initialization of bean failed;
nested exception is
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'transactionManager':
Cannot resolve reference to bean 'sessionFactory'
while setting bean property 'sessionFactory';
nested exception is
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'sessionFactory':
Cannot resolve reference to bean 'hibernateProperties'
while setting bean property 'hibernateProperties';
nested exception is
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'hibernateProperties':
Cannot resolve reference to bean 'dialectDetector'
while setting bean property 'properties' with key [hibernate.dialect];
nested exception is
org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'dialectDetector':
Invocation of init method failed;
nested exception is
org.springframework.jdbc.support.MetaDataAccessException:
Error while extracting DatabaseMetaData;
nested exception is java.sql.SQLException:
Access denied for user 'web'#'localhost' (using password: YES)
(Use --stacktrace to see the full trace)
I doublechecked the web user, and as far as I can tell the account is defined properly and has admin privs comparable to root. This has happened both on my development box with my personal database and on our jenkins build system.
I don't see anything in the logs, Running with --stacktrace does not give me any useful information, googling does not show this as a common error.

BeanCreationException in grails deployment on linux env

I am trying to deploy a war file created using grails on tomcat6. The same war files works just alright on my windows machine it does give me following exception with prod linux environment
SEVERE: Exception sending context initialized event to listener instance of class org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'hibernateProperties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'com.mysql.jdbc.Driver'
and
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'com.mysql.jdbc.Driver'
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:329)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:107)
I have already gone through
How do I fix the org.springframework.beans.factory.BeanCreationException error in my Grails application?
and
Grails transactionManager exception on Run
but it die not help
Scroll to the end where it says Cannot load JDBC driver class 'com.mysql.jdbc.Driver'. It's usually the case with Grails exceptions that the top-level text is generic and useless, and the real cause is further down near the bottom.
I'm guessing you put the MySQL driver jar in the lib directory, but Grails didn't find it there. You shouldn't use jars unless they're not available in an online repo, and the MySQL driver certainly is. In fact it's the sample entry in BuildConfig.groovy in the dependencies block. Uncomment that, optionally updating to the latest version (5.1.28), and redeploy your war file. Make sure it's there in the file, in WEB-INF/lib