[Building Sakai] crashes on KnowledgeBase tool

Liu, Peter peter.liu at yale.edu
Thu Jun 30 13:31:50 PDT 2011


Hi Roland,

Many thanks and I found why I have got the extra Spring jars in the tool’s lib.  When I checked out your Utils:
https://source.sakaiproject.org/contrib/edia/utils/tags/1.2.2

and build the jar file by myself.  This causes  the extra Spring jars into the tool lib when you maven-build the knowledgebase tool.

Now, after I have added the scope: ‘provided’ at Spring stuffs into the pom.xml files for the utils-1.2.2, everything works greatly.

This tool looks fantastic and we are planning to make a pilot-running for our Fall semester.

Thanks a lot!
Peter

From: Roland Groen [mailto:roland at edia.nl]
Sent: Thursday, June 30, 2011 2:18 PM
To: Liu, Peter
Cc: sakai-dev at collab.sakaiproject.org
Subject: Re: [Building Sakai] crashes on KnowledgeBase tool

Hi Peter,

I've deployed and tested the tool on a clean 2.6.3 Sakai, the problem must be somewhere in your deployment.

This error occurs when the spring jar is deployed to both the war file and the shared/lib directory. The spring dependency should not be deployed to the knowledgebase war file. Did you check out a clean source tree from subversion? Did you run mvn clean install?

You could you check what's being deployed by running in the knowledgebase source root:

find . | grep jar | grep spring

Mine shows:

./pack/target/edia-sakai-knowledgebase-pack-0.1/WEB-INF/lib/spring-test-2.5.6.jar
./tool/target/edia-sakai-knowledgebase-tool-0.1/WEB-INF/lib/spring-json-1.1.jar
./tool/target/edia-sakai-knowledgebase-tool-0.1/WEB-INF/lib/spring-mock-2.0.6.jar

And at the sakai tomcat directory:

./shared/lib/spring-2.0.6.jar
./components/edia-sakai-knowledgebase-pack/WEB-INF/lib/spring-test-2.5.6.jar
./webapps/edia-sakai-knowledgebase-tool/WEB-INF/lib/spring-mock-2.0.6.jar
./webapps/edia-sakai-knowledgebase-tool/WEB-INF/lib/spring-json-1.1.jar

Make sure your source and installation gives exactly the same results. If not, make sure to check out the svn 2.6.x tree into a empty directory, please run:

svn co https://source.sakaiproject.org/contrib/edia/knowledgebase/branches/sakai-2.6.x/ knowledgebase
cd knowledgebase
mvn clean install sakai:deploy

If the problem remains, please inspect the dependency tree:

mvn dependency:tree

And check what is going on, the spring jar should appear like this multiple times:

org.springframework:spring:jar:2.0.6:provided

The word provided is the word to check for, if it does not state provided: you've found the cause of the problem.

With kind regards,

--
Roland M.S. Groen
roland at edia.nl<mailto:roland at edia.nl>

Edia - Educatie Technologie
Korte Prinsengracht 42 hs | 1013 GT Amsterdam
T 020 716 36 12 | F 020 716 36 13 | M 06 2423 09 06 | www.edia.nl<http://www.edia.nl/>


2011/6/30 Liu, Peter <peter.liu at yale.edu<mailto:peter.liu at yale.edu>>
Hi Roland,

Thank you very much for helping me out by creating this new sakai-2-6 branch.  I have checked out and after compiling, it works fine now for Java 5 version for tomcat 5.5.26 now.  However, I still get the same error for spring stuff.  I checked the packed jars under the tool and all spring jar are 2.0.6 version there.

Do I miss anything that you have?

Many thanks,
Peter


-           - - - - - - - - - -
2011-06-30 15:34:16,259  INFO main org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/edia-sakai-knowledgebase-tool] - Initializing Spring root WebApplicationContext
2011-06-30 15:34:16,271 ERROR main org.springframework.web.context.ContextLoader - Context initialization failed
org.springframework.context.ApplicationContextException: Custom context class [org.springframework.web.context.support.XmlWebApplicationContext] is not of type [org.springframework.web.context.ConfigurableWebApplicationContext]
      at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:230)
      at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:187)
      at org.sakaiproject.component.impl.ContextLoader.initWebApplicationContext(ContextLoader.java:64)
      at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
      at org.sakaiproject.util.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:56)
      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3764)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4216)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
      at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:831)
      at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:720)
      at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:490)
      at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
      at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)
      at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
      at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
      at org.apache.catalina.core.StandardService.start(StandardService.java:448)
      at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
      at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
      at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
2011-06-30 15:34:16,272 ERROR main org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/edia-sakai-knowledgebase-tool] - Exception sending context initialized event to listener instance of class org.sakaiproject.util.ContextLoaderListener
org.springframework.context.ApplicationContextException: Custom context class [org.springframework.web.context.support.XmlWebApplicationContext] is not of type [org.springframework.web.context.ConfigurableWebApplicationContext]
      at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:230)
      at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:187)
      at org.sakaiproject.component.impl.ContextLoader.initWebApplicationContext(ContextLoader.java:64)
      at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
      at org.sakaiproject.util.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:56)
      at o

From: Roland Groen [mailto:roland at edia.nl<mailto:roland at edia.nl>]
Sent: Thursday, June 30, 2011 6:02 AM

To: Liu, Peter
Cc: sakai-dev at collab.sakaiproject.org<mailto:sakai-dev at collab.sakaiproject.org>
Subject: Re: [Building Sakai] crashes on KnowledgeBase tool

Hi Peter,

I took some time to fetch a sakai 2.6.3 and get the KB working. I've ran into 2 issues:

1) JDK 1.5 does not contain the stax stuff, and there seems to be some classloading issues. So I used the strategy from the 2.5 version of the KB tool to deploy stax-api and stax to shared.

2) The spring dependency structure has changed, sakai 2.7 uses the 2.5 spring fragmented jar structure, whereas spring 2.0 used a single jar containing all.

The 2.6 version is available at:

https://source.sakaiproject.org/contrib/edia/knowledgebase/branches/sakai-2.6.x/

I also updated the installation guide:

https://confluence.sakaiproject.org/display/KBT/Installation+and+Setup+Guide

With kind regards,

--
Roland M.S. Groen
roland at edia.nl<mailto:roland at edia.nl>

Edia - Educatie Technologie
Korte Prinsengracht 42 hs | 1013 GT Amsterdam
T 020 716 36 12 | F 020 716 36 13 | M 06 2423 09 06 | www.edia.nl<http://www.edia.nl/>

2011/6/30 Liu, Peter <peter.liu at yale.edu<mailto:peter.liu at yale.edu>>
Roland,

Thanks for the prompt response.  I have tried to add the ‘stax’ dependence into the impl pom.xml and it is still not working with java 5 for sakai 2.6.  Actually, it has no problem to compile the tool under java 5 even without the ‘stax’ dependence.

I also have another question: is this tool requiring Spring 2.5?  I have tried to run the tool by using java 6 for sakai 2.6 and it gives me the following error (However, the tool shows up in application and it crashes when you click the tool to the first page).  Sakai-2.6 is running on spring 2.0.6 version.

Any suggestion?

Thanks a lot!
Peter Liu

- - - - - - - - - - - - - -Error - - - - - -
2011-06-29 22:17:52,744  INFO main org.apache.catalina.startup.HostConfig - Deploying web application archive edia-sakai-knowledgebase-tool.war
2011-06-29 22:17:57,278  INFO main org.sakaiproject.util.ToolListener - registering tools from resource: /tools/edia.sakai.knowledgebase.xml
2011-06-29 22:17:57,289  INFO main org.sakaiproject.util.ToolListener - registering tools from resource: /tools/edia.sakai.knowledgebase.help.xml
2011-06-29 22:17:57,296  INFO main org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/edia-sakai-knowledgebase-tool] - Initializing Spring root WebApplicationContext
2011-06-29 22:17:57,347 ERROR main org.springframework.web.context.ContextLoader - Context initialization failed
org.springframework.context.ApplicationContextException: Custom context class [org.springframework.web.context.support.XmlWebApplicationContext] is not of type [org.springframework.web.context.ConfigurableWebApplicationContext]
               at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:230)
               at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:187)
               at org.sakaiproject.component.impl.ContextLoader.initWebApplicationContext(ContextLoader.java:64)
               at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
               at org.sakaiproject.util.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:56)
               at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3764)
               at org.apache.catalina.core.StandardContext.start(StandardContext.java:4216)
               at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
               at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
               at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
               at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:831)
               at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:720)
               at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:490)
               at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
               at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
               at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
               at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)
               at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
               at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
               at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
               at org.apache.catalina.core.StandardService.start(StandardService.java:448)
               at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
               at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
               at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
               at java.lang.reflect.Method.invoke(Method.java:597)
               at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
               at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
2011-06-29 22:17:57,371 ERROR main org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/edia-sakai-knowledgebase-tool] - Exception sending context initialized event to listener instance of class org.sakaiproject.util.ContextLoaderListener
org.springframework.context.ApplicationContextException: Custom context class [org.springframework.web.context.support.XmlWebApplicationContext] is not of type [org.springframework.web.context.ConfigurableWebApplicationContext]
               at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:230)
               at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:187)


From: Roland Groen [mailto:roland at edia.nl<mailto:roland at edia.nl>]
Sent: Wednesday, June 29, 2011 5:17 PM
To: Liu, Peter
Cc: sakai-dev at collab.sakaiproject.org<mailto:sakai-dev at collab.sakaiproject.org>
Subject: Re: [Building Sakai] crashes on KnowledgeBase tool

Hi Peter,

I've done some testing and it appears it is a JDK issue in relation to the stax api. Sakai 2.7+ runs on JDK 1.6 which includes a stax parser, JDK 1.5 does not. I've created a test class:


import javax.xml.stream.XMLInputFactory;



public class StaxTest {

           public static void main(String[] args) {

                      XMLInputFactory factory = XMLInputFactory.newInstance();

                      System.out.println(factory.toString());

    }

}


If I run and compile this with JDK 1.6 I get:



# export JAVA_HOME=/usr/java/jdk1.6.0_21/
# export PATH=$JAVA_HOME/bin:$PATH
# javac StaxTest.java
# java StaxTest
com.sun.xml.internal.stream.XMLInputFactoryImpl at 45bab50a

If I switch to JDK 1.5 I need the stax-api, otherwise it won't compile:

# export JAVA_HOME=/usr/java/jdk1.5.0_19/
# export PATH=$JAVA_HOME/bin:$PATH
# javac -classpath stax-api-1.0.1.jar  StaxTest.java
# java -classpath stax-api-1.0.1.jar:.  StaxTest
Exception in thread "main" javax.xml.stream.FactoryConfigurationError: Provider com.bea.xml.stream.MXParserFactory not found
     at javax.xml.stream.FactoryFinder.newInstance(FactoryFinder.java:72)
     at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:178)
     at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:92)
     at javax.xml.stream.XMLInputFactory.newInstance(XMLInputFactory.java:136)
     at StaxTest.main(StaxTest.java:6)


Now I get the same error as you do. It turns out that it needs a stax implementation. You pointed to sjsxp:

# java -classpath stax-api-1.0.1.jar:sjsxp-1.0.1.jar:.  StaxTest
com.sun.xml.stream.ZephyrParserFactory at 768965fb

But there is also stax itself:

[root at kantoor ~]# java -classpath stax-api-1.0.1.jar:stax-1.2.0.jar:.  StaxTest
com.bea.xml.stream.MXParserFactory at 3e7ffe01

This issue can be resolved by adding one of both to the pom.xml of the impl/pom.xm file. I'd personally go for stax:




<dependency>

    <groupId>stax</groupId>

    <artifactId>stax</artifactId>

    <version>1.2.0</version>

</dependency>

Please let me know if this works for you. If it does, I'll create a 2.6 branch and add the dependency to the impl/pom.xml

With kind regards,

--
Roland M.S. Groen
roland at edia.nl<mailto:roland at edia.nl>

Edia - Educatie Technologie
Korte Prinsengracht 42 hs | 1013 GT Amsterdam
T 020 716 36 12 | F 020 716 36 13 | M 06 2423 09 06 | www.edia.nl<http://www.edia.nl/>

2011/6/29 Liu, Peter <peter.liu at yale.edu<mailto:peter.liu at yale.edu>>
Hi Roland,

I am very interesting on your Sakai-Contrib tool: Knowledgebase and I am trying to plugging into our Sakai 2-6-x instance.

I have downloaded your 2.7.x version and have successfully built it for Sakai-2-6-x version after modifying the pom.xml file.

However, it crashes on the tomcat 5.5.26 when I am trying to run it in Sakai 2.6.x.  The following error is shown in the log file below.

It seems that it look for sjsxp.jar, which is missing.  Do you have any idea how to solve it?

Thanks a lot!
Peter Liu

Yale University, New Haven, CT



- - - - - - - - -  - Error message  - - - - - - - -  -
2011-06-29 19:20:21,775  INFO main org.apache.solr.request.XSLTResponseWriter - xsltCacheLifetimeSeconds=5
2011-06-29 19:20:21,853  INFO main org.apache.solr.core.RequestHandlers - created standard: solr.SearchHandler
2011-06-29 19:20:21,854  INFO main org.apache.solr.core.RequestHandlers - created dismax: solr.SearchHandler
2011-06-29 19:20:21,854  INFO main org.apache.solr.core.RequestHandlers - created partitioned: solr.SearchHandler
2011-06-29 19:20:21,854  INFO main org.apache.solr.core.RequestHandlers - created /spellCheckCompRH: solr.SearchHandler
2011-06-29 19:20:21,866 ERROR main org.sakaiproject.util.NoisierDefaultListableBeanFactory - Failed to preinstantiate the singleton named nl.edia.knowledgebase.dao.KnowledgeBaseDaoTarget. Destroying all Spring beans.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'nl.edia.knowledgebase.dao.KnowledgeBaseDaoTarget' defined in URL [jar:file:C:/tomcat-5.5.26-sakai26/components/edia-sakai-knowledgebase-pack/WEB-INF/lib/edia-sakai-knowledgebase-impl-0.1.jar!/nl/edia/knowledgebase/dao/kb-hibernate.xml]: Cannot resolve reference to bean 'nl.edia.knowledgebase.logic.SearchService' while setting bean property 'searchService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'nl.edia.knowledgebase.logic.SearchService' defined in URL [jar:file:C:/tomcat-5.5.26-sakai26/components/edia-sakai-knowledgebase-pack/WEB-INF/lib/edia-sakai-knowledgebase-impl-0.1.jar!/nl/edia/knowledgebase/logic/kb-services.xml]: Invocation of init method failed; nested exception is javax.xml.stream.FactoryConfigurationError: Provider com.bea.xml.stream.MXParserFactory not found
Caused by:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'nl.edia.knowledgebase.logic.SearchService' defined in URL [jar:file:C:/tomcat-5.5.26-sakai26/components/edia-sakai-knowledgebase-pack/WEB-INF/lib/edia-sakai-knowledgebase-impl-0.1.jar!/nl/edia/knowledgebase/logic/kb-services.xml]: Invocation of init method failed; nested exception is javax.xml.stream.FactoryConfigurationError: Provider com.bea.xml.stream.MXParserFactory not found
Caused by:
javax.xml.stream.FactoryConfigurationError: Provider com.bea.xml.stream.MXParserFactory not found
      at javax.xml.stream.FactoryFinder.newInstance(FactoryFinder.java:72)
      at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:178)
      at javax.xml.stream.FactoryFinder.find(FactoryFinder.java:92)
      at javax.xml.stream.XMLInputFactory.newInstance(XMLInputFactory.java:136)
      at org.apache.solr.handler.XmlUpdateRequestHandler.init(XmlUpdateRequestHandler.java:82)
      at org.apache.solr.core.RequestHandlers.initHandlersFromConfig(RequestHandlers.java:158)
      at org.apache.solr.core.SolrCore.<init>(SolrCore.java:556)
      at org.apache.solr.core.CoreContainer.create(CoreContainer.java:428)
      at nl.edia.knowledgebase.logic.SearchServiceImpl.init(SearchServiceImpl.java:272)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1240)


_______________________________________________
sakai-dev mailing list
sakai-dev at collab.sakaiproject.org<mailto:sakai-dev at collab.sakaiproject.org>
http://collab.sakaiproject.org/mailman/listinfo/sakai-dev

TO UNSUBSCRIBE: send email to sakai-dev-unsubscribe at collab.sakaiproject.org<mailto:sakai-dev-unsubscribe at collab.sakaiproject.org> with a subject of "unsubscribe"



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20110630/4e9a4a07/attachment.html 


More information about the sakai-dev mailing list