Digital_1mpulse
Digital_1mpulse

Reputation: 23

Error creating Spring Profiles

I am getting the error:

 cvc-complex-type.2.4.a: Invalid content was found starting with element
 'sec:http'. One of '{"http://www.springframework.org/schema/beans":beans}'
 is  expected.

I am simply creating a local spring profile with a dataSource, and have no idea what I need to include.

My namespace configuration includes:

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

The error is occurring because of: <beans profile="local"></beans>

Upvotes: 0

Views: 78

Answers (2)

Digital_1mpulse
Digital_1mpulse

Reputation: 23

The issue was caused by the ordering of param values in the contextConfigLocation.

Upvotes: 0

hyness
hyness

Reputation: 4905

The error has nothing to do with your profile. The error is because somewhere in your xml, which you haven't included in your question, you are using spring security xml schema. You have not declared it in your xsd. This updated xml schema should fix your issue (fix version number if I guessed incorrectly)...

<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:c="http://www.springframework.org/schema/c"
   xmlns:context="http://www.springframework.org/schema/context"
   xmlns:sec="http://www.springframework.org/schema/security"
   xsi:schemaLocation="http://www.springframework.org/schema/beans
      http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
      http://www.springframework.org/schema/context
      http://www.springframework.org/schema/context/spring-context-3.2.xsd
      http://www.springframework.org/schema/security
      http://www.springframework.org/schema/security/spring-security-3.1.xsd">

Upvotes: 1

Related Questions