Karaf: Missing classes from my own jar - maven

I created an OSGi bundle using the camel-archetype-blueprint maven archetype. I then tried to install this into Karaf, but the bundle is going into GracePeriod. After running diag, it's missing a dependency that is inside the jar file itself.
Ok, the long version:
The jar file generated from the archetype contains the Hello and HelloBean classes that are included from the archetype:
$ jar tvf myproject-1.0-SNAPSHOT.jar
455 Tue Jul 26 11:25:10 UTC 2016 META-INF/MANIFEST.MF
0 Tue Jul 26 11:25:10 UTC 2016 META-INF/
0 Tue Jul 26 11:25:10 UTC 2016 META-INF/maven/
0 Tue Jul 26 11:25:10 UTC 2016 META-INF/maven/com.petewall/
0 Tue Jul 26 11:25:10 UTC 2016 META-INF/maven/com.petewall/myproject/
143 Tue Jul 26 11:25:10 UTC 2016 META-INF/maven/com.petewall/myproject/pom.properties
3418 Tue Jul 26 11:25:06 UTC 2016 META-INF/maven/com.petewall/myproject/pom.xml
0 Tue Jul 26 11:25:10 UTC 2016 OSGI-INF/
0 Tue Jul 26 11:25:10 UTC 2016 OSGI-INF/blueprint/
1376 Tue Jul 26 11:20:12 UTC 2016 OSGI-INF/blueprint/blueprint-bean.xml
961 Tue Jul 26 11:20:12 UTC 2016 OSGI-INF/blueprint/blueprint-service.xml
0 Tue Jul 26 11:25:10 UTC 2016 com/
0 Tue Jul 26 11:25:10 UTC 2016 com/petewall/
143 Tue Jul 26 11:24:56 UTC 2016 com/petewall/Hello.class
1022 Tue Jul 26 11:24:56 UTC 2016 com/petewall/HelloBean.class
676 Tue Jul 26 11:20:12 UTC 2016 log4j.properties
I dropped this jar file into the deploy directory of my karaf instance. The bundle is installed and listed in the bundle:list command. However, when the bundle starts, it goes into GracePeriod. Diagnosing it shows that it's missing a dependency:
karaf#root()> bundle:diag 98
Camel Blueprint Route (98)
--------------------------
Status: GracePeriod
Blueprint
7/26/16 6:26 PM
Missing dependencies:
(objectClass=com.petewall.Hello)
However, those classes are even found using karaf's exports command:
karaf#root()> exports
Package Name | Version | ID | Bundle Name
-----------------------------------------------------------------------------
...
com.petewall | 1.0.0.SNAPSHOT | 98 | myproject
...
And the classes command:
karaf#root()> classes
...
com/petewall/Hello.class
com/petewall/HelloBean.class
I'm very new to all of these technologies (Karaf, Camel, OSGi, etc...), so I'm sure I'm missing something. Please, can someone point me in the right direction here?
UPDATE 1:
The archetype generates two XML files which seem to define the blueprint service and bean.
blueprint-bean.xml:
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="..." xmlns:xsi="..." xmlns:cm="..." xsi:schemaLocation="...">
<cm:property-placeholder persistent-id="HelloBean" update-strategy="reload">
<cm:default-properties>
<cm:property name="greeting" value="Hi from Camel" />
</cm:default-properties>
</cm:property-placeholder>
<bean id="helloBean" class="com.petewall.HelloBean">
<property name="say" value="${greeting}"/>
</bean>
<camelContext id="blueprint-bean-context" xmlns="http://camel.apache.org/schema/blueprint">
<route id="timerToLog">
<from uri="timer:foo?period=5000"/>
<setBody>
<method ref="helloBean" method="hello"/>
</setBody>
<log message="The message contains ${body}"/>
<to uri="mock:result"/>
</route>
</camelContext>
</blueprint>
blueprint-service.xml:
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="..." xmlns:xsi="..." xmlns:cm="..." xsi:schemaLocation="...">
<reference id="helloService" interface="com.petewall.Hello" />
<camelContext id="blueprint-service-context" xmlns="http://camel.apache.org/schema/blueprint">
<route id="timerToLog">
<from uri="timer:foo?period=5000"/>
<setBody>
<method ref="helloService" method="hello"/>
</setBody>
<log message="The message contains ${body}"/>
<to uri="mock:result"/>
</route>
</camelContext>
</blueprint>
The archetype generates an interface, Hello, that defines one method: String hello(). The HelloBean class implements that interface and uses a private String say parameter to change what the hello() method prints.

What Blueprint reports as a "missing dependency" is actually a missing OSGi Service.
It's difficult to be sure because you haven't posted your Blueprint XML, but the error message strongly suggests this. You probably have a <reference> element in there which refers to the com.petewall.Hello service.
Does any bundle provide an instance of com.petewall.Hello as a service? Note that the presence of a class file in your bundle with this name is irrelevant. Perhaps you have this the wrong way around, and your bundle should be providing the service? Can you explain a bit more about what you're trying to do, from a high level?

The archetype seems to have created two different styles of calling a method on a bean.
The first blueprint defines the HelloBean locally and calls a method on it. This would be able to run on its own. It does not publish any OSGi services though.
The second blueprint references an OSGi service and calls a method on it. This will not be able to start unless you install a bundle that exports a service with that interface.
All blueprint xmls of a bundle are merged together into one blueprint context. So the merged blueprint context will only start once there is HelloBean service present in your runtime.
Try to omit the second blueprint.xml and your bundle should start fine.

Related

how to display date and time in tomcat catalina.out log file

I need to display the date and time of actual log info within the catalina.out log file for my tomcat7 installation. From the web I found the solution of adding this line to the logging.properties file, but it does not work. I added the following:
1catalina.java.util.logging.SimpleFormatter.format=[%1$td.%1$tm.%1$tY %1$tH:%1$tM:%1$tS,%1$tL
Right now its just a bunch of data that has zero timestamps. I just want the standard yyyymmdd hhmmss that precedes the INFO or ERROR, etc. in the log output.
what is present right now in my logging.properties file is this (I added the last line obviously):
java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
1catalina.java.util.logging.SimpleFormatter.format=[%1$td.%1$tm.%1$tY %1$tH:%1$tM:%1$tS,%1$tL
The version I'm using is apache-tomcat-7.0.82.
Any help you can provide would be great, and thank you in advance.
This is what worked for me on Tomcat 7.0.99:
...
java.util.logging.ConsoleHandler.level = FINE
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
java.util.logging.ConsoleHandler.encoding = UTF-8
# My special format:
java.util.logging.SimpleFormatter.format=%1$tF %1$tT [%4$-7s] %5$s %n
...
The first three lines are out of the box default settings. Just the last line defines SimpleFormatter. Logfile looks like this:
2020-02-03 11:55:26 [INFORMATION] Loaded APR based Apache Tomcat Native library [1.2.23] using APR version [1.7.0].
2020-02-03 11:55:26 [INFORMATION] APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
2020-02-03 11:55:26 [INFORMATION] OpenSSL successfully initialized [OpenSSL 1.1.1c 28 May 2019]
2020-02-03 11:55:26 [INFORMATION] Initialisiere ProtocolHandler["http-apr-8080"]
2020-02-03 11:55:26 [INFORMATION] Initialisiere ProtocolHandler["ajp-apr-8009"]
2020-02-03 11:55:26 [INFORMATION] Initialization processed in 368 ms
2020-02-03 11:55:26 [INFORMATION] Starting service [Catalina]
2020-02-03 11:55:26 [INFORMATION] Starting Servlet Engine: Apache Tomcat/7.0.99
For more information regarding SimpleFormatter see: Oracle Java Documentation - SimpleFormatter and for Formatter see: Oracle Java Documentation - Formatter.
You can even change Tomcat logging to log4j (see: Tomcat - Using_Log4j) but that needs some more effort and would be an overkill for my simple use case.

Upgrade JDK1.5 to 1.8 on EA Server 5.5

I'm using EAServer 5.5 on Windows7 and the server is running with JDK 1.5
Now I want to UpGrade JDK1.5 to 1.8. Can you please some one help me.
I am getting the following error.
DynamicLibrary::lookup: af_dll_lookup (libjjdk12.dll, new_JagComponent) failed (libjdispatch) (Y:\calm\conn\itg\jagsrv\generic\dispatch\DynamicLibrary.cc#80)
000095 Tue Jul 21 12:50:32 2015 E [018286] CTS_JagComponent::load: failed to load component model library (libjdispatch) (Y:\calm\conn\itg\jagsrv\generic\dispatch\CTS_JagComponent.cc#841)
000096 Tue Jul 21 12:50:32 2015 E [018918] CTS_Component::load: failed for component 'Jaguar/Repository' (libjdispatch) (Y:\calm\conn\itg\jagsrv\generic\dispatch\CTS_Component.cc#1993)
000097 Tue Jul 21 12:50:32 2015 A [099999] SystemException: OBJECT_NOT_EXIST (CosNaming/NamingContext/resolve - #0.0.0.0) (libjdispatch) (Y:\calm\conn\itg\jagsrv\generic\dispatch\CTS_Object.cc#3995)
000098 Tue Jul 21 12:50:32 2015 E [018532] Exception 'CORBA::OBJECT_NOT_EXIST' in Session::create for component 'Jaguar/Repository' (libjdispatch) (Y:\calm\conn\itg\jagsrv\generic\dispatch\Session.cc#1029)
000099 Tue Jul 21 12:50:32 2015 A [099999] SystemException: OBJECT_NOT_EXIST (Session/create - #0.0.0.0) (libjdispatch) (Y:\calm\conn\itg\jagsrv\generic\dispatch\CTS_Object.cc#3995)
000100 Tue Jul 21 12:50:32 2015 A [099999] new_JagObjectRef: Bad URL - Jaguar/Repository (libjdispatch.iiop) (Y:\calm\conn\itg\jagsrv\generic\cc\JagORB.c#1074)
000101 Tue Jul 21 12:50:32 2015 E [018480] SEVERE ERROR - failed to access Jaguar Repository (libjdispatch.repository) (Y:\calm\conn\itg\jagsrv\generic\dispatch\Repository.cc#114)
000102 Tue Jul 21 12:50:32 2015 E [018488] Warning: failed to lookup properties for Package'CosNaming'(CORBA::INV_OBJREF) (libjdispatch.repository) (Y:\calm\conn\itg\jagsrv\generic\dispatch\Repository.cc#187)
000103 Tue Jul 21 12:50:32 2015 E [018477] Missing value for Component 'CosNaming/NamingContext' property 'com.sybase.jaguar.component.type' (sybase.eas.global) (Y:\calm\conn\itg\jagsrv\generic\dispatch\Properties.cc#151)
000104 Tue Jul 21 12:50:32 2015 E [018918] CTS_Component::load: failed for component 'CosNaming/NamingContext' (libjdispatch) (Y:\calm\conn\itg\jagsrv\generic\dispatch\CTS_Component.cc#1993)
000105 Tue Jul 21 12:50:32 2015 A [099999] SystemException: OBJECT_NOT_EXIST (CosNaming/NamingContext/resolve - #0.0.0.0) (libjdispatch) (Y:\calm\conn\itg\jagsrv\generic\dispatch\CTS_Object.cc#3995)
000106 Tue Jul 21 12:50:32 2015 E [018532] Exception 'CORBA::OBJECT_NOT_EXIST' in Session::create for component 'Jaguar/JavaInit' (libjdispatch) (Y:\calm\conn\itg\jagsrv\generic\dispatch\Session.cc#1029)
000107 Tue Jul 21 12:50:32 2015 A [099999] SystemException: OBJECT_NOT_EXIST (Session/create - #0.0.0.0) (libjdispatch) (Y:\calm\conn\itg\jagsrv\generic\dispatch\CTS_Object.cc#3995)
000108 Tue Jul 21 12:50:32 2015 A [099999] new_JagObjectRef: Bad URL - Jaguar/JavaInit (libjdispatch.iiop) (Y:\calm\conn\itg\jagsrv\generic\cc\JagORB.c#1074)
000109 Tue Jul 21 12:50:32 2015 F [018506] SEVERE ERROR - failed to access Jaguar/JavaInit (libjdispatch) (Y:\calm\conn\itg\jagsrv\generic\dispatch\Server.cc#418)
I don't think this is possible or recommended.
OP was asking for upgrading Java (inside) used by EAServer (app server like JBoss, but for PowerBuilder+Java). Most of the Java classes inside EAServer were compiled to Java 1.2 and support only up to Java 1.5. I recently tried to upgrade my EAS 5.5 to JDK 1.6. This caused above issues you mentioned.
Several things are at play here:
Deprecated Java classes, methods, models.
JDBC interface itself is different now. For Oracle, I had to use OJBC6 and that breaks with older databases.
In the end, decided to simply upgrade JDK to 1.5.0_22, max build for 1.5 (Sybase's own limit was 1.5.0_03).
That said, if you still want to try, you will have to update a few batch files (I am assuming you are on windows) in \bin.
You may have to install/copy the JDK inside Sybase\Shared
folder, so you can customize, if needed.
You will need to add new JDK entries into setenv.bat and
serverstart.bat. Basically, current batches are agnostic about the
new JDK versions you are introducing to the EAServer.
You may have to update user_setenv.bat to customize JDBC/classpaths.
You may also have to generate batch file for Jaguar Manager and
change Java directory used to launch it.
It didn't work for me. But, if you are able to make it to work, can you please post back with your suggestions here?
Sorry for the late reply. Been busy with a project. Are you still having the problem? That essentially says the service did not start. Did you look at the Jaguar.log?
I suggest, you start it using the batch file first -
\EAServer\bin\serverstart.bat -jdk18
I hope you have added jdk18 options in the batch files. And watch the below logs:
Jaguarout.log, Jaguar_performance.log (if found), Jaguar.log
Once you get it to work, then you can use Serverstart with -install option to start as a service.
I just want to reiterate, that even if you get it to start, you may have issues with connection caches (particularly JDBC) and other interfaces as the specifications changed a lot since Java 1.4. If you are getting issues there, you will have to update the OJDBC driver etc. Good luck!

Not a Valid Jar When Running Hadoop Job

I want to run WordCount Example.
In eclipse it run correctly. In output folder the output file is present.
I made a jar file of WordCount and want to run it through command
hadoop jar WordCount.jar /Projects/input /Projects/output
it gives me error
Not a valid JAR: /Projects/WordCount.jar
result of hdfs dfs -ls /Projects
Found 3 items
-rw-r--r-- 1 hduser supergroup 3418 2014-11-02 15:38 /Projects/WordCount.jar
drwxr-xr-x - hduser supergroup 0 2014-11-02 14:13 /Projects/input
drwxr-xr-x - hduser supergroup 0 2014-11-02 14:16 /Projects/output
it gives me same error on this also
hadoop jar /Projects/WordCount.jar wordPackage.WordCount /Projects/input /Projects/output
Not a valid JAR: /Projects/WordCount.jar
how to solve this error.
I have run tvf command it gives this output
jar -tvf /home/hduser/Desktop/Files/WordCount.jar
60 Sun Nov 02 16:10:10 PKT 2014 META-INF/MANIFEST.MF
1895 Sun Nov 02 14:02:38 PKT 2014 wordPackage/WordCount.class
1295 Sun Nov 02 14:02:38 PKT 2014 wordPackage/WordCount.java
2388 Sun Nov 02 14:02:06 PKT 2014 wordPackage/WordReducer.class
707 Sun Nov 02 14:02:06 PKT 2014 wordPackage/WordReducer.java
2203 Sun Nov 02 14:02:08 PKT 2014 wordPackage/WordMapper.class
713 Sun Nov 02 14:02:06 PKT 2014 wordPackage/WordMapper.java
16424 Sun Nov 02 13:50:00 PKT 2014 .classpath
420 Sun Nov 02 13:50:00 PKT 2014 .project
You cannot keep the jar in HDFS when executing the same using hadoop command, Jar should be available in the local path
If the jar is not runnable try the following (Need to specify the package.mainclass)
hadoop jar /home/hduser/Desktop/Files/WordCount.jar wordPackage.WordCount /Projects/input /Projects/output
If the jar is runnable following can be used
hadoop jar /home/hduser/Desktop/Files/WordCount.jar /Projects/input /Projects/output
If the issue still persists, you need to rebuild this jar(WordCount.jar) in eclipse again
in spite of rebuilding your jar again if issue still persists, Please make sure you have given +x(execution chmod 755) privileges before you run the command. in my case this was the reason for the issue.
command help:
chmod +x jarname.jar
I faced the same issue. But in my case what I did was I wrote the java code referring to hadoop 1.x libraries and tried to execute it using 2.x. Initially, I got the same error in the terminal. Then I tried navigating to the path where I had my jar file. It worked.
May be you can actually try the following:(after navigating to the jar files path)
hadoop jar WordCount.jar wordPackage.WordCount /Projects/input /Projects/output

Writing jsp tag library

I am using MVC model in which I am writing too many web based widgets for the different different application, which cause lot of repetitive work for me to resolve the problem I am planning to write the new package for the jsp tags for each widgets(using tld) and the generated jar I will include in lots of application which use those widgets and I am successfully able to that also.
But here I am bit concerned about the css and javascript, which is used by the widget.
let say I write css in jsp tag itself in library then in that case, it fetch css and script every time which incurs extra latency, in case if I write common css at client side then for the multiple applications which use my widget package need to write css again and again ?
The jar for widget which I included in my MVC project.
jar -tvf AcmeUIUtils-1.0.jar
0 Fri Dec 07 07:41:56 IST 2012 META-INF/
106 Fri Dec 07 07:41:54 IST 2012 META-INF/MANIFEST.MF
0 Fri Dec 07 15:54:40 IST 2012 com/
0 Fri Dec 07 15:54:40 IST 2012 com/amazon/
0 Fri Dec 07 15:54:40 IST 2012 com/amazon/spotui/
0 Fri Dec 07 15:54:40 IST 2012 com/amazon/spotui/basicui/
2339 Fri Dec 07 02:11:38 IST 2012 com/amazon/spotui/basicui/AcmeMessage.class
1684 Fri Dec 07 15:54:40 IST 2012 com/amazon/spotui/basicui/Ping.class
0 Fri Dec 07 15:54:40 IST 2012 com/amazon/spotui/utils/
2989 Fri Dec 07 15:54:40 IST 2012 com/amazon/spotui/utils/AcmeTags.class
0 Fri Dec 07 07:41:40 IST 2012 META-INF/css/
635 Fri Dec 07 07:40:14 IST 2012 META-INF/css/error.css
1059 Fri Dec 07 14:47:20 IST 2012 META-INF/spot-ui-component.tld
0 Fri Dec 07 15:54:40 IST 2012 test-resources/
Now my question is that how to load error.css in my application in elegant way ? or do I need to made changes at the widget level ?
I don't mind any opensource solution for the problem. But I need jsp tags only.
Since servlet 3.0, a jar file placed under WEB-INF/lib can contain resources that will be served directly by the webapp. These resources must be placed under the META-INF/resources directory of the jar file.
So if your tag library jar contains a file META-INF/resources/js/MyTaglib.js, this file will be directly available using the URL
http://the.host.com/theWebApp/js/MyTaglib.js
If you're targetting pre-servlet3.0 webapps, then tell the developers to deploy the CSS and JS files of your taglib under a specific directory in the webapp.

ClassNotFoundException with Spring 3.1 and Tomcat 7

I have found similar questions on StackOverflow, but not quite the same as mine:
I've configured a Spring bean 'ontologyClient' that is a POJO that I have imported from a library which is added to my Maven dependencies. I have checked and double checked that the produced WAR file contains the org.erasmusmc.ontology.OntologyClient class. However, when Spring wants to instantiate the bean, Tomcat's classloader throws a ClassNotFoundException. I am out of ideas, hopefully somebody can help me out!
applicationContext.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.1.xsd">
<context:component-scan base-package="nl.lumc.conceptrecognizer" />
<context:component-scan base-package="org.nbic.interop.conceptlinker.service.impl" />
<bean class="org.springframework.remoting.jaxws.SimpleJaxWsServiceExporter">
<property name="baseAddress" value="http://localhost:8080/" />
</bean>
<bean id="ontologyClient" class="org.erasmusmc.ontology.OntologyClient">
<constructor-arg index="0" value="localhost" />
<constructor-arg index="1" value="abcde"/>
<constructor-arg index="2" value="abcde" />
<constructor-arg index="3" value="Anni2_1_june2009" />
</bean>
<bean id="conceptRecognizerService"
class="nl.lumc.conceptrecognizer.services.ConceptRecognizerService"
p:ontologyClient-ref="ontologyClient"
/>
</beans>
Tomcat log:
Using CATALINA_BASE: /usr/local/apache-tomcat-7.0.22
Using CATALINA_HOME: /usr/local/apache-tomcat-7.0.22
Using CATALINA_TMPDIR: /usr/local/apache-tomcat-7.0.22/temp
Using JRE_HOME: /usr/java/jdk1.7.0
Using CLASSPATH: /usr/local/apache-tomcat-7.0.22/bin/bootstrap.jar:/usr/local/apache-tomcat-7.0.22/bin/tomcat-juli.jar
feb 20, 2012 7:56:13 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
feb 20, 2012 7:56:13 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-7080"]
feb 20, 2012 7:56:13 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
feb 20, 2012 7:56:13 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 673 ms
feb 20, 2012 7:56:14 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
feb 20, 2012 7:56:14 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.22
feb 20, 2012 7:56:14 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor ROOT.xml from /usr/local/apache-tomcat-7.0.22/conf/Catalina/localhost
feb 20, 2012 7:56:14 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization started
feb 20, 2012 7:56:14 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing Root WebApplicationContext: startup date [Mon Feb 20 19:56:14 CET 2012]; root of context hierarchy
feb 20, 2012 7:56:14 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
feb 20, 2012 7:56:15 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory#7b6d63d5: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,ontologyClient,groundhogManager,conceptProfilesGroundhog,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0]; root of factory hierarchy
feb 20, 2012 7:56:15 PM org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons
INFO: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory#7b6d63d5: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,ontologyClient,groundhogManager,conceptProfilesGroundhog,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0]; root of factory hierarchy
feb 20, 2012 7:56:15 PM org.springframework.web.context.ContextLoader initWebApplicationContext
SEVERE: Context initialization failed
org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.erasmusmc.ontology.OntologyClient] for bean with name 'ontologyClient' defined in ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: org.erasmusmc.ontology.OntologyClient
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1262)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:576)
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1331)
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:897)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:566)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:384)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4723)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5226)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5221)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.ClassNotFoundException: org.erasmusmc.ontology.OntologyClient
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1678)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1523)
at org.springframework.util.ClassUtils.forName(ClassUtils.java:257)
at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:417)
at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1283)
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1254)
... 17 more
One thing to note is that the ontology dependency is a locally installed Maven artifact. However I don't see how this could be the cause, because the required Jar file is copied to WEB-INF/lib like it should.
UPDATE: It turns out that Tomcat was launching the wrong codebase. I had renamed my webapp because I started a new branch, but context.xml still pointed to the old context.
This is maybe a stupid answer, but did you remove the unzipped war before you copied the new one? Maybe the previous version of your was did not have the OntologyClient class.
I have checked and double checked that the produced WAR file contains the org.erasmusmc.ontology.OntologyClient class
Is the class inside a .jar file? if so, what is the location relative to the WAR.
Are there any other .class or .jar files inside the same directory?

Resources