Application results in these exception:
[2016-10-20 09:57:08,536] Artifact SpringWebLibery:war exploded: Artifact is being deployed, please wait...
[2016-10-20 09:57:39,642] Artifact SpringWebLibery:war exploded: Error during artifact deployment. See server log for details.
[2016-10-20 09:57:39,643] Artifact SpringWebLibery:war exploded: java.io.IOException: com.sun.enterprise.admin.remote.RemoteFailureException: Error occurred during deployment: Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.java.spring.libery.classes.BookSearchImol] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}. Please see server.log for more details.
[2016-10-20T21:57:37.651+0300] [glassfish 4.0] [SEVERE] [NCLS-CORE-00026] [javax.enterprise.system.core] [tid: _ThreadID=39 _ThreadName=admin-listener(5)] [timeMillis: 1476989857651] [levelValue: 1000] [[
Exception during lifecycle processing
java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.java.spring.libery.classes.BookSearchImol] : expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
at com.sun.enterprise.web.WebApplication.start(WebApplication.java:168)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:122)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:291)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:352)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:497)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:527)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:523)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:522)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:546)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1423)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1500(CommandRunnerImpl.java:108)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1762)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1674)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
at org.glassfish.grizzly.http.server.StaticHttpHandler.service(StaticHttpHandler.java:297)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:246)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
at java.lang.Thread.run(Thread.java:745)
]]
[2016-10-20T21:57:37.652+0300] [glassfish 4.0] [SEVERE] [] [javax.enterprise.system.core] [tid: _ThreadID=39 _ThreadName=admin-listener(5)] [timeMillis: 1476989857652] [levelValue: 1000] [[
Exception while loading the app]]
[2016-10-20T21:57:37.652+0300] [glassfish 4.0] [SEVERE] [AS-WEB-GLUE-00192] [javax.enterprise.web] [tid: _ThreadID=39 _ThreadName=admin-listener(5)] [timeMillis: 1476989857652] [levelValue: 1000] [[
Undeployment failed for context /SpringWebLibery_war_exploded]]
[2016-10-20T21:57:37.654+0300] [glassfish 4.0] [SEVERE] [] [javax.enterprise.web.util] [tid: _ThreadID=39 _ThreadName=admin-listener(5)] [timeMillis: 1476989857654] [levelValue: 1000] [[
The web application [/SpringWebLibery_war_exploded] created a ThreadLocal with key of type [org.apache.log4j.helpers.ThreadLocalMap] (value [org.apache.log4j.helpers.ThreadLocalMap@78832b97]) and a value of type [java.util.Hashtable] (value [{}]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.]]
[2016-10-20T21:57:39.623+0300] [glassfish 4.0] [SEVERE] [] [javax.enterprise.system.core] [tid: _ThreadID=39 _ThreadName=admin-listener(5)] [timeMillis: 1476989859623] [levelValue: 1000] [[
Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.java.spring.libery.classes.BookSearchImol] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}]]
Here's the relevant code: dispatcher servlet
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd ">
<import resource="webflow-config.xml"/>
<context:component-scan base-package="com.java.spring.libery"/>
<mvc:resources mapping="/resources/**" location="/resources/"/>
<bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping">
<property name="flowRegistry" ref="flowRegistry"/>
<property name="order" value="2"></property>
</bean>
<bean class="org.springframework.faces.webflow.JsfFlowHandlerAdapter">
<property name="flowExecutor" ref="flowExecutor"/>
</bean>
<bean id="msg" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basename" value="/WEB-INF/locales/messages" />
<property name="defaultEncoding" value="UTF-8" />
</bean>
<bean name="resourceHandlerJsf" class="org.springframework.faces.webflow.JsfResourceRequestHandler"></bean>
<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="order" value="1"></property>
<property name="mappings">
<value>
/javax.faces.resource/**=resourceHandlerJsf
</value>
</property>
</bean>
<bean id="localeResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver">
<property name="defaultLocale" value="ru"/>
</bean>
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="jdbc/_libery"/>
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="configLocation" value="classpath:hibernate.cfg.xml" />
</bean>
<tx:annotation-driven />
<bean id="transactionManager"
class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<mvc:interceptors>
<mvc:interceptor>
<mvc:mapping path="/**"/>
<bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
<property name="paramName" value="lang"></property>
</bean>
</mvc:interceptor>
</mvc:interceptors>
<bean class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass" value="org.springframework.faces.mvc.JsfView"/>
<property name="prefix" value="/WEB-INF/views/"/>
<property name="suffix" value=".xhtml"/>
</bean>
</beans>
BookSearchImpl package com.java.spring.libery.classes;
@Repository
public class BookSearchImpl implements BookSearch {
ProjectionList bookProjection;
public BookSearchImol(){
bookProjection= Projections.projectionList();
bookProjection.add(Projections.property("id"),"id");
bookProjection.add(Projections.property("name"),"name");
bookProjection.add(Projections.property("pageCount"),"pageCount");
bookProjection.add(Projections.property("publishYear"),"publishYear");
bookProjection.add(Projections.property("publisherId"),"publisherId");
bookProjection.add(Projections.property("genreId"),"genreId");
bookProjection.add(Projections.property("isbn"),"isbn");
bookProjection.add(Projections.property("description"),"description");
bookProjection.add(Projections.property("rating"),"rating");
bookProjection.add(Projections.property("voteCount"),"voteCount");
bookProjection.add(Projections.property("image"),"image");
bookProjection.add(Projections.property("authoId"),"authoId");
}
@Autowired
SessionFactory sessionFactory;
List <Book>books;
@Transactional
public List<Book> showBooks() {
books=createBookList(createBookCriteria());
return books;
}
@Transactional
public List<Book> showBooks(Author author) {
books=createBookList(createBookCriteria().add(Restrictions.ilike("author.second_name",author.getSecondName(),MatchMode.ANYWHERE)));
return books;
}
@Transactional
public List<Book> showBooks(String bookName) {
books=createBookList(createBookCriteria().add(Restrictions.ilike("b.name",bookName,MatchMode.ANYWHERE)));
return books;
}
@Transactional
public List<Book> showBooks(Character firstLater) {
books=createBookList(createBookCriteria().add(Restrictions.ilike("b.name",firstLater.toString(),MatchMode.START)));
return books;
}
public DetachedCriteria createBookCriteria (){
DetachedCriteria bookListCriteria=DetachedCriteria.forClass(Book.class,"b");
createAliases(bookListCriteria);
return bookListCriteria;
}
public void createAliases(DetachedCriteria criteria){
criteria.createAlias("b.authoId","authoId");
criteria.createAlias("b.publisherId","publisherId");
criteria.createAlias("b.genreId","genreId");
}
private List<Book>createBookList(DetachedCriteria bookListCriteria){
Criteria criteria=bookListCriteria.getExecutableCriteria(sessionFactory.getCurrentSession());
criteria.addOrder(Order.asc("b.name")).setProjection(bookProjection).setResultTransformer(Transformers.aliasToBean(Book.class));
return criteria.list();
}
}
LibraryFacade
package com.java.spring.libery.objects;
@Component
public class LibraryFacade {
private BookSearchImpl bookSearchImpl;
private List<Book> books;
@Autowired
public void setBookDAO(BookSearchImpl bookSearchImpl){
this.bookSearchImpl=bookSearchImpl;
books=bookSearchImpl.showBooks();
}
public List<Book>getBooks(){
return books;
}
}
the folders under component-scan and have necessary annotations so i can't understand why it doesn't work.