Currently I am working on customization of Open Source Jitsi. And Somehow, I want to add 3rd party jar for customization.
I tried a lot to include 3rd party jar but I am facing this error.
So please help me to get rid of this error or provide some guidance to add 3rd party jar .
Auto-properties install: reference:file:sc-bundles/commons-vfs2-2.0.jar (org.osgi.framework.BundleException: Unable to cache bundle: reference:file:sc-bundles/commons-vfs2-2.0.jar - java.io.IOException: Referenced file does not exist: sc-bundles\commons-vfs2-2.0.jar)
[java] org.osgi.framework.BundleException: Unable to cache bundle: reference:file:sc-bundles/commons-vfs2-2.0.jar
[java] at org.apache.felix.framework.Felix.installBundle(Felix.java:2876)
[java] at org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:165)
[java] at org.apache.felix.main.AutoProcessor.processAutoProperties(AutoProcessor.java:296)
[java] at org.apache.felix.main.AutoProcessor.process(AutoProcessor.java:79)
[java] at org.apache.felix.main.Main.main(Main.java:292)
[java] at net.java.sip.communicator.launcher.SIPCommunicator.main(SIPCommunicator.java:219)
[java] Caused by: java.io.IOException: Referenced file does not exist: sc-bundles\commons-vfs2-2.0.jar
[java] at org.apache.felix.framework.cache.BundleArchive.createRevisionFromLocation(BundleArchive.java:852)
[java] at org.apache.felix.framework.cache.BundleArchive.reviseInternal(BundleArchive.java:550)
[java] at org.apache.felix.framework.cache.BundleArchive.<init>(BundleArchive.java:153)
[java] at org.apache.felix.framework.cache.BundleCache.create(BundleCache.java:277)
[java] at org.apache.felix.framework.Felix.installBundle(Felix.java:2872)
[java] ... 5 more
Add your JAR file (custom.jar) to the lib/ directory. Then edit the two files as indicated below:
jitsi.eml - Add the following entry to the file :
<lib name="custom.jar" scope="COMPILE">
<relative-module-cls project-related="jar://$PROJECT_DIR$/lib/custom.jar!/"/>
</lib>
nbproject/project.xml - Search for <classpath mode="compile"> (there are two such occurences) and enlist your jar file as
<classpath mode="compile">lib/custom.jar:lib/felix.jar:[MORE JARS HERE]</classpath>
and
<classpath mode="compile">classes:lib/custom.jar:lib/felix.jar:[MORE JARS HERE]</classpath>
After editing the files, run ant clean; ant clean-bundles; ant make
And you are good to go.
Related
Following the guide at http://docs.sonarqube.org/display/DEV/Debugging, I have encounter an issue where the sonar-runner appears to be looking in the wrong place for the sonar-project.properties file.
This happens when I try to debug with Intellij.
Can anyone help?
Thanks
Matt
I get the following error:
SONAR_RUNNER_OPTS=-Xdebug -Xnoagent -Duser.dir=c:\dev\eci -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
INFO: Error stacktraces are turned on.
ERROR: homekey=runner.home
ERROR: homrelativePathFromHom=conf/sonar-runner.properties
ERROR: settingsKey=runner.settings
INFO: Runner configuration file: C:\Sonar\sonar-runner-2.4\conf\sonar- runner.properties
ERROR: homekey=project.home
ERROR: homrelativePathFromHom=sonar-project.properties
ERROR: settingsKey=project.settings
INFO: Project configuration file: NONE
INFO: Default locale: "en_AU", source code encoding: "windows-1252" (analysis is platform dependent)
INFO: Work directory: c:\dev\eci\.\.sonar
INFO: SonarQube Server 5.1.1
17:30:39.333 INFO - Load global repositories
17:30:39.340 DEBUG - Download: http://localhost:9000/batch/global (no proxy)
17:30:39.490 INFO - Load global repositories (done) | time=159ms
17:30:39.492 INFO - Server id: 20150731104939
17:30:39.493 INFO - User cache: C:\Users\matthewo\.sonar\cache
17:30:39.499 INFO - Install plugins
17:30:39.499 DEBUG - Download index of plugins
17:30:39.499 DEBUG - Download: http://localhost:9000/deploy/plugins/index.txt (no proxy)
17:30:39.585 DEBUG - Loaded 2138 properties from l10n bundles
17:30:39.585 INFO - Install JDBC driver
17:30:39.585 DEBUG - Download index of jdbc-driver
17:30:39.585 DEBUG - Download: http://localhost:9000/deploy/jdbc-driver.txt (no proxy)
17:30:39.592 INFO - Create JDBC datasource for jdbc:jtds:sqlserver://localhost:1433/Sonar;instance=MSSQL2012;SelectMethod=Curso r
17:31:03.765 DEBUG - Testing JDBC connection
17:31:04.351 DEBUG - Download: http://localhost:9000/api/server (no proxy)
17:31:04.368 INFO - Initializing Hibernate
17:31:04.370 DEBUG - hibernate.generate_statistics: false
17:31:04.370 DEBUG - hibernate.dialect: org.sonar.core.persistence.dialect.MsSql$MsSqlDialect
17:31:04.370 DEBUG - hibernate.connection.provider_class: org.sonar.jpa.session.CustomHibernateConnectionProvider
INFO: ---------------------------------------------------------------------- --
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 26.253s
Final Memory: 66M/340M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
at org.sonar.runner.api.Runner.execute(Runner.java:100)
at org.sonar.runner.Main.executeTask(Main.java:70)
at org.sonar.runner.Main.execute(Main.java:59)
at org.sonar.runner.Main.main(Main.java:53)
Caused by: java.lang.IllegalStateException: You must define the following mandatory properties for 'Unknown': sonar.projectKey, sonar.projectName, sonar.projectVersion, sonar.sources
at org.sonar.batch.scan.ProjectReactorBuilder.checkMandatoryProperties(ProjectReact orBuilder.java:315)
at org.sonar.batch.scan.ProjectReactorBuilder.defineRootProject(ProjectReactorBuild er.java:157)
at org.sonar.batch.scan.ProjectReactorBuilder.execute(ProjectReactorBuilder.java:116)
at org.sonar.batch.scan.ProjectScanContainer.projectBootstrap(ProjectScanContainer.java:110)
at org.sonar.batch.scan.ProjectScanContainer.doBeforeStart(ProjectScanContainer.java:86)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:90)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:57)
at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:45)
at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:135)
at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:158)
at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:95)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
... 9 more
Is there any way to set the working directory, so sonar-runner finds the project properties in the correct location - where I am executing the command from?
Thanks
Matt
Why are you trying to update the user directory? Try to remove -Duser.dir=c:\dev\eci from SONAR_RUNNER_OPTS
I'm trying to work with the SIGAR API, and I added the external jar "sigar.jar" to my Build Path eclipse project.
It compiles with no problem, but when I try to run the main class, that only does :
Cpu cpu = new Cpu();
it gives me this error:
[java] Exception in thread "main" java.lang.NoClassDefFoundError: org/hyperic/sigar/Cpu
[java] at pt.client.User.main(User.java:90)
[java] Caused by: java.lang.ClassNotFoundException: org.hyperic.sigar.Cpu
[java] at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
[java] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
[java] ... 1 more
[java] Java Result: 1
What may be missing?
I think you missed to include .so file specific for your platform.
These files are located ../hyperic-sigar-folder/sigar-bin/lib.
For example, if you are running under Linux 32 Bit, you have to include the file libsigar-x86-linux.so into your class-path as well.
I had a problem in tools.jar so I downloaded jdk and changed the environmental variables.
Now I have the HUB and RC listening.
But when I run the test script , it is unable to launch Firefox
I tired to uninstall and install Firefox 3.6 again, then created new profile for Firefox
I went to selenium-server.jar Unzip it, find all (of 5) “install.rdf” files inside this JAR (they are under customProfileDirCUSTFF and customProfileDirCUSTFFCHROME subfolders).
Changed the line from this <em:maxVersion>3.5.*</em:maxVersion> to this <em:maxVersion>3.6.*</em:maxVersion>
But still Firefox browser is not launched.
Please help.
Following is the error message:
C:\selenium\launch>title RC5560
C:\selenium\launch>cd C:\selenium\Grid\selenium-grid-1.0.4
C:\selenium\Grid\selenium-grid-1.0.4>C:\ant\bin\ant -DseleniumArgs="-firefoxProf
ileTemplate C:\Firefoxprofile -userExtensions 'C:\selenium\abilityplayer\Seleniu
m Extension scripts\CORE Extension\user-extensions.js'" -Denvironment="*firefox"
-Dport=5560 launch-remote-control
Buildfile: build.xml
launch-remote-control:
[java] jan 23, 2013 9:58:16 AM com.thoughtworks.selenium.grid.remotecontrol
.RegistrationRequest execute
[java] INFO: Registering to http://localhost:4444/registration-manager/regi
ster
[java] jan 23, 2013 9:58:16 AM com.thoughtworks.selenium.grid.remotecontrol
.SelfRegisteringRemoteControl launch
[java] INFO: Starting selenium server with options:
[java] jan 23, 2013 9:58:16 AM com.thoughtworks.selenium.grid.remotecontrol
.SelfRegisteringRemoteControl launch
[java] INFO: -firefoxProfileTemplate
[java] jan 23, 2013 9:58:16 AM com.thoughtworks.selenium.grid.remotecontrol
.SelfRegisteringRemoteControl launch
[java] INFO: C:\Firefoxprofile
[java] jan 23, 2013 9:58:16 AM com.thoughtworks.selenium.grid.remotecontrol
.SelfRegisteringRemoteControl launch
[java] INFO: -userExtensions
[java] jan 23, 2013 9:58:16 AM com.thoughtworks.selenium.grid.remotecontrol
.SelfRegisteringRemoteControl launch
[java] INFO: C:\selenium\abilityplayer\Selenium Extension scripts\CORE Exte
nsion\user-extensions.js
[java] jan 23, 2013 9:58:16 AM com.thoughtworks.selenium.grid.remotecontrol
.SelfRegisteringRemoteControl launch
[java] INFO: -port
[java] jan 23, 2013 9:58:16 AM com.thoughtworks.selenium.grid.remotecontrol
.SelfRegisteringRemoteControl launch
[java] INFO: 5560
[java] 09:58:16.543 INFO - Java: Oracle Corporation 23.6-b04
[java] 09:58:16.543 INFO - OS: Windows XP 5.1 x86
[java] 09:58:16.543 INFO - v1.0.1 [2696], with Core v#VERSION# [#REVISION#]
[java] 09:58:16.652 INFO - Version Jetty/5.1.x
[java] 09:58:16.652 INFO - Started HttpContext[/selenium-server/driver,/sel
enium-server/driver]
[java] 09:58:16.652 INFO - Started HttpContext[/selenium-server,/selenium-s
erver]
[java] 09:58:16.652 INFO - Started HttpContext[/,/]
[java] 09:58:16.652 INFO - Started SocketListener on 0.0.0.0:5560
[java] 09:58:16.652 INFO - Started org.mortbay.jetty.Server#1eae15f
[java] 09:58:29.118 INFO - Checking Resource aliases
[java] 09:58:29.118 INFO - Checking Resource aliases
[java] 09:58:29.118 INFO - Command request: getNewBrowserSession[*firefox,
http://ondemand.shl.com/] on session null
[java] 09:58:29.134 INFO - creating new remote session
[java] 09:58:29.321 INFO - Allocated session 3c67617374474d1c98f449a724ecb9
68 for http://ondemand.shl.com/, launching...
[java] 09:58:31.024 INFO - Preparing Firefox profile...
[java] 09:58:54.035 ERROR - Failed to start new browser session, shutdown b
rowser and clear all session data
[java] java.lang.RuntimeException: Firefox refused shutdown while preparing
a profile
[java] at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLaun
cher.waitForFullProfileToBeCreated(FirefoxChromeLauncher.java:311)
[java] at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLaun
cher.populateCustomProfileDirectory(FirefoxChromeLauncher.java:106)
[java] at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLaun
cher.launch(FirefoxChromeLauncher.java:83)
[java] at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLaun
cher.launchRemoteSession(FirefoxChromeLauncher.java:350)
[java] at org.openqa.selenium.server.browserlaunchers.FirefoxLauncher.l
aunchRemoteSession(FirefoxLauncher.java:98)
[java] at org.openqa.selenium.server.BrowserSessionFactory.createNewRem
oteSession(BrowserSessionFactory.java:357)
[java] at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowse
rSession(BrowserSessionFactory.java:122)
[java] at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowse
rSession(BrowserSessionFactory.java:84)
[java] at org.openqa.selenium.server.SeleniumDriverResourceHandler.getN
ewBrowserSession(SeleniumDriverResourceHandler.java:699)
[java] at org.openqa.selenium.server.SeleniumDriverResourceHandler.doCo
mmand(SeleniumDriverResourceHandler.java:393)
[java] at org.openqa.selenium.server.SeleniumDriverResourceHandler.hand
leCommandRequest(SeleniumDriverResourceHandler.java:364)
[java] at org.openqa.selenium.server.SeleniumDriverResourceHandler.hand
le(SeleniumDriverResourceHandler.java:125)
[java] at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
[java] at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
[java] at org.mortbay.http.HttpServer.service(HttpServer.java:909)
[java] at org.mortbay.http.HttpConnection.service(HttpConnection.java:8
20)
[java] at org.mortbay.http.HttpConnection.handleNext(HttpConnection.jav
a:986)
[java] at org.mortbay.http.HttpConnection.handle(HttpConnection.java:83
7)
[java] at org.mortbay.http.SocketListener.handleConnection(SocketListen
er.java:245)
[java] at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:35
7)
[java] at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:53
4)
[java] Caused by: org.openqa.selenium.server.browserlaunchers.FirefoxChrome
Launcher$FileLockRemainedException: Lock file still present! C:\DOCUME~1\ARTPUS~
1\LOCALS~1\Temp\customProfileDir3c67617374474d1c98f449a724ecb968\parent.lock
[java] at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLaun
cher.waitForFileLockToGoAway(FirefoxChromeLauncher.java:269)
[java] at org.openqa.selenium.server.browserlaunchers.FirefoxChromeLaun
cher.waitForFullProfileToBeCreated(FirefoxChromeLauncher.java:309)
[java] ... 20 more
When firefox prepares to launch a folder is created (say) C:\Documents and Settings\USER\Local Settings\Temp\customProfileDird47599b65f3246a9b14e72e6d7fdda84
A Parent.lock file is created . This may be preventing Firefox to launch.
By doing the change mentioned in the below link
http://girliemangalo.wordpress.com/2009/02/05/creating-firefox-profile-for-your-selenium-rc-tests/
solved my problem
I am trying to get gwt validation working using the hibernate validator. I have followed the steps from http://code.google.com/p/google-web-toolkit/wiki/BeanValidation and configured my project according to the sample validation project at http://code.google.com/p/google-web-toolkit/source/browse/trunk/samples/validation/
My .gwt.xml file contains:
<inherits name="org.hibernate.validator.HibernateValidator" />
and my custom validation factory:
<replace-with class="my.package.here.client.validation.ValidatorFactory">
<when-type-is class="javax.validation.ValidatorFactory" />
</replace-with>
Validation works perfect both on client and server side in dev mode, but when trying to gwt compile I get:
gwtc-production:
[java] Compiling module my.package.MyModule
[java] Validating newly compiled units
[java] [ERROR] Errors in 'jar:file:/hibernate-validator-4.2.0.Final-sources.jar!/org/hibernate/validator/constraints/impl/FutureValidatorForReadableInstant.java'
[java] [ERROR] Line 32: No source code is available for type org.joda.time.ReadableInstant; did you forget to inherit a required module?
[java] [ERROR] Errors in 'jar:file:/hibernate-validator-4.2.0.Final-sources.jar!/org/hibernate/validator/constraints/impl/FutureValidatorForReadablePartial.java'
[java] [ERROR] Line 32: No source code is available for type org.joda.time.ReadablePartial; did you forget to inherit a required module?
[java] [ERROR] Errors in 'jar:file:/hibernate-validator-4.2.0.Final-sources.jar!/org/hibernate/validator/constraints/impl/PastValidatorForReadableInstant.java'
[java] [ERROR] Errors in 'jar:file:/hibernate-validator-4.2.0.Final-sources.jar!/org/hibernate/validator/constraints/impl/SafeHtmlValidator.java'
[java] [ERROR] Line 22: The import org.jsoup cannot be resolved
[java] [ERROR] Line 23: The import org.jsoup cannot be resolved
[java] [ERROR] Line 35: Whitelist cannot be resolved to a type
[java] [ERROR] Line 40: Whitelist cannot be resolved to a type
[java] [ERROR] Line 40: Whitelist cannot be resolved
[java] [ERROR] Line 43: Whitelist cannot be resolved to a type
[java] [ERROR] Line 43: Whitelist cannot be resolved
[java] [ERROR] Line 46: Whitelist cannot be resolved to a type
[java] [ERROR] Line 46: Whitelist cannot be resolved
[java] [ERROR] Line 49: Whitelist cannot be resolved to a type
[java] [ERROR] Line 49: Whitelist cannot be resolved
[java] [ERROR] Line 52: Whitelist cannot be resolved to a type
[java] [ERROR] Line 52: Whitelist cannot be resolved
[java] [ERROR] Line 55: Whitelist cannot be resolved to a type
[java] [ERROR] Line 62: Jsoup cannot be resolved
[java] [ERROR] Line 62: Whitelist cannot be resolved to a type
[java] [ERROR] Errors in 'jar:file:gwt-user.jar!/org/hibernate/validator/super/org/hibernate/validator/engine/PathImpl.java'
[java] [ERROR] Line 72: The constructor NodeImpl(String) is undefined
[java] [ERROR] Line 84: The constructor NodeImpl(Path.Node) is undefined
[java] [ERROR] Line 95: The constructor NodeImpl(Path.Node) is undefined
[java] [ERROR] Line 202: The constructor NodeImpl(String) is undefined
[java] [ERROR] Line 204: The method setInIterable(boolean) is undefined for the type NodeImpl
[java] [ERROR] Line 209: The method setIndex(Integer) is undefined for the type NodeImpl
[java] [ERROR] Line 212: The method setKey(String) is undefined for the type NodeImpl
[java] [ERROR] Aborting compile due to errors in some input files
There is obviously some source jar I'm missing. I have (among others) on my classpath:
hibernate-validator-4.2.0.Final.jar
hibernate-validator-4.2.0.Final-sources.jar
I have also tried adding joda-time-2.1.jar, joda-time-2.1-sources.jar, jsoup-1.6.3.jar and jsoup-1.6.3-sources.jar.
Shouldn't inheriting the org.hibernate.validator.HibernateValidator take care of the super sources so I don't need to provide the sources? Can anyone see what I'm missing?
GWT is built against Hibernate Validator 4.1.0-Final and relies on some of its internals (PathImpl, NodeImpl), and apparently those have changed in Hibernate Validator 4.2.0.
Use 4.1.0-Final (or possibly 4.0.2.GA as in the sample) instead of 4.2.0.
Issue can be tracked in the GWT Tracker, we should probably at least document the incompatibility explicitly.
I didn't knew the GWT implementation of Hibernate validation. But why is GWT trying to understand code from your very Hibernate source jar? If it's GWT's own code it should come from it's gwt-user.jar or something like that.
If you agree with me, then don't include any real Hibernate jar in GWT compilation classpath. It won't need it / know it, anyway.
4.1.0 also worked for me, after some time I found out that there are a few problems with higher versions. Therefore use same versions as recommaned within the tutorial from gwt (http://www.gwtproject.org/doc/latest/DevGuideValidation.html) also I had a compile WARNING:
detected warnings related to 'javax.validation.constraint'. is validation- version .jar on the classpath
Which i fixed with:
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<scope>compile</scope>
</dependency>
Note: the test project I'm mentioning can be downloaded with:
git clone https://github.com/mperdikeas/so-spring-di-appcontext-schemalocation.git
.. and run with 'ant run'.
I 'understand' that XML namespace names are just used as opaque identifiers and not meant to be used as URIs (wikipedia). I also 'understand' that the XML schema locations are meant to provide hints as to the actual location of schema documents and, being hints, not used in practice (w3.org). With that in mind I 've been experimenting with a simple Spring DI application (used in a simple J2SE setting) by modifying the applicationContext.xml. Here is the starting version:
<beans xmlns = "http://www.springframework.org/schema/beans"
xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
xmlns:context = "http://www.springframework.org/schema/context"
xmlns:p = "http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd">
<context:component-scan base-package="atm"/>
<context:property-placeholder location="classpath:META-INF/spring/atm.properties"/>
<bean id="soapTransport_" class="atm.SoapATMTransport" p:retries="${transport.retries}"/>
When I did a 'sudo ifconfig eth0 down' the project ran perfectly which is consistent with the runtime not bothering to fetch anything from the schemaLocations. However, when I mangled the schemaLocations by adding a simple underscore to the second URL in each pair I received the following complaint:
[java] org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 10 in XML document from class path resource [META-INF/spring/applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 10; columnNumber: 100; cvc-elt.1: Cannot find the declaration of element 'beans'.
[java] at org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:194)
[java] at org.apache.tools.ant.taskdefs.Java.run(Java.java:771)
[java] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:221)
[java] at org.apache.tools.ant.taskdefs.Java.executeJava(Java.java:135)
[java] at org.apache.tools.ant.taskdefs.Java.execute(Java.java:108)
[java] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[java] at java.lang.reflect.Method.invoke(Method.java:601)
[java] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[java] at org.apache.tools.ant.Task.perform(Task.java:348)
[java] at org.apache.tools.ant.Target.execute(Target.java:390)
[java] at org.apache.tools.ant.Target.performTasks(Target.java:411)
[java] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
[java] at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
[java] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
[java] at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
[java] at org.apache.tools.ant.Main.runBuild(Main.java:809)
[java] at org.apache.tools.ant.Main.startAnt(Main.java:217)
[java] at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
[java] at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Which seems to suggest that Spring DI runtime uses the second URL in each pair at the xsi:schemaLocation as some kind of identifier (hardcoded in its logic since there is no network access). So my assumption would be that the Spring DI runtime uses two kind of identifiers for each namespace: the xmlns identifier to uniquely identify the namespace (used as an opaque string) and the schemaLocation identifier to uniquely identify the schema version for that namespace (again used as an opaque string). I.e. the schemaLocation is actually used (in a contorted way ? as that doesn't seem to be the intention of the w3c documents) to version the namespace.
Moreover, in such a case, why doesn't the Spring DI runtime complain about the lack of a schemaLocation for the "p" namespace. Is my mental model correct?
Here is what happens:
XML schema allows you to define aliases (short names) to XML namespaces. Technically all namespaces are identified by full URI but that would be very cumbersome - so you can use short aliases like context and p. There is also a default namespace denoted by xmlns attribute
By default XML parsers assume namespace URI is also a XSD file URL location. This is often the case, but is not required by the spec. This is also how XML parser in Spring works if you don't provide schemaLocation attribute.
schemaLocation is used to map from namespace URI to XSD file physical location (URL). It is used when schema namespace does not point to valid XSD URL (see MSDN on schemaLocation).
Last but not least, Spring adds yet another layer that translates Internet URLs to local files on CLASSPATH. This way your application can start without Internet connection (or when springframework.org site is down).
If you search your project libraries you'll find several files named spring.schemas. These files contain lines similar to below (extract from the file found in spring-context.jar, I added alignment):
http\://www.springframework.org/schema/context/spring-context.xsd= org/springframework/context/config/spring-context-3.1.xsd
http\://www.springframework.org/schema/jee/spring-jee.xsd= org/springframework/ejb/config/spring-jee-3.1.xsd
http\://www.springframework.org/schema/lang/spring-lang.xsd= org/springframework/scripting/config/spring-lang-3.1.xsd
http\://www.springframework.org/schema/cache/spring-cache.xsd= org/springframework/cache/config/spring-cache-3.1.xsd