Grails 5.2.0 -- cannot deploy to JBOS EAP 7.4 - grails

grails create-app example
grails war
deploying war to JBOSS 7.4 (failed to deployed see error below)
NOTE: tomcat -- works!
JBOSS deployed ERROR:
{"WFLYCTL0080: Failed services" => {"jboss.deployment.unit."grailsJboss7Point4Test-0.1.war".undertow-deployment" => "java.lang.RuntimeException: io.micronaut.context.exceptions.NoSuchBeanException: No bean of type [org.springframework.context.ConfigurableApplicationContext] exists. Make sure the bean is not disabled by bean requirements (enable trace logging for 'io.micronaut.context.condition' to check) and if the bean is enabled then ensure the class is declared a bean and annotation processing is enabled (for Java and Kotlin the 'micronaut-inject-java' dependency should be configured as an annotation processor).
Caused by: java.lang.RuntimeException: io.micronaut.context.exceptions.NoSuchBeanException: No bean of type [org.springframework.context.ConfigurableApplicationContext] exists. Make sure the bean is not disabled by bean requirements (enable trace logging for 'io.micronaut.context.condition' to check) and if the bean is enabled then ensure the class is declared a bean and annotation processing is enabled (for Java and Kotlin the 'micronaut-inject-java' dependency should be configured as an annotation processor).
Caused by: io.micronaut.context.exceptions.NoSuchBeanException: No bean of type [org.springframework.context.ConfigurableApplicationContext] exists. Make sure the bean is not disabled by bean requirements (enable trace logging for 'io.micronaut.context.condition' to check) and if the bean is enabled then ensure the class is declared a bean and annotation processing is enabled (for Java and Kotlin the 'micronaut-inject-java' dependency should be configured as an annotation processor)."}}

Related

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'beanName'

I'm trying to create a Web Service from a WSDL File (Top down Java bean Web Service) by using CXF 3.5.3, but it's not working. After I run it on the Server, this error appears
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:META-INF/cxf/cxf-extension-soap.xml]
Offending resource: ServletContext resource [/WEB-INF/cxf-beans.xml];
nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [META-INF/cxf/cxf-extension-soap.xml];
nested exception is java.io.FileNotFoundException: class path resource [META-INF/cxf/cxf-extension-soap.xml] cannot be opened because it does not exist
After researching on other forums, I deleted these two lines in cxf-beans.xml
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
And replace it with
<import resource="classpath*:META-INF/cxf/cxf-extension-*.xml"/>
After cleaning and running on the Server again, I see a new error appearing in the console
WARNING: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'nvu3interfacev20': Cannot create inner bean '(inner bean)#b790f3d' of type [fr.band.tcn2021.nvu3.servicev2.Nvu3InterfaceV20Impl] while setting constructor argument; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [fr.band.tcn2021.nvu3.servicev2.Nvu3InterfaceV20Impl] for bean with name '(inner bean)#b790f3d'; nested exception is java.lang.ClassNotFoundException: fr.band.tcn2021.nvu3.servicev2.Nvu3InterfaceV20Impl
Juli 25, 2022 2:10:15 PM org.springframework.web.context.ContextLoader initWebApplicationContext
SEVERED: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'nvu3interfacev20': Cannot create inner bean '(inner bean)#b790f3d' of type [fr.band.tcn2021.nvu3.servicev2.Nvu3InterfaceV20Impl] while setting constructor argument; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [fr.band.tcn2021.nvu3.servicev2.Nvu3InterfaceV20Impl] for bean with name '(inner bean)#b790f3d'; nested exception is java.lang.ClassNotFoundException: fr.band.tcn2021.nvu3.servicev2.Nvu3InterfaceV20Impl
How can I debug this error and run this Web service on the Server. Hope you can help! Thanks!

Grails 3 hibernateDatastore stratup error after migrating from Grails 2

I am upgrading to Grails 3.3.1 from a Grails 2.4 app.
Things seemed to be going slow but OK until I stumbled into this problem when trying to run the app:
Configuring Spring Security Core ...
... finished configuring Spring Security Core
Configuring Spring Security Shiro ...
... finished configuring Spring Security Shiro
2017-12-19 18:51:43.400 ERROR --- [ost-startStop-1] o.s.b.c.embedded.tomcat.TomcatStarter : Error starting Tomcat context. Exception: org.springframework.beans.factory.BeanCreationException. Message: Error creating bean with name 'grailsCacheFilter': Cannot create inner bean '(inner bean)#3238926e' of type [grails.plugin.cache.web.filter.simple.MemoryPageFragmentCachingFilter] while setting bean property 'filter'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name '(inner bean)#3238926e': Unsatisfied dependency expressed through method 'setUrlMappingsHandlerMapping' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'urlMappingsHandlerMapping': Unsatisfied dependency expressed through method 'setWebRequestInterceptors' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'openSessionInViewInterceptor': Cannot resolve reference to bean 'hibernateDatastore' while setting bean property 'hibernateDatastore'; 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 java.lang.ExceptionInInitializerError
2017-12-19 18:51:43.492 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:
grailsCacheFilter
↓
(inner bean)#3238926e
↓
urlMappingsHandlerMapping
↓
openSessionInViewInterceptor
┌─────┐
| hibernateDatastore
└─────┘
Hibernate and Shiro version in the build gradle:
// hibernate
compile "org.grails.plugins:hibernate5:6.0.13"
compile "org.hibernate:hibernate-core:5.1.10.Final"
compile "org.hibernate:hibernate-ehcache:5.1.10.Final"
compile 'org.grails.plugins:spring-security-shiro:3.0.1'
Is this a common error people are running into?
Will I have to go through my dependences one by one to see if one of them is causing this?

Not able to connect to Oracle Database using Docker Container

I am deploying my application into a Docker container, on Webspehre liberty server as an EAR file.
However, when the application is running, it cannot connect to the Oracle Database which is running on another host where we are trying to connect through jndi lookup defined in server.xml of Websphere liberty.
<dataSource id="oracle" jndiName="jdbc/QADBApp" type="javax.sql.Datasource">
<jdbcDriver libraryRef="OracleJDBCLib"/>
<properties.oracle URL="jdbc:oracle:thin:#//xyz.mycomany.com:1521/prexyz" username="****" password="****" />
We are able to ping the server from inside the container and getting response but at run time, it is not able to establish the db connection.
Note:- Oracle DB is not containerized. We are simply trying to establish the connection through jndi lookup as mentioned above.
Below is the error message. Could anyone help on how to connect Database in this scenario?Thanks in advance !!
[ERROR ] Context initialization failed
Error creating bean with name 'myappFacade': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private transient com.mycompany.myappTool.service.util.HibernateUtil com.mycompany.myappTool.service.facade.myappToolFacade.hibernateUtil; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateUtil' defined in file [/opt/ibm/wlp/usr/servers/defaultServer/apps/expanded/myapp.ear/myappTool.war/WEB-INF/classes/com/mycompany/myappTool/service/util/HibernateUtil.class]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: com.mycompany.myappTool.service.util.HibernateUtil (initialization failure)
[ERROR ] SRVE0271E: Uncaught init() exception created by servlet [myapp] in application [myapp]: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myappFacade': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private transient com.mycompany.myappTool.service.util.HibernateUtil com.mycompany.myappTool.service.facade.myappToolFacade.hibernateUtil; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateUtil' defined in file [/opt/ibm/wlp/usr/servers/defaultServer/apps/expanded/myapp.ear/myappTool.war/WEB-INF/classes/com/mycompany/myappTool/service/util/HibernateUtil.class]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: com.mycompany.myappTool.service.util.HibernateUtil (initialization failure)
could you try using ip address instead of xyz.mycomany.com:1521 ? It is definitely a network issue ,you might want to go through https://docs.docker.com/engine/userguide/networking/default_network/
Also you can try from inside your container cat /etc/hosts
it should list the ip/machine you want to connect to.

Grails 3 throwing strange exception when using more than 14 Domain classes with #Resource

Grails 3 is throwing a strange exception when using REST Resources. What I have noticed is that when I have more than 14 Domain classes with the #Resource annotation it is throw a weird exception and refuses to start with the run-app command. I have checked in code to a github repo to demonstrate the problem. If you get this project and do a grails run-app it will throw an exception. I am using JDK 7 and grails 3.0.4.
Github repo: https://github.com/akhopkar/testREST
The Exception it throws is:
ERROR grails.boot.GrailsApp - Application startup failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.test.A2Controller': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Comparison method violates its general contract!

Error deploying Grails 2.0.4 to Glassfish 3.1.2 Server

I am using Spring Security Core 1.2.7.3 plugin and am getting this error when trying to deploy:
Error occurred during deployment: Exception while loading the app :
java.lang.IllegalStateException: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException:
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 'propertie .... msg.seeServerLog
The application works fine when I run it from inside netbeans, but when I try to deploy it I am getting the error. I have tried cleaning, and uncommenting the 'mysql:mysql-connector-java:5.1.16' code in the dependencies in the BuildConfig.groovy file. I am using an Oracle jdbc driver which I have installed inside my /lib folder.
I am guessing that this has something to do with the Oracle jdbc driver not being found.
update: I have added my production closure below
production {
dataSource {
url = "jdbc:oracle:thin:#MYSERVERNAME.com:xxxx:xxxxxxx"
pooled = true
properties {
maxActive = -1
minEvictableIdleTimeMillis=1800000
timeBetweenEvictionRunsMillis=1800000
numTestsPerEvictionRun=3
testOnBorrow=true
testWhileIdle=true
testOnReturn=true
validationQuery="SELECT 1"
}
}
}
Check your DataSource.groovy, most likely there's something wrong in your production closure. When you run inside NetBeans you're probably using the development environment but when you build a war Grails uses the production environment. You could try setting the -Dgrails.env=production flag inside the IDE to see if you run into the same problem. If it works you know it's a problem with Glassfish, if it fails you know it's a problem with your environment configuration.
Edit:
Try adding this to your production closure:
driverClassName = "oracle.jdbc.driver.OracleDriver"
dialect = "org.hibernate.dialect.Oracle10gDialect"
Or whichever dialect is appropriate for your version of Oracle.

Resources