Bean Creation Exception when I run Liferay module - eclipse

I get Bean Creation Exception:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creati
ng bean with name 'counterHibernateSessionFactory' defined in class path resourc
e [META-INF/hibernate-spring.xml]: Cannot resolve reference to bean 'counterData
Source' while setting bean property 'dataSource'; nested exception is org.spring
framework.beans.factory.BeanCreationException: Error creating bean with name 'co
unterDataSource' defined in class path resource [META-INF/counter-infrastructure
-spring.xml]: Cannot resolve reference to bean 'counterDataSourceImpl' while set
ting bean property 'targetDataSource';
I am trying to run a liferay module on a tomcat server.I use Eclipse Luna, tomcat server 8.0.32, liferay 7.0 ga3.I searched for helpful information, didn't find any to solve the problem.Thank you!

I solved this, the problem was that I didn't have Gradle IDE incorporated and also I was trying to run the module directly on my server, but firstly I had to build it with gradle.Now I am deploying my liferay modules on serves by going to the root path of the module and applying the command with blade cli: blade deploy.

Related

Eclipse build not working but maven build works; I get the error: Consider defining a bean of type 'mapper' in your configuration

I get the below error when I do a update maven in eclipse and then start the application. But when I run the application after doing a manual maven build manually it works. Why is that???
Description:
Parameter 1 of constructor in 'Command' required a bean of type 'Mapper' that could not be found.
The injection point has the following annotations:
- #org.springframework.beans.factory.annotation.Autowired(required=false)
Action:
Consider defining a bean of type 'Mapper' in your configuration.

The method getJspApplicationContext(ServletContext) is undefined for the type JspFactory is not working from eclipse

I am trying to deploy a gradle web project using tomcat in eclipse and when I am trying to access the application it throws me an exception as follows:
org.apache.jasper.JasperException: Unable to compile class for JSP:
An error occurred at line: [36] in the generated java file: [......plugins\org.eclipse.wst.server.core\tmp0\work\Catalina...\org\apache\jsp\error_jsp.java]
The method getJspApplicationContext(ServletContext) is undefined for the type JspFactory
Stacktrace:
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103)
The same application I am able to deploy manually in the tomcat server with out using eclipse then it is working perfectly.
Please provide me a solution.
While deploying the application into server using eclipse it is adding some dependencies which are conflicted to dependencies added using gradle, after removing the conflicted jars the solved the issue.
the generated war only have the jars which are configured in the gradle so that is working when we deploy it manually on the server.

Running JUnit Integration Tests Spring/JHipster in STS

I have a Jhipster Generated with v3.4.0 (using Gradle).
I'm attempting to run and debug unit tests from STS.
From documentation:
Those tests can be run directly in your IDE, by right-clicking on each
test class, or by running mvn clean test (or ./gradlew test if you run
Gradle).
While the gradle task $.gradlew test executes as expected, when I attempt to "right click" and Run As Junit Test or Debug As Junit test - I get exceptions around the database:
Small part of stacktrace:
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name
'org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration':
Injection of autowired dependencies failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Could not
autowire method: public void
org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration.setFilterChainProxySecurityConfigurer(org.springframework.security.config.annotation.ObjectPostProcessor,java.util.List)
throws java.lang.Exception; nested exception is
org.springframework.beans.factory.BeanExpressionException: Expression
parsing failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'securityConfiguration': Injection of
autowired dependencies failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Could not
autowire field: private
org.springframework.security.core.userdetails.UserDetailsService
web.myapp.core.config.SecurityConfiguration.userDetailsService;
nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'userDetailsService': Injection of autowired
dependencies failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Could not
autowire field: private web.myapp.core.repository.UserRepository
web.myapp.core.security.UserDetailsService.userRepository; nested
exception is org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'userRepository': Cannot create inner
bean '(inner bean)#1c752902' 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)#1c752902': 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/HibernateJpaAutoConfiguration.class]:
Invocation of init method failed; nested exception is
org.hibernate.cache.NoCacheRegionFactoryAvailableException:
Second-level cache is used in the application, but property
hibernate.cache.region.factory_class is not given; please either
disable second level cache or set correct region factory using the
hibernate.cache.region.factory_class setting and make sure the second
level cache provider (hibernate-infinispan, e.g.) is available on the
classpath.
My assumption is that the correct profile for the test-database is not initialized: src/test/resources/application.yml
Any advice on setting this profile in STS?
Update
I have updated with some screen-shops per the https://jhipster.github.io/configuring-ide-eclipse-gradle/:
No Resource Filters Project Properties > Resource > Resource Filters (none were added by STS when I imported the project
Checked to make sure the build/generated/source/apt/main is added to my Java Build Path settings under Project Properties > Java Build Path
I had the same problem and this is how I got it working:
1. You need to initially run the test at least once as part of the gradle build task before you can then run it interactively with JUnit
2. JHipster generates the build.gradle file by default to only run tests that are named *UnitTest or *IntTest. If you have this default configuration, but have named your test differently, then step 1 above won't work because although the build may complete successfully it hasn't actually run your test and as a result it still can't be run in JUnit.
3. Follow the steps given in the screenshots that have been added above as an update to the original question.
Now trying running as JUnit Test.

BeanCreationException Vaadin

I'm trying to integrate Spring Boot Vaadin (https://github.com/peholmst/vaadin4spring) with Vaadin's Dashboard Demo Code (https://github.com/vaadin/dashboard-demo). The only thing modification I made was add the annotation "#VaadinUI" in the DashboardUI class. I checked in my code using the branch "integrate-vaadin-dashboard-demo-project".
I get the error message:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor': Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/validation/ParameterNameProvider.
I'm not really sure what the message means. Can somebody explain it and come up with a resolution to the error message?
Gist Error Output:
https://gist.github.com/anonymous/43d602c1105e00d4d7d6
Clone Url:
https://github.com/caritos/pangolin.git
Branch:
integrate-vaadin-dashboard-demo-project
You pack javax validation api 1.0 in your jar. This is the version the GWT compiler needs (when you build a widgetset). But spring-boot depends on version 1.1. Usually the problem is the other way around...

Unable to create editor ID org.eclipse.jst.pagedesigner.PageDesignerEditor: An unexpected exception was thrown

when i added JSF support to my project, following this tutorial
http://www.mkyong.com/jsf2/how-to-make-eclipse-ide-supports-jsf-2-0/
after restarting the eclipse, i am getting the error:
Unable to create editor ID org.eclipse.jst.pagedesigner.PageDesignerEditor: An unexpected exception was thrown.
any ideas why, and how to solve it ?
UPDATE:
when i tried to select java server faces again from the project facets, i found that it says on the right:
Conflicts with the following facets:
Application Client module
Dynamic Web Module
EAR
EJB Module
JCA Module
Static Web Module
Utility Module
Web Fragment Module
i was having JSF and ICEFaces dependencies in my pom, and i was having their libraries too in the classpath, fixed the error by removing them, and adding JSF,icefaces capabilities to my project, everything works fine now.