DispatcherServlet - Context initialization failed in Roo project - java

I develop a Roo project and deploy to a Tomcat 6 server.
Up until now everything was working fine.
I deleted and re-added an entity.
Now everytime when I start Tomcat I get this exception in the Spring Tool Suite:
SEVERE: StandardWrapper.Throwable
Throwable occurred: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping#0': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.handler.MappedInterceptor#0': Cannot create inner bean '(inner bean)' of type [org.springframework.web.servlet.handler.ConversionServiceExposingInterceptor] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': Cannot resolve reference to bean 'applicationConversionService' while setting constructor argument; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [myproject.web.ApplicationConversionServiceFactoryBean] for bean with name 'applicationConversionService' defined in ServletContext resource [/WEB-INF/spring/webmvc-config.xml]; nested exception is java.lang.ClassNotFoundException: myproject.web.ApplicationConversionServiceFactoryBean
Related cause: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [myproject.web.ApplicationConversionServiceFactoryBean] for bean with name 'applicationConversionService' defined in ServletContext resource [/WEB-INF/spring/webmvc-config.xml]; nested exception is java.lang.ClassNotFoundException: myproject.web.ApplicationConversionServiceFactoryBean
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
...
What do I need to do to make it work again?

spring is complainig about a bean not being available (probably the one you say you deleted).
exception is java.lang.ClassNotFoundException: myproject.web.ApplicationConversionServiceFactoryBean
try to search the config xml files & remove the reference made to this class, things should be back after that,

I had the same exact issue.
The problem was that I disabled the "Project > Build Automatically" feature, so I had to manually build the project.
Once I manually built the project everything went back to normal. :)
So, don't forget to build the project before deploying it, or just re-enable the "Project > Build Automatically" feature.
Hope it helps.

Your app deployed to Tomcat doesn't have a jar file in WEB-INF/lib that contains the class myproject.web.ApplicationConversionServiceFactoryBean. I don't know what that class is or where you'd find it, but it's missing.

my workaround (worked with eclipse and roo 1.1.5 as eclipse plugin)
open ApplicationConversionServiceFactoryBean.java class
delete class annotation #RooConversionService
wait for roo update
add back class annotation #RooConversionService
wait for roo update and try again

Inside of STS, click ->project->clean
It clean and discard all build problems and built states, The next time a build occurs the projects will be rebuilt from scratch.

Related

WebLogic 10.3.7 File Upload returns "Error creating bean with name 'portletMultipartResolver'"

I am using Spring Portlet mvc with file upload. When I was using WebLogic 10.3.0 it was working fine. I am migrating to WebLogic 10.3.7. Here with the same code I am getting below error:
javax.portlet.PortletException:
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'portletMultipartResolver' defined in
PortletContext resource Instantiation of bean failed; nested exception
is org.springframework.beans.BeanInstantiationException: Could not
instantiate bean class
[org.springframework.web.portlet.multipart.CommonsPortletMultipartResolver]:
Constructor threw exception; nested exception is
java.lang.NoClassDefFoundError: javax/portlet/ActionRequest
WebLogic server is not able to find ActionRequest.class. I have tried several options like placing jar file (netuix_common.jar) which contains ActionRequest.class inside the application war file but still it didn't work.
What can I try to resolve this?
java.lang.NoClassDefFoundError - you get this error when weblogic server finds this class in its classloader but not the one with the correct version.
you did the right thing by adding it to the application war file, you may want to add the flag of " prefer-web-inf-classes "
https://docs.oracle.com/cd/E23943_01/web.1111/e13712/weblogic_xml.htm#WBAPP601

Tomcat work directory empty

My Spring project was successfully deployed on another Linux server. But when I tried deploying it on this Linux server, it won't deploy. When I go to the homepage, I get the error "HTTP Status 404 - The requested resource is not available".
I compared the Tomcat directory of both servers and see only differences in the "work" directory. On this server (the one having problem), under "work\Catalina\localhost\MyProject" directory of Tomcat, I see that it's empty. Turns out that the files got put under "work\Catalina\localhost\_" instead. What's causing Tomcat to do this?
In my tomcat log file, I'm getting this:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'SampleService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.wdc.hydra.dao.DatatypeDAO com.wdc.hydra.service.DatatypeServiceImpl.datatypeDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'SampleDAO': Injection of persistence dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'Sample' defined in class path resource [Sample-dao-context.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: javax.persistence.spi.PersistenceUnitInfo.getValidationMode()Ljavax/persistence/ValidationMode;
Does anyone know why this is happening? Thanks.
How does the Spring Container defined? whether its by XmlWebApplicationContext / FileSystemXmlApplicationContext / ClasspathXmlApplicationContext and if its through FileSystemXmlApplicationContext then your directory structure in both the linux servers should be same. like wise others too.

Roo project import error in eclipse(sts)

I get an error when I want to import my project to sts(eclipse). I generate this project with spring roo and its work an other laptop so I just want to import and run on tomcat server somebody know what is this, I watch the dependecies and this class is there (I use Windows):
2012-10-16 23:32:42,540 [main] ERROR
org.springframework.web.context.ContextLoader - Context initialization
failed org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'transactionManager' defined in file
[D:\projects.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\roo-jquery-bootstrap\WEB-INF\classes\META-INF\spring\applicationContext.xml]:
Cannot resolve reference to bean 'entityManagerFactory' while setting
bean property 'entityManagerFactory'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'entityManagerFactory' defined in file
[D:\projects.metadata.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\roo-jquery-bootstrap\WEB-INF\classes\META-INF\spring\applicationContext.xml]:
Invocation of init method failed; nested exception is
java.lang.IllegalArgumentException: Cannot find class
[org.hibernate.ejb.HibernatePersistence] at
org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
at
... 41 more
I solved that it was an eclipse bug i restarted the eclipse and the application worked..

Why do I get this `TypeMismatchException` with Spring

I'm trying to use Hibernate with Spring in Eclipse. I get the following error when I try to run the welcome file on the server:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mySessionFactory' defined in ServletContext resource [/WEB-INF/dispatcher-servlet.xml]:
Initialization of bean failed; nested exception is
org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.util.ArrayList' to required type 'java.lang.Class[]' for property 'annotatedClasses';
nested exception is java.lang.IllegalArgumentException: Cannot find class [com.vaannila.domain.User]
The class com.vaannila.domain.User is in the Java Resources:src folder of the project in eclipse. Why isn't it being located?
From time to time Eclipse is a bit picky about deploying a project correctly. It seems that it has to do with the installed plugins. When this happens to me in the 'Servers'-view of the 'Debug'-Perspective i click the 'add and remove' menu and remove my project from deployment - save it - add it again and redeploy. Usually this does the trick.
Another try is to start Eclipse with the -clean option.

Why isn't eclipse compiling my web app?

When I start my Tomcat server, linked to my Java EE project, I get the error listed below. Two other people are using the same repository with Eclipse/Tomcat/Java and are not having any problems. It creates my package hierarchy, but the classes are missing. Tomcat develops my WEB-INF/classes/com folders, but the contents are all empty. Can anyone help me with this? Thank you.
SEVERE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping#0' defined in ServletContext resource [/WEB-INF/LightStanza-servlet.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.lightfoundryllc.lightstanza.login.LoginValidator] for bean with name 'loginValidator' defined in ServletContext resource [/WEB-INF/LightStanza-servlet.xml]; nested exception is java.lang.ClassNotFoundException: com.lightfoundryllc.lightstanza.login.LoginValidator
thanks for your help. I set my environment variables for TOMCAT_HOME and PATH and things seem to be working now :).

Categories