0

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 Answers2

1

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">
hyness
  • 4,785
  • 1
  • 22
  • 24
  • The xml that contains the spring profile doesn't contain anything related to security which confuses me. I had actually though that was the reason, but it just didn't make sense to me. I will look through my other xmls. I really appreciate it. – Digital_1mpulse Jun 23 '15 at 15:25
  • That was clearly the error you posted. If you want someone to help, you need to post all the files and the full stacktrace – hyness Jun 24 '15 at 17:05
0

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