Java错误:java.lang.ClassNotFoundException:

时间:2016-07-13 17:51:25

标签: java spring mule classnotfoundexception

让我先说一下我不是Java开发人员,而是一位需要为项目利用一小部分Java代码的Python开发人员。 : - )

话虽如此,我收到以下错误:

Caused by: java.lang.ClassNotFoundException: CustomSecurePropertyPlaceholderModule

使用以下代码:

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


<domain:mule-domain xmlns="http://www.mulesoft.org/schema/mule/core"
                    xmlns:domain="http://www.mulesoft.org/schema/mule/ee/domain"
                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                    xmlns:spring="http://www.springframework.org/schema/beans"
                    xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
                    xmlns:mule-ss="http://www.mulesoft.org/schema/mule/spring-security"
                    xmlns:context="http://www.springframework.org/schema/context"
                    xmlns:tls="http://www.mulesoft.org/schema/mule/tls"
                    xmlns:ss="http://www.springframework.org/schema/security"
                    xmlns:http="http://www.mulesoft.org/schema/mule/http"
                    xmlns:secure-property-placeholder="http://www.mulesoft.org/schema/mule/secure-property-placeholder"
                    xsi:schemaLocation="http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
                                        http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd
                                        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
                                        http://www.mulesoft.org/schema/mule/ee/domain http://www.mulesoft.org/schema/mule/ee/domain/current/mule-domain-ee.xsd
                                        http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
                                        http://www.mulesoft.org/schema/mule/tls http://www.mulesoft.org/schema/mule/tls/current/mule-tls.xsd
                                        http://www.mulesoft.org/schema/mule/secure-property-placeholder http://www.mulesoft.org/schema/mule/secure-property-placeholder/current/mule-secure-property-placeholder.xsd
                                        http://www.springframework.org/schema/context  http://www.springframework.org/schema/context/spring-context-3.0.xsd">


    <spring:beans>
        <spring:bean id="secure-property-placeholder" class="CustomSecurePropertyPlaceholderModule">
            <spring:property name="encryptionAlgorithm" value="AES" />
            <spring:property name="encryptionMode" value="CBC" />
            <spring:property name="keyFilePath" value="keyfile.properties" />
            <spring:property name="locations" value="secure.properties"/>
            <spring:property name="ignoreResourceNotFound" value="true" />
            <spring:property name="ignoreUnresolvablePlaceholders" value="true" />
        </spring:bean>
    </spring:beans>


</domain:mule-domain>

我确保src/main/java位于运行配置中的构建路径上(文件CustomSecurePropertyPlaceholderModule驻留在那里)。我还看到shared_resources/target/classes也被设置为运行配置中的输出文件夹。我仍然收到这个错误的任何想法?

1 个答案:

答案 0 :(得分:2)

在Java中,类通常在包中。

赞,com.yourself.CustomSecurePropertyPlaceholderModule

尝试将您的课程(我希望您拥有)放入src/main/java/com/yourself,前缀为package com.yourself;并使用

<spring:bean id="secure-property-placeholder" class="com.yourself.CustomSecurePropertyPlaceholderModule">