2013-01-12 118 views
2

我想弄清楚這個錯誤Could not load JDBC driver class [oracle.jdbc.OracleDriver]很長一段時間。我知道我在類路徑中缺少ojdbc14.jar文件。我是mule studio的新手,嘗試實現一個非常簡單的mule -spring-hibernate示例。獲取錯誤無法加載Mule Studio中的JDBC驅動程序類[oracle.jdbc.OracleDriver]

但是,我將如何將這個jar文件添加到mule-maven項目中?

我試着在POM.xml中添加ojdbc14.jar文件,但在這種情況下,maven構建失敗,我得到類似這樣的錯誤[http://stackoverflow.com/questions/9007009/is-there-an -iss-with-oracle-dependency] 注意我已經在m2 repo中添加了ojdbc14.jar文件。

這是我的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>pos_mule</groupId> 
    <artifactId>pos_mule</artifactId> 
    <packaging>mule</packaging> 
    <version>1.0.0-SNAPSHOT</version> 

    <properties> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
     <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> 

     <mule.version>3.3.0</mule.version> 
     <eclipsePluginVersion>2.8</eclipsePluginVersion> 
     <jdkName>JavaSE-1.6</jdkName> 
     <jdk.version>1.6</jdk.version> 
     <junit.version>4.9</junit.version> 
    </properties> 

    <build> 
     <!-- Use a newer version of the install plugin than what your Maven uses 
      by default. The older version failed to install the project if there was 
      no target/classes folder. Since we use mule packaging on the project we actually 
      create and attach the zip that must be installed. --> 
     <pluginManagement> 
      <plugins> 
       <plugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-install-plugin</artifactId> 
        <version>2.3.1</version> 
       </plugin> 
       <!--This plugin's configuration is used to store Eclipse m2e settings 
        only. It has no influence on the Maven build itself. --> 
       <plugin> 
        <groupId>org.eclipse.m2e</groupId> 
        <artifactId>lifecycle-mapping</artifactId> 
        <version>1.0.0</version> 
        <configuration> 
         <lifecycleMappingMetadata> 
          <pluginExecutions> 
           <pluginExecution> 
            <pluginExecutionFilter> 
             <groupId>org.mule.tools</groupId> 
             <artifactId>maven-mule-plugin</artifactId> 
             <versionRange>[1.6,)</versionRange> 
             <goals> 
              <goal>attach-test-resources</goal> 
              <goal>filter-resources  </goal> 
             </goals> 
            </pluginExecutionFilter> 
            <action> 
             <ignore></ignore> 
            </action> 
           </pluginExecution> 
          </pluginExecutions> 
         </lifecycleMappingMetadata> 
        </configuration> 
       </plugin> 
      </plugins> 
     </pluginManagement> 
     <plugins> 
      <plugin> 
       <groupId>org.mule.tools</groupId> 
       <artifactId>maven-mule-plugin</artifactId> 
       <version>1.7</version> 
       <extensions>true</extensions> 
       <configuration> 
        <copyToAppsDirectory>true</copyToAppsDirectory> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>2.3.2</version> 
       <configuration> 
        <source>${jdk.version}</source> 
        <target>${jdk.version}</target> 
        <encoding>ISO-8859-1</encoding> 
       </configuration> 
      </plugin> 
      <plugin> 
       <artifactId>maven-assembly-plugin</artifactId> 
       <version>2.2.1</version> 
       <configuration> 
        <descriptorRefs> 
         <descriptorRef>project</descriptorRef> 
        </descriptorRefs> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-eclipse-plugin</artifactId> 
       <version>${eclipsePluginVersion}</version> 
       <configuration> 
        <!-- by default download all sources when generating project files --> 
        <downloadSources>true</downloadSources> 
       </configuration> 
      </plugin> 

      <plugin> 
       <groupId>org.codehaus.mojo</groupId> 
       <artifactId>exec-maven-plugin</artifactId> 
       <version>1.2.1</version> 
       <executions> 
        <execution> 
        <goals> 
         <goal>java</goal> 
        </goals> 
        </execution> 
       </executions> 
       <configuration> 
        <mainClass>org.mule.MuleServer</mainClass> 
        <arguments> 
        <argument>-config</argument> 
        <argument>src/main/app/mule-config.xml</argument> 
        </arguments> 
       <classpathScope>compile</classpathScope> 
       </configuration> 
       </plugin> 
     </plugins> 
    </build> 

    <!-- plugins for creating site reports --> 
    <reporting> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-surefire-report-plugin</artifactId> 
       <version>2.4.2</version> 
      </plugin> 

      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-checkstyle-plugin</artifactId> 
       <version>2.5</version> 
       <configuration> 
        <configLocation>http://mulesoft.org/download/attachments/92/checkstyle.xml?version=1</configLocation> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-pmd-plugin</artifactId> 
       <version>2.5</version> 
       <configuration> 
        <targetJdk>${jdk.version}</targetJdk> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.codehaus.mojo</groupId> 
       <artifactId>cobertura-maven-plugin</artifactId> 
       <version>2.5</version> 
      </plugin> 
      <plugin> 
       <groupId>org.codehaus.mojo</groupId> 
       <artifactId>taglist-maven-plugin</artifactId> 
       <version>2.4</version> 
       <configuration> 
        <tags> 
         <tag>TODO</tag> 
         <tag>@todo</tag> 
         <tag>FIXME</tag> 
         <tag>@fixme</tag> 
         <tag>@deprecated</tag> 
        </tags> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-jxr-plugin</artifactId> 
       <version>2.2</version> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-javadoc-plugin</artifactId> 
       <version>2.7</version> 
       <configuration> 
        <source>${jdk.version}</source> 
        <links> 
         <link>http://java.sun.com/j2ee/1.4/docs/api</link> 
         <link>http://java.sun.com/j2se/1.4.2/docs/api</link> 
         <link>http://java.sun.com/j2se/1.5.0/docs/api</link> 
        </links> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.codehaus.mojo</groupId> 
       <artifactId>jdepend-maven-plugin</artifactId> 
       <version>2.0-beta-2</version> 
      </plugin> 
      <plugin> 
       <groupId>org.codehaus.mojo</groupId> 
       <artifactId>findbugs-maven-plugin</artifactId> 
       <version>2.3.2</version> 
      </plugin> 
     </plugins> 
    </reporting> 

    <!-- Mule Dependencies --> 
     <dependencies> 
    <dependency> 
     <groupId>org.mule</groupId> 
     <artifactId>mule-core</artifactId> 
     <version>3.4-M1</version> 
    </dependency> 
    <dependency> 
     <groupId>pos_core</groupId> 
     <artifactId>pos_core</artifactId> 
     <version>0.0.1-SNAPSHOT</version> 
    </dependency> 
    <dependency> 
     <groupId>pos_persistent</groupId> 
     <artifactId>pos_persistent</artifactId> 
     <version>0.0.1-SNAPSHOT</version> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-core</artifactId> 
     <version>3.2.0.RELEASE</version> 
    </dependency> 
    <dependency> 
     <groupId>org.hibernate</groupId> 
     <artifactId>hibernate-core</artifactId> 
     <version>3.3.2.GA</version> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-orm</artifactId> 
     <version>3.2.0.RELEASE</version> 
    </dependency> 
    <dependency> 
     <groupId>org.springframework</groupId> 
     <artifactId>spring-beans</artifactId> 
     <version>3.2.0.RELEASE</version> 
    </dependency> 
<dependency> 
     <groupId>com.oracle</groupId> 
     <artifactId>ojdbc14</artifactId> 
     <version>10.2.0.4.0</version> 
    </dependency> 

     </dependencies> 

    <repositories> 
     <repository> 
      <id>jboss</id> 
      <name>JBoss</name> 
      <url>http://repository.jboss.com/</url> 
     </repository> 
     <repository> 
      <id>mulesoft-releases</id> 
      <name>MuleSoft Releases</name> 
      <url>http://repository.mulesoft.org/releases/</url> 
     </repository> 
     <repository> 
      <id>oss-sonatype-snapshots</id> 
      <url>https://oss.sonatype.org/content/repositories/snapshots/</url> 
     </repository> 
     <repository> 
      <id>codehaus-snaphosts</id> 
      <name>Codehaus Snapshots</name> 
      <url>http://snapshots.repository.codehaus.org/</url> 
     </repository> 
     <repository> 
      <id>codehaus-releases</id> 
      <name>CodeHaus Releases</name> 
      <url>http://repository.codehaus.org/</url> 
     </repository> 

    </repositories> 

</project> 

這是我pos_mule.mflow

<?xml version="1.0" encoding="UTF-8"?> 

<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" version="CE-3.3.0" 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-current.xsd 
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd "> 

<spring:beans> 
<spring:import resource="classpath:spring-mule.xml"/> 
</spring:beans> 

</mule> 

這是我的春天mule.xml

<?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:aop="http://www.springframework.org/schema/aop" 
    xmlns:context="http://www.springframework.org/schema/context" 
    xmlns:jee="http://www.springframework.org/schema/jee" 
    xmlns:lang="http://www.springframework.org/schema/lang" 
    xmlns:p="http://www.springframework.org/schema/p" 
    .." > 
     <bean id="datasource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> 
<property name="driverClassName" value="oracle.jdbc.OracleDriver" /> 
<property name="url" value="jdbc:oracle:thin:@localhost:1521:xe" /> 
<property name="username" value="dfdfdff" /> 
<property name="password" value="dfdfdff" /> 
</bean> 

    <bean id="sessionFactory" 
     class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> 
     <property name="dataSource" ref="datasource" /> 
     <property name="configLocation"> 
      <value>classpath:hibernate.cfg.xml</value> 
     </property> 
     <property name="configurationClass"> 
      <value>org.hibernate.cfg.AnnotationConfiguration</value> 
     </property> 
     <property name="hibernateProperties"> 
      <props> 
       <prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop> 
       <prop key="hibernate.show_sql">true</prop> 
       <prop key="cache.provider_class">org.hibernate.cache.NoCacheProvider</prop> 
       <prop key="hibernate.connection.release_mode">auto</prop> 
      </props> 
     </property> 
    </bean> 

    <tx:annotation-driven /> 
    <bean id="transactionManager" 
     class="org.springframework.orm.hibernate3.HibernateTransactionManager"> 
     <property name="sessionFactory" ref="sessionFactory" /> 
    </bean> 
</beans> 

當我刪除以下依賴,然後Maven構建執行正常。

<dependency> 
      <groupId>com.oracle</groupId> 
      <artifactId>ojdbc14</artifactId> 
      <version>10.2.0.4.0</version> 
     </dependency> 

,當我運行項目作爲騾子應用然後我收到以下錯誤。

.. 
    Caused by: java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver 
     at java.net.URLClassLoader$1.run(URLClassLoader.java:202) 
     at java.security.AccessController.doPrivileged(Native Method) 
     at java.net.URLClassLoader.findClass(URLClassLoader.java:190) 
     at org.mule.module.launcher.FineGrainedControlClassLoader.findClass(FineGrainedControlClassLoader.java:179) 
     at org.mule.module.launcher.MuleApplicationClassLoader.findClass(MuleApplicationClassLoader.java:143) 
     at org.mule.module.launcher.FineGrainedControlClassLoader.loadClass(FineGrainedControlClassLoader.java:123) 
     at org.mule.module.launcher.MuleApplicationClassLoader.loadClass(MuleApplicationClassLoader.java:149) 
     at java.lang.ClassLoader.loadClass(ClassLoader.java:247) 
     at java.lang.Class.forName0(Native Method) 
     at java.lang.Class.forName(Class.java:247) 
     at org.springframework.jdbc.datasource.DriverManagerDataSource.setDriverClassName(DriverManagerDataSource.java:147) 
     ... 55 more 
    Exception in thread "main" org.mule.module.launcher.DeploymentInitException: PropertyBatchUpdateException: Failed properties: Property 'driverClassName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [oracle.jdbc.OracleDriver] 
     at org.mule.module.launcher.application.DefaultMuleApplication.init(DefaultMuleApplication.java:220) 
     at org.mule.module.launcher.application.ApplicationWrapper.init(ApplicationWrapper.java:64) 
     at org.mule.module.launcher.DefaultMuleDeployer.deploy(DefaultMuleDeployer.java:46) 
     at org.mule.tooling.server.application.ApplicationDeployer.run(ApplicationDeployer.java:56) 
     at org.mule.tooling.server.application.ApplicationDeployer.main(ApplicationDeployer.java:88) 
    Caused by: org.mule.api.config.ConfigurationException: Error creating bean with name '_muleNotificationManager': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [spring-mule.xml]: Cannot resolve reference to bean 'datasource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'datasource' defined in class path resource [spring-mule.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are: 
    PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClassName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [oracle.jdbc.OracleDriver] (org.mule.api.lifecycle.InitialisationException) (org.mule.api.config.ConfigurationException) 
     at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:52) 
     at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:78) 
     at org.mule.context.DefaultMuleContextFactory.createMuleContext(DefaultMuleContextFactory.java:80) 
     at org.mule.module.launcher.application.DefaultMuleApplication.init(DefaultMuleApplication.java:208) 
     ... 4 more 
    Caused by: org.mule.api.config.ConfigurationException: Error creating bean with name '_muleNotificationManager': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [spring-mule.xml]: Cannot resolve reference to bean 'datasource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'datasource' defined in class path resource [spring-mule.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are: 
    PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClassName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [oracle.jdbc.OracleDriver] (org.mule.api.lifecycle.InitialisationException) 
     at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:52) 
     at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:78) 
     at org.mule.config.builders.AutoConfigurationBuilder.autoConfigure(AutoConfigurationBuilder.java:101) 
     at org.mule.config.builders.AutoConfigurationBuilder.doConfigure(AutoConfigurationBuilder.java:57) 
     at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:46) 
     ... 7 more 
    Caused by: org.mule.api.lifecycle.InitialisationException: Error creating bean with name '_muleNotificationManager': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [spring-mule.xml]: Cannot resolve reference to bean 'datasource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'datasource' defined in class path resource [spring-mule.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are: 
    PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClassName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [oracle.jdbc.OracleDriver] 
     at org.mule.registry.AbstractRegistry.initialise(AbstractRegistry.java:117) 
     at org.mule.config.spring.SpringXmlConfigurationBuilder.createSpringRegistry(SpringXmlConfigurationBuilder.java:116) 
     at org.mule.config.spring.SpringXmlConfigurationBuilder.doConfigure(SpringXmlConfigurationBuilder.java:73) 
     at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:46) 
     ... 11 more 
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '_muleNotificationManager': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [spring-mule.xml]: Cannot resolve reference to bean 'datasource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'datasource' defined in class path resource [spring-mule.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are: 
    PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClassName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [oracle.jdbc.OracleDriver] 
     at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:149) 
     at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:102) 
     at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1442) 
     at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:248) 
     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) 
     at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:581) 
     at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913) 
     at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464) 
     at org.mule.config.spring.SpringRegistry.doInitialise(SpringRegistry.java:89) 
     at org.mule.registry.AbstractRegistry.initialise(AbstractRegistry.java:109) 
     ... 14 more 
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [spring-mule.xml]: Cannot resolve reference to bean 'datasource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'datasource' defined in class path resource [spring-mule.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are: 
    PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClassName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [oracle.jdbc.OracleDriver] 
     at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328) 
     at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1360) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) 
     at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294) 
     at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) 
     at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) 
     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) 
     at org.springframework.beans.factory.support.AbstractBeanFactory.isSingleton(AbstractBeanFactory.java:408) 
     at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:319) 
     at org.springframework.context.support.AbstractApplicationContext.getBeanNamesForType(AbstractApplicationContext.java:1154) 
     at org.mule.config.spring.ServerNotificationManagerConfigurator.getMergedListeners(ServerNotificationManagerConfigurator.java:83) 
     at org.mule.config.spring.ServerNotificationManagerConfigurator.getObject(ServerNotificationManagerConfigurator.java:65) 
     at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142) 
     ... 23 more 
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'datasource' defined in class path resource [spring-mule.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are: 
    PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClassName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [oracle.jdbc.OracleDriver] 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1396) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) 
     at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294) 
     at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) 
     at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) 
     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) 
     at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322) 
     ... 38 more 
    Caused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are: 
    PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClassName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [oracle.jdbc.OracleDriver] 
     at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:102) 
     at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:58) 
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1393) 
     ... 46 more 

請提出解決方案

+0

即使是行家不禁下載神器的Oracle JDBC dryver。 –

回答

5

你怎麼把它添加到您的M2回購?如果你從你提供的鏈接中得到了問題,這意味着你沒有正確地在你的倉庫中安裝jar。

您應該安裝這樣的jar:

mvn install:install-file 
    -Dfile=path/to/ojdbc14.jar 
    -DgroupId=com.oracle 
    -DartifactId=ojdbc14 
    -Dversion=10.2.0.4.0 
    -Dpackaging=jar 
0

給定的行家依賴不起作用

<dependency> <groupId>com.oracle</groupId> <artifactId>ojdbc14</artifactId> <version>10.2.0.4.0</version> </dependency>

您需要手動下載並添加JAR文件ojdbc到騾子項目。 您可以通過以下步驟完成此操作。

  1. 在項目中創建一個lib文件夾。
  2. 放置在lib文件夾中下載jar文件
  3. 添加它來構建項目的路徑通過右鍵點擊項目名稱 - >構建路徑 - >添加Libraries->導航到罐子的位置 - >添加。

希望這有助於

相關問題