Error creating Spring Profiles

79 views Asked by At

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>

2

There are 2 answers

2
hyness On

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">
0
Digital_1mpulse On

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