views:

123

answers:

2

Hello world,

I have some problem running spring in my j2ee application.

Short introduction:

I use WebSphere 6.1 (i don't know that it is websphere specific or more general problem)

Artifacts:

  1. web application (war) where in WEB-INF/lib folder maven publishes all needed spring dependencies.
  2. war is then packaged in ear and deploys on application server.

I don't have any spring configuration files or references to spring in the application yet. Just jar files inside WEB-INF/lib and nothing more about spring.

When application is deployed and application starts loading application server start looking for some spring xml schemas:

http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/tool/spring-tool-2.0.xsd http://www.springframework.org/schema/tool/spring-tool-2.5.xsd http://www.springframework.org/schema/tool/spring-tool-3.0.xsd

It want to took them from internet by url's specified above.

Question:

How to force application server to use schemas located locally (in web archive)? Or maybe disable this checks at all?

On the other hand when application starts all works perfectly (later i had try to use IoC).

Application server doesn't have internet connection and all attempts to resolve this schemas results in waiting for connection time-out.

What i try:

Put spring.schemas containing url's mappings to schemas located in web archive into META-INF folder. All this files (spring.schemas and xml schemas) is accessible by ClassLoader (checked).

Any help will be greatly appreciated.

/me [stupid j2ee developer]

Update 1:

Here is exact messages that i take from websphere log file:

[22.07.10 15:45:58:626 MSD] 00000043 XMLParser     W   java.net.SocketException occurs during processing http://www.springframework.org/schema/tool/spring-tool-2.0.xsd: Operation timed out: connect:could be due to invalid address
[22.07.10 15:46:20:112 MSD] 00000043 XMLParser     W   java.net.SocketException occurs during processing http://www.springframework.org/schema/beans/spring-beans-2.0.xsd: Operation timed out: connect:could be due to invalid address
[22.07.10 15:46:41:124 MSD] 00000043 XMLParser     W   java.net.SocketException occurs during processing http://www.springframework.org/schema/tool/spring-tool-2.5.xsd: Operation timed out: connect:could be due to invalid address
[22.07.10 15:47:02:118 MSD] 00000043 XMLParser     W   java.net.SocketException occurs during processing http://www.springframework.org/schema/beans/spring-beans-2.5.xsd: Operation timed out: connect:could be due to invalid address
[22.07.10 15:47:23:130 MSD] 00000043 XMLParser     W   java.net.SocketException occurs during processing http://www.springframework.org/schema/tool/spring-tool-3.0.xsd: Operation timed out: connect:could be due to invalid address
[22.07.10 15:47:44:129 MSD] 00000043 XMLParser     W   java.net.SocketException occurs during processing http://www.springframework.org/schema/beans/spring-beans-3.0.xsd: Operation timed out: connect:could be due to invalid address
A: 

This could be a classloader issue where a file from another WAR is trying to access the spring schema. Or maybe the appserver tries to load the spring files which are specified in the web.xml.

You can try placing the spring.schemas and XSD files in the root of the EAR directory. If any other WAR file is attempting to load the files, then based on the default PARENT_FIRST classloader policy, it should be able to find the schemas. Just to rule out the classloader issue completely, if the previous step did not help, try placing the XSD files in a jar in the JRE/lib/ext directory and restarting the server.

Thimmayya
A: 

I had this problem with commons validator framework. What I did was to change the namespaces in the xml file [where they are normally specified] to point to a local version that I hosted on my webserver. For spring, I guess it is the ApplicationContext.xml.

http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://yourservername/springns/schema/beans/spring-beans-2.0.xsd

This is not the perfect solution, but it works.

Let me know how it goes.

Jay