1

I'm trying to deploy a Spring Service in WSO2 Application Service. I did THIS tutorial and the app works fine on Eclipse, but when I try to deploy it on WSO2 I get this error:

Cannot load Spring beans. Please check the Spring context configuration file and verify that the defined Spring beans exist in the .jar file.

I unziped de .jar file and JdbcCustomerDAO class is there with all the others.

Spring context:

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">

    <bean id="customerDAO" class="com.mkyong.customer.dao.impl.JdbcCustomerDAO">
        <property name="dataSource" ref="dataSource" />
    </bean>
    <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="com.mysql.jdbc.Driver" />
        <property name="url" value="url" />
        <property name="username" value="username" />
        <property name="password" value="password" />
    </bean>     
</beans>

I also tried to include spring and mysql-connector-java jars on /repository/components/extensions as says HERE.


EDIT:

ERROR {org.wso2.carbon.springservices.ui.SpringServiceMaker} - Cannot load Spring beans. Please check the Spring context configuration file and verify that the defined Spring beans exist in the .jar file. {org.wso2.carbon.springservices.ui.SpringServiceMaker} org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.jdbc.datasource.DriverManagerDataSource] for bean with name 'dataSource' defined in resource loaded through InputStream; nested exception is java.lang.ClassNotFoundException: org.springframework.jdbc.datasource.DriverManagerDataSource

Looks like it couldn't find spring-jdbc, so I added the jar to extensions but now I get this error:

ERROR {org.wso2.carbon.springservices.ui.SpringServiceMaker} - Cannot load Spring beans. Please check the Spring context configuration file and verify that the defined Spring beans exist in the .jar file. {org.wso2.carbon.springservices.ui.SpringServiceMaker} org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in resource loaded through InputStream: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.jdbc.datasource.DriverManagerDataSource]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory

I understand that commons.logging is also missing, but when I try to add it to extensions, WSO2 doesn't start. I get a lot of

Log4j:ERROR Could not instantiate...

Community
  • 1
  • 1
Carlos Rivero
  • 342
  • 2
  • 17

0 Answers0