1

Im having some troubles setting my project to work. Im using Spring, and in the name of my project im seeing a big red "!", and in my root-context im seeing some errors:

<bean id="userDao" class="com.goatsoft.appark.dao.UserDaoImpl">
    <property name="dataSource" ref="dataSource" /> //error in this line
</bean>

The error says "No setter found for property 'dataSource' in class 'com.goatsoft.appark.dao.UserDaoImpl'". That class extends JdbcDaoSupport, so it should have a dataSource for free, if im not in a mistake.

This is the dataSource bean definition:

<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="com.mysql.jdbc.Driver" /> 
    <property name="url" value="jdbc:mysql://localhost:3306/myDB" /> 
    <property name="username" value="user" /> 
    <property name="password" value="password" /> 
</bean>

When I run the app, im receiving this report:

jul 24, 2014 6:46:58 PM com.springsource.tcserver.security.PropertyDecoder <init>
Información: tc Runtime property decoder using memory-based key
jul 24, 2014 6:46:58 PM com.springsource.tcserver.security.PropertyDecoder <init>
Información: tcServer Runtime property decoder has been initialized in 236 ms
jul 24, 2014 6:46:59 PM org.apache.coyote.AbstractProtocol init
Información: Initializing ProtocolHandler ["http-bio-8080"]
jul 24, 2014 6:46:59 PM com.springsource.tcserver.serviceability.rmi.JmxSocketListener init
Información: Started up JMX registry on 127.0.0.1:6969 in 127 ms
jul 24, 2014 6:46:59 PM org.apache.catalina.startup.Catalina load
Información: Initialization processed in 861 ms
jul 24, 2014 6:46:59 PM org.apache.catalina.core.StandardService startInternal
Información: Arrancando servicio Catalina
jul 24, 2014 6:46:59 PM org.apache.catalina.core.StandardEngine startInternal
Información: Starting Servlet Engine: VMware vFabric tc Runtime 2.9.2.RELEASE/7.0.39.B.RELEASE
jul 24, 2014 6:46:59 PM org.apache.catalina.startup.HostConfig deployDescriptor
Información: Desplieque del descriptor de configuración D:\Desarrollo\STS\vfabric-tc-server-developer-2.9.2.RELEASE\base-instance\conf\Catalina\localhost\appark.xml
jul 24, 2014 6:46:59 PM org.apache.catalina.startup.SetContextPropertiesRule begin
Advertencia: [SetContextPropertiesRule]{Context} Setting property 'source' to 'org.eclipse.jst.jee.server:AppArk' did not find a matching property.
jul 24, 2014 6:47:00 PM org.apache.catalina.core.ApplicationContext log
Información: No Spring WebApplicationInitializer types detected on classpath
jul 24, 2014 6:47:00 PM org.apache.catalina.core.ApplicationContext log
Información: Initializing Spring root WebApplicationContext
INFO : org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization started
INFO : org.springframework.web.context.support.XmlWebApplicationContext - Refreshing Root WebApplicationContext: startup date [Thu Jul 24 18:47:00 CEST 2014]; root of context hierarchy
INFO : org.springframework.beans.factory.xml.XmlBeanDefinitionReader - Loading XML bean definitions from ServletContext resource [/WEB-INF/spring/root-context.xml]
INFO : org.springframework.beans.factory.support.DefaultListableBeanFactory - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@539bd2fe: defining beans [dataSource,jdbcTemplate,userDao,vehiculoDao,aparcamientoDao,parkService,userService,vehiculoService,/home,generalService]; root of factory hierarchy
INFO : org.springframework.beans.factory.support.DefaultListableBeanFactory - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@539bd2fe: defining beans [dataSource,jdbcTemplate,userDao,vehiculoDao,aparcamientoDao,parkService,userService,vehiculoService,/home,generalService]; root of factory hierarchy
ERROR: org.springframework.web.context.ContextLoader - Context initialization failed
org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.goatsoft.appark.dao.UserDaoImpl] for bean with name 'userDao' defined in ServletContext resource [/WEB-INF/spring/root-context.xml]; nested exception is java.lang.ClassNotFoundException: com.goatsoft.appark.dao.UserDaoImpl
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1262)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:576)
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1331)
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:897)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:566)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
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.deployDescriptor(HostConfig.java:657)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1637)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
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:744)
Caused by: java.lang.ClassNotFoundException: com.goatsoft.appark.dao.UserDaoImpl
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1713)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1558)
at org.springframework.util.ClassUtils.forName(ClassUtils.java:258)
at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:417)
at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1283)
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1254)
... 22 more
jul 24, 2014 6:47:00 PM org.apache.catalina.core.StandardContext listenerStart
Grave: Excepción enviando evento inicializado de contexto a instancia de escuchador de clase org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.goatsoft.appark.dao.UserDaoImpl] for bean with name 'userDao' defined in ServletContext resource [/WEB-INF/spring/root-context.xml]; nested exception is java.lang.ClassNotFoundException: com.goatsoft.appark.dao.UserDaoImpl
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1262)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:576)
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1331)
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:897)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:566)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:385)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:284)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
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.deployDescriptor(HostConfig.java:657)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1637)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
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:744)
Caused by: java.lang.ClassNotFoundException: com.goatsoft.appark.dao.UserDaoImpl
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1713)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1558)
at org.springframework.util.ClassUtils.forName(ClassUtils.java:258)
at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:417)
at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1283)
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1254)
... 22 more

jul 24, 2014 6:47:00 PM org.apache.catalina.core.StandardContext startInternal
Grave: Error listenerStart
jul 24, 2014 6:47:00 PM org.apache.catalina.core.StandardContext startInternal
Grave: Falló en arranque del Contexto [/appark] debido a errores previos
jul 24, 2014 6:47:00 PM org.apache.catalina.core.ApplicationContext log
Información: Closing Spring root WebApplicationContext
jul 24, 2014 6:47:00 PM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
Grave: La aplicación web [/appark] registró el conductor JDBC [com.mysql.jdbc.Driver] pero falló al anular el registro mientras la aplicación web estaba parada. Para prevenir un fallo de memoria, se ha anulado el registro del conductor JDBC por la fuerza.
jul 24, 2014 6:47:00 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
Grave: La aplicación web [/appark] parece haber arrancado un hilo llamado [Abandoned connection cleanup thread] pero no ha podido pararlo. Esto tiene todas las papeletas de convertirse en un fallo de memoria.
jul 24, 2014 6:47:00 PM org.apache.catalina.startup.HostConfig deployDescriptor
Información: Desplieque del descriptor de configuración D:\Desarrollo\STS\vfabric-tc-server-developer-2.9.2.RELEASE\base-instance\conf\Catalina\localhost\proyecto.xml
jul 24, 2014 6:47:00 PM org.apache.catalina.startup.SetContextPropertiesRule begin
Advertencia: [SetContextPropertiesRule]{Context} Setting property 'source' to 'org.eclipse.jst.jee.server:Helpin' did not find a matching property.
jul 24, 2014 6:47:00 PM org.apache.catalina.startup.HostConfig deployDirectory
Información: Despliegue del directorio D:\Desarrollo\STS\vfabric-tc-server-developer-2.9.2.RELEASE\base-instance\webapps\manager de la aplicación web
jul 24, 2014 6:47:00 PM org.apache.catalina.startup.HostConfig deployDirectory
Información: Despliegue del directorio D:\Desarrollo\STS\vfabric-tc-server-developer-2.9.2.RELEASE\base-instance\webapps\ROOT de la aplicación web
jul 24, 2014 6:47:01 PM org.apache.coyote.AbstractProtocol start
Información: Starting ProtocolHandler ["http-bio-8080"]
jul 24, 2014 6:47:01 PM org.apache.catalina.startup.Catalina start
Información: Server startup in 1860 ms

I did a search and found this question, but I did the suggested solutions and didn't worked.

I am using Maven, this is my pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.goatsoft</groupId>
<artifactId>appark</artifactId>
<name>AppArk</name>
<packaging>war</packaging>
<version>1.0.0-BUILD-SNAPSHOT</version>
<properties>
    <java-version>1.6</java-version>
    <org.springframework-version>3.1.1.RELEASE</org.springframework-version>
    <org.aspectj-version>1.6.10</org.aspectj-version>
    <org.slf4j-version>1.6.6</org.slf4j-version>
</properties>
<dependencies>

<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.26</version>
</dependency>
        <!-- Spring -->
<dependency>
         <groupId>org.springframework</groupId>
         <artifactId>spring-context</artifactId>
         <version>${org.springframework-version}</version>
         <exclusions>
             <!-- Exclude Commons Logging in favor of SLF4j -->
             <exclusion>
                 <groupId>commons-logging</groupId>
                 <artifactId>commons-logging</artifactId>
              </exclusion>
        </exclusions>
    </dependency>

    <dependency>
     <groupId>org.springframework</groupId>
    <artifactId>spring-web</artifactId>
     <version>${org.springframework-version}</version>
 </dependency>
     <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>${org.springframework-version}</version>
    </dependency>

    <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${org.springframework-version}</version>
</dependency>

<dependency>
 <groupId>org.springframework</groupId>
 <artifactId>spring-jdbc</artifactId>
<version>${org.springframework-version}</version>
</dependency>

    <!-- AspectJ -->
    <dependency>
        <groupId>org.aspectj</groupId>
        <artifactId>aspectjrt</artifactId>
        <version>${org.aspectj-version}</version>
    </dependency>   

    <!-- Logging -->
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>${org.slf4j-version}</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>jcl-over-slf4j</artifactId>
        <version>${org.slf4j-version}</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>${org.slf4j-version}</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.15</version>
        <exclusions>
            <exclusion>
                <groupId>javax.mail</groupId>
                <artifactId>mail</artifactId>
            </exclusion>
            <exclusion>
                <groupId>javax.jms</groupId>
                <artifactId>jms</artifactId>
            </exclusion>
            <exclusion>
                <groupId>com.sun.jdmk</groupId>
                <artifactId>jmxtools</artifactId>
            </exclusion>
            <exclusion>
                <groupId>com.sun.jmx</groupId>
                <artifactId>jmxri</artifactId>
            </exclusion>
        </exclusions>
        <scope>runtime</scope>
    </dependency>

    <!-- @Inject -->
    <dependency>
        <groupId>javax.inject</groupId>
        <artifactId>javax.inject</artifactId>
        <version>1</version>
    </dependency>

    <!-- Servlet -->
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet.jsp</groupId>
        <artifactId>jsp-api</artifactId>
        <version>2.1</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
    </dependency>

    <!-- Test -->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.7</version>
        <scope>test</scope>
    </dependency>  

    <!-- Jackson -->   
    <dependency>
        <groupId>org.codehaus.jackson</groupId>
        <artifactId>jackson-core-asl</artifactId>
        <version>1.9.13</version>
    </dependency>

    <dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.13</version>
</dependency>   
</dependencies>
<build>
    <plugins>
        <plugin>
            <artifactId>maven-eclipse-plugin</artifactId>
            <version>2.9</version>
            <configuration>
                <additionalProjectnatures>
                    <projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
                </additionalProjectnatures>
                <additionalBuildcommands>
                    <buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
                </additionalBuildcommands>
                <downloadSources>true</downloadSources>
                <downloadJavadocs>true</downloadJavadocs>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.5.1</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
                <compilerArgument>-Xlint:all</compilerArgument>
                <showWarnings>true</showWarnings>
                <showDeprecation>true</showDeprecation>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.2.1</version>
            <configuration>
                <mainClass>org.test.int1.Main</mainClass>
            </configuration>
        </plugin>
    </plugins>
</build>

It looks like something is wrong with the jars... but I am not able to find the error.

Any help will be appreciatted. Thank you.

Community
  • 1
  • 1
Fustigador
  • 6,339
  • 12
  • 59
  • 115
  • 1
    For starters stop mixing different versions. You are mixing 3.1.1, 3.0.5 and 3.2.4, don't expect those to be compatible. Next your own classes appear not to be included in your application. – M. Deinum Jul 24 '14 at 17:31
  • My classes are in my application, i didn't put it here because I don think it necesary, but I assure you my classes are included. I changed 3.0.5 Spring-web for 3.2.4 spring-web in the pom, and it is still not working. Should I use 3.1.1 instead? – Fustigador Jul 24 '14 at 17:49
  • I am using ${org.springframework-version} in the tag, and it still does not work – Fustigador Jul 24 '14 at 17:55
  • I assure you that your classes aren't included as that is what is missing. `java.lang.ClassNotFoundException: com.goatsoft.appark.dao.UserDaoImpl` quite clearly indicates that this class isn't there… – M. Deinum Jul 24 '14 at 18:07
  • http://imgur.com/tLpkLh1 that is my project. The classes ARE where must be. The errors are in the lines where the dataBase is declared, as you can see up there in my question. – Fustigador Jul 24 '14 at 18:15
  • The fact that they are where they are in your project doesn't mean that they are on the server. The exception you get clearly indicates that. Try cleaning the server and republish everything or even remove it and add it again. – M. Deinum Jul 24 '14 at 18:17
  • But if I deploy the project in the server, how that classes are not in the server? What can I do to fix this? I created a new workspace, imported my project again, and nothing. I've cleaned a lot of times. – Fustigador Jul 24 '14 at 18:20
  • Its pretty weird... the errors, in the root-context, says "No setter found for property 'dataSource' in class 'com.goatsoft.appark.dao.UserDaoImpl'"...but after deployment, it says that class it is not found... how can it say the setter is not there...if the class is not there? – Fustigador Jul 24 '14 at 18:23
  • I've ended up creating a new project...creating the packages again, whith a little modification of the name...copy-paste the classes, change the imports to reflect the change in the name of the package...and it works now. – Fustigador Jul 24 '14 at 18:56

0 Answers0