How do I tell IntelliJ where to find a custom namespace handler to parse a custom bean?

Hey everyone,

I'm running IntelliJ 10.0.0.2.  I have a custom namespace and bean parser class that I'm using in my application context.  The root of the context looks like:

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.mycompany.com/schema/ccs"
 xmlns:beans="http://www.springframework.org/schema/beans"
 xmlns:util="http://www.springframework.org/schema/util"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="
    http://www. mycompany.com/schema/ccs ccs-config-1.0.xsd
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
    http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd
   ">



My custom namespace is "http://www.mycompany.com/schema/ccs" and the schema is located in "ccs-config-1.0.xsd".  I have the following two entries in my project resources (with the project check-box checked):

URI: ccs-config-1.0.xsd PATH: /users/path/to/my/local/copy/ccs-config-1.0.xsd
URI: http://www.mycompany.com/schema/ccs PATH: /users/path/to/my/local/copy/ccs-config-1.0.xsd

The application context contains a bunch of these custom beans.  When I try to invoke the intention "Parse Custom Bean", I get the error:

"Cannot find custom handler for namespace http://www.mycompany.com/schema/ccs"

How do I tell IntelliJ where to find the handler?  The class is on the module classpath and so is the spring.handlers file inside META-INF.
0

Are your application context XML and spring.handlers in production or in tests? Are they in the same module? Could you please attach your spring.handlers here?

0
Avatar
Permanently deleted user

The application context and spring.handlers are both in production in the same module.

My spring.handlers is one line:

http\://www.mycompany.com/schema/ccs=com.mycompany.ccs.config.CCSNamespaceHandler

Do I need to register this resource in some way?

0

No, you don't have to. In which encoding is your spring.handlers file? What kind of OS are you on, is the file system case sensitive? Is it located precisely inside 'META-INF' which should be under some source root?

0
Avatar
Permanently deleted user

Thanks, that was it.  META-INF was on the classpath but under a root called "resources" that was not inside a source tree.  Thanks again.

0

In fact, then it wasn't on the classpath (at least if you run your app from IDEA)

0
Avatar
Permanently deleted user

I had added the resources/META-INF folder to the module dependencies.

0

Interesting. As a library? Classes or sources?

0
Avatar
Permanently deleted user

Single-entry module library.  Does the scope matter?  It was set to "Provided" but is now "Compile".

0

A bug, indeed. IDEA doesn't honor this way of adding things to classpath. This issue will be fixed in 10.5, thank you!

0

请先登录再写评论。