I'm working on deploying a WAR under Tomcat 6 on a remote server. Now if I deploy as such on my local machine everything works fine. Remote deployment triggers a very unfriendly set of exceptions.
log4j:ERROR setFile(null,true) call failed.
java.io.FileNotFoundException: stacktrace.log (Permission denied)
at java.io.FileOutputStream.openAppend(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:207)
at java.io.FileOutputStream.<init>(FileOutputStream.java:131)
at org.apache.log4j.FileAppender.setFile(FileAppender.java:294)
at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:165)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
<...snip>
ERROR initWebApplicationContext, Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageSource': 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 create PoolableConnectionFactory (File input/output error prodDB.properties java.io.FileNotFoundException: prodDB.properties.new (Permission denied))
at java.lang.Thread.run(Thread.java:636)
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': 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 create PoolableConnectionFactory (File input/output error prodDB.properties java.io.FileNotFoundException: prodDB.properties.new (Permission denied))
... 1 more
Caused by: 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 create PoolableConnectionFactory (File input/output error prodDB.properties java.io.FileNotFoundException: prodDB.properties.new (Permission denied))
... 1 more
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 create PoolableConnectionFactory (File input/output error prodDB.properties java.io.FileNotFoundException: prodDB.properties.new (Permission denied))
... 1 more
Caused by: 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 create PoolableConnectionFactory (File input/output error prodDB.properties java.io.FileNotFoundException: prodDB.properties.new (Permission denied))
... 1 more
Caused by: org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (File input/output error prodDB.properties java.io.FileNotFoundException: prodDB.properties.new (Permission denied))
... 1 more
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (File input/output error prodDB.properties java.io.FileNotFoundException: prodDB.properties.new (Permission denied))
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1225)
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
at $Proxy15.getMetaData(Unknown Source)
... 1 more
Caused by: java.sql.SQLException: File input/output error prodDB.properties java.io.FileNotFoundException: prodDB.properties.new (Permission denied)
at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
at org.hsqldb.jdbc.jdbcConnection.<init>(Unknown Source)
at org.hsqldb.jdbcDriver.getConnection(Unknown Source)
at org.hsqldb.jdbcDriver.connect(Unknown Source)
at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)
at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:294)
at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1247)
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1221)
... 3 more
I'm using HSQLDB as the database.
Tomcat is run as a service, so there shouldn't be any permission issues. Do I need to change permissions on something (if so where, because I can't find the attempted access)? Is there a configuration option I can set in Grails to either not log or redirect the logging?
This isn't about logging, it's about "prodDB.properties". You're getting a FileNotFoundException because it can't write (or possibly rename) it. The user that's running the app must not have write permission in the directory where it's creating the HSQLDB database files.
The default config uses a relative path, so it's writing wherever the app is launching from:
production {
dataSource {
dbCreate = "update"
url = "jdbc:hsqldb:file:prodDb;shutdown=true"
}
}
One fix is to hard-code the path in DataSource.groovy:
production {
dataSource {
dbCreate = "update"
url = "jdbc:hsqldb:file:/some/writeable/folder/prodDb;shutdown=true"
}
}
A better one is to enable external configuration files in Config.groovy:
grails.config.locations = ["classpath:${appName}-config.groovy"]
and create foo-config.groovy containing
dataSource {
url = "jdbc:hsqldb:file:/some/writeable/folder/prodDb;shutdown=true"
}
and put foo-config.groovy in $TOMCAT_HOME/lib which is in Tomcat's classpath (change foo to your app name). This way you can deploy the war to multiple locations and have just a config file override rather than hard-coding a single value in Config.groovy.
I suddenly encountered this problem when I upgraded to Windows 7. I had been using a shortcut to start Tomcat and I set the "Start In" directory to just plain "C:\". Windows 7 does not let non-admin users write into this directory. I created a subdirectory of my user home called "TomcatData" and changed my shortcut to start Tomcat from there. Everything now works fine.
Related
I am developing my application on Java version 1.8 and since my repository is on bitbucket, it is picking up the default configuration of Java 11.
Everything is working fine but when I am writing Integration Tests using Junit Mockito framework I am getting exception on bitbucket while executing the pipeline. Locally all tests are working fine.
Bitbucket by default is picking the latest version on sonar plugin which is 3.9 and because of that I am getting this exception
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar (default-cli) on project xyz: Execution default-cli of goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar failed: An API incompatibility was encountered while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.1.2184:sonar: java.lang.UnsupportedClassVersionError: org/sonar/batch/bootstrapper/EnvironmentInformation 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
I have tried following changes but nothing happened
1) Changed image: maven:3.6.3-jdk-11 To image: maven:3.6.3-jdk-8 in bitbucket-pipeline.yml file.
2) Added jacoco 0.7.9 version (Java 8 compatible) in pom file
3) Added sonar-maven-plugin version 3.6 (tried to downgrade it to be compatible with Java 8) in pom file
Can someone guide what is missing and what can be the issue. Also if I want to change the default bitucket docker image configuration how can I do that?
My bitbucket-pipeline.yml file
image: maven:3.6.3-jdk-11 #image: maven:3.6.3-jdk-8
clone
....
definitions
caches
sonar: ....
steps
...
...
script:
cd impl
mvn -B org.jacoco:jacoco-maven-plugin:prepare-agent verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar
My Integration Test File
#SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
#AutoConfigureMockMvc
#ActiveProfiles("test")
#RunWith(SpringRunner.class)
public class CountryControllerTest{
#Autowired public MockMvc mockMvc;
#Test
public void getCountryListTest() throws Exception {
mockMvc
.perform(MockMvcRequestBuilders.get("/api/countries"))
.andDo(print())
.andExpect(status().isOk())
.andExpect(jsonPath("$.data.length()").value(2))
.andExpect(jsonPath("$.data[0].name").value("USA"))
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE));
}
}
The Error is only occurring on bitbucket pipeline and not in local development
[ERROR] getCountryListTest(com.xyz.controller.CountryControllerTest) Time elapsed: 0.001 s <<< ERROR!
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'MyTokenFilter': Unsatisfied dependency expressed through field 'myRepository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myRepository': Cannot create inner bean '(inner bean)#7675d305' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#12345': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.MappingException: Could not get constructor for org.hibernate.persister.entity.SingleTableEntityPersister
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myRepository': Cannot create inner bean '(inner bean)#12345' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#12345': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.MappingException: Could not get constructor for org.hibernate.persister.entity.SingleTableEntityPersister
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#12345': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.MappingException: Could not get constructor for org.hibernate.persister.entity.SingleTableEntityPersister
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.MappingException: Could not get constructor for org.hibernate.persister.entity.SingleTableEntityPersister
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.MappingException: Could not get constructor for org.hibernate.persister.entity.SingleTableEntityPersister
Caused by: org.hibernate.MappingException: Could not get constructor for org.hibernate.persister.entity.SingleTableEntityPersister
Caused by: org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]
Caused by: java.lang.reflect.InvocationTargetException
Caused by: java.lang.NullPointerException
Try Java SE 17. Java SE 8 is slowly being discontinued.
Or else try using GitHub or GitLab. that should do the trick.
there is also a free app called ci circle in Github.
it is very easy once you install it.it's free for the bonus.
it can build your apps automatically every time you commit.
I cannot make a connection from a tomcat application to the postresql server on localhost:5432. The log tells me this:
org.postgresql.util.PSQLException: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
However, I verified the sql-server is running using a command line client jisql and a jdbc-jar downloaded from postgreql.
java -cp jisql/lib/jisql.jar:jisql/lib/jopt-simple-3.2.jar:jisql/postgresql-42.2.12.jar com.xigole.util.sql.Jisql -user uuuuuu -password ppppp -driver postgresql -cstring jdbc:postgresql://localhost:5432/dddddd -c \;
which is working, but the same config as in my java app (using grails and hibernate):
dataSource {
dbCreate = "create"
url = "jdbc:postgresql://localhost:5432/dddddd"
username = "uuuuuu"
password = "pppppp"
}
gives me:
2020-05-23 07:58:17,413 [localhost-startStop-1] ERROR StackTrace - Full Stack Trace:
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.postgresql.util.PSQLException: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
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': 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.postgresql.util.PSQLException: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
... 5 more
Caused by: 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.postgresql.util.PSQLException: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
... 5 more
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.postgresql.util.PSQLException: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
... 5 more
Caused by: 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.postgresql.util.PSQLException: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
... 5 more
Caused by: org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is org.postgresql.util.PSQLException: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
... 5 more
Caused by: org.postgresql.util.PSQLException: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:262)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:52)
at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:216)
at org.postgresql.Driver.makeConnection(Driver.java:404)
at org.postgresql.Driver.connect(Driver.java:272)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:208)
... 5 more
Caused by: java.net.ConnectException: Permission denied (connect failed)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:607)
at org.postgresql.core.PGStream.<init>(PGStream.java:61)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:144)
... 11 more
I am confused by the ConnectException: Permission denied message. whe I really try to connect to a different port like the first error message suggests I get the familliar java.net.ConnectException: Connection refused (Connection refused)
I also tried to pass -Djava.net.preferIPv4Stack=true" to tomcat with no avail
software used:
CentOS 7
postgresql 9.2.24
tomcat 7.0.76
openjdk version "1.8.0_252"
I had the same issue with CentOS 7, PostgreSQL 9.6.23, Tomcat 7.0.76. OpenJDK 1.8.0_302.
There is few steps to solve it :
Change references to "ident" and "md5" to "trust" in the pg_hba.conf file.
I was able to identify the location of this file in my system by the following command:
psql -U postgres -c 'SHOW hba_file'.
Set two SELinux boolean values to on(which were off).
The boolean values to set are "httpd_can_network_connect" and "tomcat_can_network_connect_db". You can check the values of each with the following commands:
getsebool -a | grep "httpd_can_network_connect "
getsebool -a | grep "tomcat_can_network_connect_db "
Both values were "off" on my system.
I changed them both to "on" with the following commands:
sudo setsebool -P tomcat_can_network_connect_db on
sudo setsebool -P httpd_can_network_connect on
Restart PostgreSQL, and now it's fixed !
I am working on a spring boot application with latest Angular 7. I have created a build and generated war file.
I have configured a folder in this the structure is :
project-tool.war
config/application-prod.yml
config/application-dev.yml
config/application.yml
run.sh
run.bat
In run.sh/run.bat, these command written -> java -jar project-tool.war --spring.profiles.active=prod --spring.config.location=config\application-prod.yml
I have created Oracle database instance on AWS and put the configuration in application-prod.yml.
Then I have run this project using the war file on Windows OS, it works fine.
I have to run this war file on Amazon EC2 instance. So I have uploaded this folder on EC2 medium instance. As I run this, it throws an error :
2019-03-02 06:50:53.489 ERROR 3082 --- [ost-startStop-1] o.s.b.web.embedded.tomcat.TomcatStarter : Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'securityConfiguration': Unsatisfied dependency expressed through field 'userDetailsService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userDetailsService' defined in URL [jar:file:/home/ec2-user/theProject/project-tool.war!/WEB-INF/classes!/com/myProject/security/DomainUserDetailsService.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userService': Unsatisfied dependency expressed through field 'auditLogService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'auditLogService' defined in URL [jar:file:/home/ec2-user/theProject/project-tool.war!/WEB-INF/classes!/com/myProject/service/AuditLogService.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'auditLogRepository': Cannot create inner bean '(inner bean)#44dbafd9' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#44dbafd9': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean]: Factory method 'entityManagerFactory' threw exception; nested exception is com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: IO Error: The Network Adapter could not establish the connection
2019-03-02 06:50:53.551 WARN 3082 --- [ost-startStop-1] o.a.c.loader.WebappClassLoaderBase : The web application [ROOT] appears to have started a thread named [oracle.jdbc.driver.BlockSource.ThreadedCachingBlockSource.BlockReleaser] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.lang.Object.wait(Native Method)
oracle.jdbc.driver.BlockSource$ThreadedCachingBlockSource$BlockReleaser.run(BlockSource.java:327)
2019-03-02 06:50:53.556 WARN 3082 --- [ 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
I also have another instance and other project working (spring and angularJS) fine in a similar manner. But why this not working, is there any issue with the command or with angular?
How to work it on Amazon EC2?
Your problem here reading your error stack trace is the database connection. Pay attention to the core error message:
Failed to initialize pool: IO Error: The Network Adapter could not establish the connection
I don't know how the Oracle database is configured but probably you have a problem with database listener configuration or more simply whit the network communication between your EC2 and Oracle Database instance i can suggest to try to see on the security group and network configuration.
The problem is not Angular but the database link between your app and the database.
getting the below stack trace while deploying war in weblogic
weblogic.application.ModuleException: Error creating bean with name
'licenseMapperImpl': Failed to introspect bean class
[springfox.documentation.swagger2.mappers.LicenseMapperImpl] nested
exception is java.lang.NoClassDefFoundError: io/swagger/models/License
I request help making use of the following stack trace. Although this is a Groovy/Grails application, it still boils down to Java. In working along with the book 'Grails in action', I built an application in G/G, Grails v1.3.7. I imported this into the 'Spring Source Tools Suite', which uses Grails v2.2.3. It compiles fine, but won't run. Here is the first part of the stack trace (the entire thing is huge, but most of it just keeps repeating) ...
2013-10-17 16:28:16,074 [localhost-startStop-1] ERROR StackTrace - Full Stack Trace:
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 create PoolableConnectionFactory (Unsupported connection setting "SHUTDOWN" [90113-164])
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
at org.codehaus.groovy.grails.commons.spring.ReloadAwareAutowireCapableBeanFactory.doCreateBean(ReloadAwareAutowireCapableBeanFactory.java:122)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:713)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:457)
at org.codehaus.groovy.grails.commons.spring.DefaultRuntimeSpringConfiguration.getApplicationContext(DefaultRuntimeSpringConfiguration.java:153)
at org.codehaus.groovy.grails.commons.spring.GrailsRuntimeConfigurator.configure(GrailsRuntimeConfigurator.java:170)
at org.codehaus.groovy.grails.commons.spring.GrailsRuntimeConfigurator.configure(GrailsRuntimeConfigurator.java:127)
at org.codehaus.groovy.grails.web.context.GrailsConfigUtils.configureWebApplicationContext(GrailsConfigUtils.java:121)
at org.codehaus.groovy.grails.web.context.GrailsContextLoader.initWebApplicationContext(GrailsContextLoader.java:107)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4887)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5381)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
I latched on to the line that mentions:
(Unsupported connection setting "SHUTDOWN" [90113-164])
... it appears to be located in: ..\springsource\grails-2.2.3\src\java-addin\org\codehaus\groovy\grails\plugins\datasource\DataSourceGrailsPlugin.groovy in this call:
connection.createStatement().executeUpdate('SHUTDOWN')
This code comes with the IDE. Try as I might, I can't figure out what I might do to correct this problem. Tomcat problem? Any help is appreciated. Thanks in advance,