프로젝트를 실행시키려고 했는데, 생성된 QueryDSL용 Q도메인(@Entity 애노테이션이 사용된 도메인 객체를 QueryDSL에서 변형가공)을 인식하지 못하는 문제가 발생했다. 이클립스에서는 별다른 문제없이 잘 되는 녀석이 인텔리제이에서는 Q도메인들을 찾지 못하는 문제를 뱉어낸 것이다. 그래서 인텔리제이에서 생성한 서버에서 사용하는 디렉토리를 확인했다. 서버에 배포된 클래스의 상태를 보니 Q도메인들이 빠져있어서 그렇다는 것을 확인했다.
8월 14, 2013 9:29:34 오전 org.apache.catalina.core.ApplicationContext log
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'companyServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private net.slipp.rest.repository.CompanyRepository net.slipp.rest.service.impl.CompanyServiceImpl.companyRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'companyRepositoryImpl' defined in file [/workspace/git-repository/rest-api-study/bin/WEB-INF/classes/net/slipp/rest/repository/CompanyRepositoryImpl.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [net.slipp.rest.repository.CompanyRepositoryImpl]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: Did not find a query class net.slipp.rest.domain.QCompany for domain class net.slipp.rest.domain.Company!
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:288)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1122)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:522)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:626)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
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.addChildInternal(ContainerBase.java:901)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1552)
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:606)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:622)
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:569)
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:606)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1487)
at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:97)
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1328)
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1420)
at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:848)
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:606)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)
at sun.rmi.transport.Transport$1.run(Transport.java:177)
at sun.rmi.transport.Transport$1.run(Transport.java:174)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:553)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:808)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:667)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private net.slipp.rest.repository.CompanyRepository net.slipp.rest.service.impl.CompanyServiceImpl.companyRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'companyRepositoryImpl' defined in file [/workspace/git-repository/rest-api-study/bin/WEB-INF/classes/net/slipp/rest/repository/CompanyRepositoryImpl.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [net.slipp.rest.repository.CompanyRepositoryImpl]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: Did not find a query class net.slipp.rest.domain.QCompany for domain class net.slipp.rest.domain.Company!
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:514)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:285)
... 56 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'companyRepositoryImpl' defined in file [/workspace/git-repository/rest-api-study/bin/WEB-INF/classes/net/slipp/rest/repository/CompanyRepositoryImpl.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [net.slipp.rest.repository.CompanyRepositoryImpl]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: Did not find a query class net.slipp.rest.domain.QCompany for domain class net.slipp.rest.domain.Company!
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1013)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:959)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:490)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:285)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:910)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:853)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:768)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:486)
... 58 more
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [net.slipp.rest.repository.CompanyRepositoryImpl]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: Did not find a query class net.slipp.rest.domain.QCompany for domain class net.slipp.rest.domain.Company!
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:163)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1006)
... 71 more
Caused by: java.lang.IllegalArgumentException: Did not find a query class net.slipp.rest.domain.QCompany for domain class net.slipp.rest.domain.Company!
at org.springframework.data.querydsl.SimpleEntityPathResolver.createPath(SimpleEntityPathResolver.java:63)
at net.slipp.rest.repository.querypredicate.AbstractJPAQueryPredicateExecutor.<init>(AbstractJPAQueryPredicateExecutor.java:47)
at net.slipp.rest.repository.CompanyRepositoryImpl.<init>(CompanyRepositoryImpl.java:12)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:148)
... 73 more
Caused by: java.lang.ClassNotFoundException: net.slipp.rest.domain.QCompany
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
at org.springframework.util.ClassUtils.forName(ClassUtils.java:260)
at org.springframework.data.querydsl.SimpleEntityPathResolver.createPath(SimpleEntityPathResolver.java:53)
... 80 more
8월 14, 2013 9:29:37 오전 org.apache.catalina.core.ApplicationContext log
인터넷을 통해 어떻게 처리해야할까 하고 잠시 검색한다.
그러다가 찾았다.
Unable to use Intellij with a generated sources folder :
http://stackoverflow.com/questions/5170620/unable-to-use-intellij-with-a-generated-sources-folder
해결방법 |
1. [File] -> [Project structure] -> [Module] -> [Sources] 탭으로 이동
2. (오른쪽 창에 있는) QueryDSL 소스디렉토리 선택
3. 마우스 우클릭
4. [Source] 선택
Source로 선택된 디렉토리는 파란색으로 변경되고, 왼쪽에 등록된다.
이걸 어제 찾아놓고 바로 확인 안하고 이제서야 확인을 했군요. Orz..
'Java > Tools' 카테고리의 다른 글
Aspect Logger, 소스코드에 일일이 Logger를 찍기 귀찮을 때... (0) | 2014.01.10 |
---|---|
[IntelliJ] 컴파일compile에 이상동작을 보일 때 (0) | 2013.10.15 |
Intellij에서 Eclipse의 Auto publishing 기능 사용하기 (2) | 2013.07.17 |
ssh_exchange_identification: Connection closed by remote hos (0) | 2013.05.22 |
STS(Eclipse) 를 버릴 때가 되었나? (0) | 2013.03.19 |