May 21, 2012

Spring JDBC or hibernate?

Just trying to decide whether to go for Spring JDBC or hibernate for my new project (WAS).


What I like about Spring JDBC:

1. you can do the SQL development in SQL Developer, trying different queries, before encoding it

2. quite simple to use - you just need a RowMapper class to get your query into a POJO.

3. Easy to debug, at least in development - you can just grab the SQL queries in the debugger and run them

4. can be configured using JNDI (but think hibernate can too)

5. don't need to generate the SQL queries on the fly, so some efficiency saving


Reasons to try hibernate:

1. other projects use it, so it would be good to become more familiar

2. this app is not working from a legacy database and has its own simple database structure, so there should be a straightforward mapping between the db and POJOs

3. can I use hibernate to actually generate the db tables?

4. can set up logging across the board rather than needing to log every query

5. hibernate may have other efficiency wins - for instance if you roll back the update never occurs at all. (Can't think of a case in my app where this might happen though.)

Things to remember

1. A file like persistance.xml in evision-interface needs creating, wiring in and keeping up to date

2. The hbm.xml files needs creating, wiring in and keeping up to date for each object

3. hibernate properties, like show.sql, might need to be put in the properties file and accessed in some way through the app


May 18, 2012

Messing about with jars

Here's a weird thing -

Using @Valid, my code all seemed to resolve OK in STS, and the line "import javax.validation.Valid" got inserted in my controller when I did Ctrl-Shift-O. So far so good. But when I did an ant build, I got:

package javax.validation does not exist

According to the SpringSource Enterprise Bundle Repository, javax.validation.Valid is in com.springsource.javax.validation-1.0.0.GA.jar. I copied that into my lib folder and then could compile.

This must mean that Eclipse had access to the jar (or another) somewhere before I copied it but ant didn't. That does appear to be the case - on the "Libraries" tab under "Java Build Path" for the project properties, there is a set of jars labeled "Java EE 6 libraries" which includes lots of things including something called bean-validator.jar within the Genuitec directory. That jar does indeed include javax.validation.Valid.

Having added the jar and compiled successfully I get this error on deploying:

javax.validation.ValidationException: Unable to find a default provider

It can't be good to have libraries that Eclipse has on my project build path that aren't in my project to be deployed.

Just taken the plunge and deleted "Java EE 6 Libraries" from the Java Build Path: Libraries list. That's interesting - javax.validation.Valid is still found, but the rather crucial HttpServletRequest is not.

Wouldn't it be great if you could click on an import class in Eclipse and find out what jar it was being resolved from?

Tomcat should be able to find HttpServletRequest as it's in servlet-api.jar in ~tomcat/lib. To make the environments the same, I've included all the jars in that directory in my project build path. But now it's showing up red (Eclipse can't find it) *and* won't build (Ant can't find it). Oops, forgot to do Ctrl-Shift-O - builds now.

Still get:

javax.validation.ValidationException: Unable to find a default provider

Googling suggests I go for org.hibernate.validator.HibernateValidator, so I've included that - and now it builds *and* deploys.

Next time it would be a good idea to set the tomcat lib dir up on the build path before throwing in other ad hoc jars - maybe some aren't actually needed.


October 26, 2011

FOP 1.0 Implementation

Follow-up to UTF–8 encoding for java apps from Has Beans

FOP Migration to 1.0

There were several drawbacks of FOP 0.20.5 as specified here - http://blogs.warwick.ac.uk/hasbeans/entry/utf-8_encoding_for/ (see drawback section ). One of the drawbacks was that you couldn't copy/search PDF contents that was generated based on FOP template tag fo:block if it included attribute font-family. This seems to work fine in FOP 1.0. However, we can't display all characters if they are from different font list.

Example -ϗϚϛϕϜय़ṏ-ţ contains characters from ArialUnicodeMS and Calibri (6th character य़ appear only in ArialUnicodeMS but 1st and 3rd character are just in Calibri font). When multiple fonts are provided to FOP 1.0 template file, it picks up the font where most of the characters match. This is based on font-selection-strategy attribute which by default is set to "auto" - (font-selection-strategy="auto"). It seems if we set this as-

font-selection-strategy="character-by-character" it will then look for fonts in all the fonts that are registered through userConfig file. This doesn't seem to be implemented yet in FOP 1.0 (http://xmlgraphics.apache.org/fop/compliance.html#fo-property-commonfont-section or http://xmlgraphics.apache.org/fop/1.0/fonts.html#selection)


Example -

font-family="A, B" assume A can display xy, B can display yz.

xxx -> A  (font A used)
yyy -> A zzz -> B
xzzz -> B


In the live scenario you would not have a name that has greek and italain/indian character together so hopefully you will come accross fonts that are available in one of the fonts (either ArialUnicodeMS or Calibri)

If you want to embed the fonts (helpful if someone can't print characters because fonts are not available on the local system) setting should be as in userconfig file:

Example -

<font embed-url="C:\Jakarta\jakarta-tomcat-5.5.23\shared\classes\fonts\calibri.ttf">
<font-triplet name="Calibri" style="normal" weight="normal" />
</font>


If you want fonts to be uploaded from a specific directory for PDF generation then use setting similar to this-

<directory>c:\Jakarta\jakarta-tomcat-5.5.23\shared\classes\fonts</directory>

You can also combine the above two settings: upload some fonts from a particular directory and embed some other fonts


Template file setting to choose one of the fonts (that has most fonts available to publish student name) -

<fo:block font-family="ArialUnicodeMS,Calibri">[STUNAME]</fo:block>

[Currently default setting is as font-selection-strategy="auto"]

This setting might need to be changed to this in future allowing you to look for all fonts in the available list

<fo:block font-selection-strategy="character-by-character" font-family="ArialUnicodeMS,Calibri">[STUNAME]</fo:block>


April 12, 2011

resolving funnies between CVS and MyEclipse for studentmarks

The studentmarks project was showing differences in the synchronise view, but when I clicked on "Commit", nothing happened.  Here's what I tried:


1. checking out the project as studentmarks1

2. back in studentmarks:

a. deleting the troublesome directories and checking in the deletions to CVS

b. copying them back from studentmarks1

c. checking them in again.

This didn't work - it left me with the same problem.

I tried taking another copy as studentmarks2, renaming studentmarks1 to studentmarks and doing the same to the new studentmarks project - the same thing happened again.

So it seemed that what was in CVS was not repairable in this way.

Next idea was to take my local project and check it in as something different in CVS.  The worry there is that other people will do the obvious thing and check out the studentmarks project.  Therefore I've done this:

1. in xitest:/www/bussys/cvsrep renamed studentmarks to studentmarksCvsConfused

2. in MyEclipse, right clicked on studentmarks and done team -> Disconnect,  choosing the option to delete the CVS meta-data files

3. in MyEclipse, done team -> share and committed the project in afresh as studentmarks.

The project now reports "no changes found".





March 31, 2011

UTF–8 encoding for java apps

Changes to MRM to get extended UTF-8 standard character set to display:


2.      server.xml – added URIEncoding to the end of the Connector stanza like this:

<Connector port="8080" maxHttpHeaderSize="8192"

   maxThreads="150" minSpareThreads="25" maxSpareThreads="75"

   enableLookups="false" redirectPort="8443" acceptCount="100"

   connectionTimeout="20000" disableUploadTimeout="true"

          URIEncoding="UTF-8"

            />

3.      changed layout.jsp (which gets included in all the jsps) - the beginning now looks like this:

<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!--  next line added ZLJ 31 Mar 2011 for SITS unicode charset extension -->
<html lang="en">
<head>
   <title><tiles:getAsString name="title"/></title>
   <!--  changed charset from iso-8859-1 to UTF-8 - ZLJ 31 Mar 2011 -->
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  
    <link rel="stylesheet" href="/mrm/styles/standard5.css" type="text/css"/>

....


I'm not expecting that MRM will be sending extended characters as URL params, but for apps that do, a filter needs to be set up.  Follow the example here:

http://stackoverflow.com/questions/138948/how-to-get-utf-8-working-in-java-webapps

or see this link from Paul for the Spring way to do it:

Zoe,

There does appear to be a Spring solution but it’s not automatic i.e. you have to setup a filter

http://ibnaziz.wordpress.com/2008/06/10/spring-utf-8-conversion-using-characterencodingfilter/

Paul


-------------------------------------------FOP Unicode (added by Archana) -----------------------------------------

FOP – 0.20.5 (Unicode support)


In order to allow most of special chars to be displayed through FOP pdf, this is what I did –

1)   Create metrics file(xml) from true type font(ttf file) that you want to embed in PDF


Example –

Java –cp org.apache.fop.fonts.apps.TTFReader  source-ttf-filename outputxml-filename


java -cp lib/fop-0.20.5.jar;lib/avalon-framework-4.0.jar;/sharename/xalan.jar;/sharename/xml-apis

-1.3.02.jar;lib/xercesImpl-2.4.0.jar org.apache.fop.fonts.apps.TTFReader  c:/sharename/lucidaSansUnicode.ttf \\AMATHUR\sharename\lucidaSansUnicode.xml


[Note – make sure to create some dir and then share that (example -sharename dir in the above command was shared and then referenced as \\AMATHUR\sharename. Somehow the above command gives IO exception if we don’t share a dir where xml file needs to be created.

TTF font file can be found in your windows/font directory. I copied a file to sharename folder]


2)   Once xml file is created using above command, add custom fonts in userconfig.xml file. Template xml file can be picked from fop.jar conf sub folder. Just uncomment the relevant bits. Sample userconfig.xml


<!--<!DOCTYPE configuration SYSTEM "config.dtd">-->

<configuration>

<entry>

<key>fontBaseDir</key>

<value>/Jakarta/jakarta-tomcat-5.5.23/shared/classes/</value>

</entry>


<fonts>

<font metrics-file="lucidaSansUnicode.xml" embed-file="lucidaSansUnicode.ttf" kerning="yes">

     <font-triplet name="LucidaSansUnicode" style="normal" weight="normal"/>

</font>


</fonts>


</configuration>


3)   Through Java FOP code, load userconfig.xml

Example -new Options(new File(userConfigFile));

4)   Make sure to copy userconfig.xml in relevant folder(example conf tomcat sub folder on test/live or \Jakarta\jakarta-tomcat-5.5.23\shared\classes on local folder)

5)   Make sure to copy font related ttf and xml file in the relevant folder as referenced by userconfig.xml file.

Example – the above userconfig.xml refers to lucidaSansUnicode.ttf and xml file from directory /Jakarta/jakarta-tomcat-5.5.23/shared/classes


6)   Template.fo file that fop uses should have embedded font

Example just added font-family="LucidaSansUnicode" in the relevant section where I need to have new embedded fonts


<fo:block font-size="10pt" font-family="LucidaSansUnicode" line-height="15pt" space-after.optimum="5pt">


7)On test box, ArialUni.xml and ttf files are being used rather than LucidaSansUnicode. Local machine was crashing using ArialUni fonts (out of memory error – may be needed to increase java heap size).

8) Draw backs of fop 0.20.5  -

8a) Even though you have new fonts embedded, behind the scenes fop only embeds sub set of data (only glyphs). You can’t use copy/ search option in pdf where you are displaying chars using embed fonts (issue probably resolved in latest fop 1.0. Migrating jave code to fop 1.0 will at least take 5-6 days.

8b) If your ttf file does not contain relevant font it just displays a square box shaped char in pdf.

8c) Also, I got this char wrong Ϟ (instead got this symbol -circle connected with a vertical line at bottom -similar to char የ) when I used ArialUni.xml fonts.  I am not sure if there is any other char which might not get displayed properly. I tested lots of chars but couldn’t find any other example.


-------------------------------------------BIRT Unicode (added by Archana) -----------------------------------------


BIRT (Unicode support)

In order to allow most of special chars to be displayed through BIRT pdf, this is what you need to do–

1)     Go to this plugin dir - org.eclipse.birt.report.engine.fonts_2.5.2.v20091224

2)     Open fontsConfig_pdf.xml file and add these lines –

<font font-family="Arial Unicode MS" />

<font font-family="Calibri" />

3)     Open fontsConfig.xml and add this anywhere in <font-paths> sub section–

<path path="/usr/local/tomcat/birt-fonts" />

[Note – this path is required for UNIX machine. For local windows machine all necessary fonts are already in fonts sub folder]

4)     On UNIX VM, just create the above sub dir - /usr/local/tomcat/birt-fonts

5)     Copy arial and calibri fonts in this birt-font(UNIX machine). You will find those files in windows font sub folder on your machine

Calibri fonts -calibriz.ttf, calibrii.ttf, calibrib.ttf, calibri.ttf

Arial fonts -ARIALUNI.ttf

6)     If in future you find some font not available in BIRT pdf, you can do this

a.      Copy the char in word

b.     Save word as pdf

c.      Open pdf file and check pdf properties(fonts tab)

The font family will tell the name of the font which you can add in fontsConfig_pdf.xml (<font font-family="New Font" />

d.     Copy the .ttf file from windows font sub folder to UNIX BIRT sub folder(birt-fonts)

e.      You can also check chars of a font family from Find a character option (this option is available in windows 7 within font sub folder – just on left hand side). Select the font family (you will be able to know the font family for a particular char from pdf font properties). Click advanced view check box. Example – if I want to see ϗ char in calibri font, first get the Unicode value from http://www.ssec.wisc.edu/~tomw/java/unicode.html url. 03D7 is the value for char ϗ. In Go to Unicode field, type 03D7 and system will display that char.



March 29, 2011

Error reading tld listeners java.lang.NullPointerException

The mysterious "Error reading tld listeners java.lang.NullPointerException" error has occurred again - stack trace is below.

The first thing to note is that I am actually deploying 2 applications here, so it's important to work out which one is failing to deploy - in this case it's ev-interface and not MRM that's causing the problem.

The second thing is to look around for other errors in the stack trace - in this case there is a class not found error - at some point I renamed MrmMarkUploader to MarkUploader, but failed to do the job properly.  Making that consistent got rid of the error.


org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'urlMapping' defined in ServletContext resource [/WEB-INF/ev-interface-servlet.xml]: Cannot resolve reference to bean 'openSessionInViewInterceptor' while setting bean property 'interceptors' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'openSessionInViewInterceptor' defined in ServletContext resource [/WEB-INF/ev-interface-servlet.xml]: Cannot resolve reference to bean 'sitstSessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sitstSessionFactory' defined in ServletContext resource [/WEB-INF/persistanceSitsSitst.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: component class not found: uk.ac.warwick.sits.emr.MrmMarkUploader
   at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)
   at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
   at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedList(BeanDefinitionValueResolver.java:287)
   at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:126)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1245)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
   at java.security.AccessController.doPrivileged(Native Method)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
   at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
   at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
   at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
   at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
   at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
   at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
   at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
   at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
   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.deployDescriptor(HostConfig.java:626)
   at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
   at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
   at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
   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:592)
   at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
   at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'openSessionInViewInterceptor' defined in ServletContext resource [/WEB-INF/ev-interface-servlet.xml]: Cannot resolve reference to bean 'sitstSessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sitstSessionFactory' defined in ServletContext resource [/WEB-INF/persistanceSitsSitst.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: component class not found: uk.ac.warwick.sits.emr.MrmMarkUploader
   at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)
   at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1245)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
   at java.security.AccessController.doPrivileged(Native Method)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
   at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
   at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
   at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
   at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:269)
   ... 44 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sitstSessionFactory' defined in ServletContext resource [/WEB-INF/persistanceSitsSitst.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: component class not found: uk.ac.warwick.sits.emr.MrmMarkUploader
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1337)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
   at java.security.AccessController.doPrivileged(Native Method)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
   at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
   at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
   at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
   at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:269)
   ... 57 more
Caused by: org.hibernate.MappingException: component class not found: uk.ac.warwick.sits.emr.MrmMarkUploader
   at org.hibernate.mapping.Component.getComponentClass(Component.java:104)
   at org.hibernate.tuple.component.PojoComponentTuplizer.buildGetter(PojoComponentTuplizer.java:133)
   at org.hibernate.tuple.component.AbstractComponentTuplizer.<init>(AbstractComponentTuplizer.java:43)
   at org.hibernate.tuple.component.PojoComponentTuplizer.<init>(PojoComponentTuplizer.java:38)
   at org.hibernate.tuple.component.ComponentEntityModeToTuplizerMapping.<init>(ComponentEntityModeToTuplizerMapping.java:52)
   at org.hibernate.tuple.component.ComponentMetamodel.<init>(ComponentMetamodel.java:50)
   at org.hibernate.mapping.Component.buildType(Component.java:152)
   at org.hibernate.mapping.Component.getType(Component.java:145)
   at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:253)
   at org.hibernate.mapping.RootClass.validate(RootClass.java:193)
   at org.hibernate.cfg.Configuration.validate(Configuration.java:1102)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1287)
   at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:814)
   at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:732)
   at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1368)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334)
   ... 67 more
Caused by: java.lang.ClassNotFoundException: uk.ac.warwick.sits.emr.MrmMarkUploader
   at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1359)
   at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1205)
   at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
   at java.lang.Class.forName0(Native Method)
   at java.lang.Class.forName(Class.java:164)
   at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:100)
   at org.hibernate.mapping.Component.getComponentClass(Component.java:101)
   ... 83 more
2011-03-29 16:10:44,646 ERROR [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/ev-interface]] Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'urlMapping' defined in ServletContext resource [/WEB-INF/ev-interface-servlet.xml]: Cannot resolve reference to bean 'openSessionInViewInterceptor' while setting bean property 'interceptors' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'openSessionInViewInterceptor' defined in ServletContext resource [/WEB-INF/ev-interface-servlet.xml]: Cannot resolve reference to bean 'sitstSessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sitstSessionFactory' defined in ServletContext resource [/WEB-INF/persistanceSitsSitst.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: component class not found: uk.ac.warwick.sits.emr.MrmMarkUploader
   at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)
   at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
   at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedList(BeanDefinitionValueResolver.java:287)
   at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:126)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1245)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
   at java.security.AccessController.doPrivileged(Native Method)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
   at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
   at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
   at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
   at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
   at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
   at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
   at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
   at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
   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.deployDescriptor(HostConfig.java:626)
   at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
   at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
   at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
   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:592)
   at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
   at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'openSessionInViewInterceptor' defined in ServletContext resource [/WEB-INF/ev-interface-servlet.xml]: Cannot resolve reference to bean 'sitstSessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sitstSessionFactory' defined in ServletContext resource [/WEB-INF/persistanceSitsSitst.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: component class not found: uk.ac.warwick.sits.emr.MrmMarkUploader
   at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)
   at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:104)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1245)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
   at java.security.AccessController.doPrivileged(Native Method)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
   at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
   at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
   at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
   at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:269)
   ... 44 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sitstSessionFactory' defined in ServletContext resource [/WEB-INF/persistanceSitsSitst.xml]: Invocation of init method failed; nested exception is org.hibernate.MappingException: component class not found: uk.ac.warwick.sits.emr.MrmMarkUploader
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1337)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
   at java.security.AccessController.doPrivileged(Native Method)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
   at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
   at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)
   at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
   at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:269)
   ... 57 more
Caused by: org.hibernate.MappingException: component class not found: uk.ac.warwick.sits.emr.MrmMarkUploader
   at org.hibernate.mapping.Component.getComponentClass(Component.java:104)
   at org.hibernate.tuple.component.PojoComponentTuplizer.buildGetter(PojoComponentTuplizer.java:133)
   at org.hibernate.tuple.component.AbstractComponentTuplizer.<init>(AbstractComponentTuplizer.java:43)
   at org.hibernate.tuple.component.PojoComponentTuplizer.<init>(PojoComponentTuplizer.java:38)
   at org.hibernate.tuple.component.ComponentEntityModeToTuplizerMapping.<init>(ComponentEntityModeToTuplizerMapping.java:52)
   at org.hibernate.tuple.component.ComponentMetamodel.<init>(ComponentMetamodel.java:50)
   at org.hibernate.mapping.Component.buildType(Component.java:152)
   at org.hibernate.mapping.Component.getType(Component.java:145)
   at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:253)
   at org.hibernate.mapping.RootClass.validate(RootClass.java:193)
   at org.hibernate.cfg.Configuration.validate(Configuration.java:1102)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1287)
   at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:814)
   at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:732)
   at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1368)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1334)
   ... 67 more
Caused by: java.lang.ClassNotFoundException: uk.ac.warwick.sits.emr.MrmMarkUploader
   at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1359)
   at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1205)
   at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
   at java.lang.Class.forName0(Native Method)
   at java.lang.Class.forName(Class.java:164)
   at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:100)
   at org.hibernate.mapping.Component.getComponentClass(Component.java:101)
   ... 83 more
2011-03-29 16:10:44,646 ERROR [org.apache.catalina.core.StandardContext] Error listenerStart
2011-03-29 16:10:44,646 ERROR [org.apache.catalina.core.StandardContext] Context [/ev-interface] startup failed due to previous errors
2011-03-29 16:10:44,646 INFO  [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/ev-interface]] Closing Spring root WebApplicationContext
2011-03-29 16:10:44,661 DEBUG [org.apache.catalina.startup.ContextConfig] ContextConfig: Processing STOP
2011-03-29 16:10:44,661 DEBUG [org.apache.catalina.startup.ContextConfig] ContextConfig: Processing STOP
log4j:ERROR LogMananger.repositorySelector was null likely due to error in class reloading, using NOPLoggerRepository.
2011-03-29 16:10:44,849 DEBUG [org.apache.catalina.startup.ContextConfig] ContextConfig: Initializing
2011-03-29 16:10:44,849 DEBUG [org.apache.catalina.startup.ContextConfig] ContextConfig: Initializing
2011-03-29 16:10:44,849 DEBUG [org.apache.catalina.startup.ContextConfig] Processing context [/host-manager] configuration file C:\apps\tomcat conf/context.xml
2011-03-29 16:10:44,849 DEBUG [org.apache.catalina.startup.ContextConfig] Processing context [/host-manager] configuration file C:\apps\tomcat conf/context.xml
2011-03-29 16:10:44,849 DEBUG [org.apache.catalina.startup.ContextConfig] Successfully processed context [/host-manager] configuration file C:\apps\tomcat conf/context.xml
2011-03-29 16:10:44,849 DEBUG [org.apache.catalina.startup.ContextConfig] Successfully processed context [/host-manager] configuration file C:\apps\tomcat conf/context.xml
2011-03-29 16:10:44,849 DEBUG [org.apache.catalina.startup.ContextConfig] Processing context [/host-manager] configuration file C:\apps\tomcat\conf Catalina/localhost/context.xml.default
2011-03-29 16:10:44,849 DEBUG [org.apache.catalina.startup.ContextConfig] Processing context [/host-manager] configuration file C:\apps\tomcat\conf Catalina/localhost/context.xml.default
2011-03-29 16:10:44,849 DEBUG [org.apache.catalina.startup.ContextConfig] Processing context [/host-manager] configuration file C:\apps\tomcat\conf\Catalina\localhost\host-manager.xml null
2011-03-29 16:10:44,849 DEBUG [org.apache.catalina.startup.ContextConfig] Processing context [/host-manager] configuration file C:\apps\tomcat\conf\Catalina\localhost\host-manager.xml null
2011-03-29 16:10:44,849 DEBUG [org.apache.catalina.startup.ContextConfig] Successfully processed context [/host-manager] configuration file C:\apps\tomcat\conf\Catalina\localhost\host-manager.xml null
2011-03-29 16:10:44,849 DEBUG [org.apache.catalina.startup.ContextConfig] Successfully processed context [/host-manager] configuration file C:\apps\tomcat\conf\Catalina\localhost\host-manager.xml null
log4j:ERROR Error occured while converting date.
java.lang.NullPointerException
   at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:488)
   at java.lang.StringBuffer.append(StringBuffer.java:302)
   at org.apache.log4j.helpers.ISO8601DateFormat.format(ISO8601DateFormat.java:134)
   at java.text.DateFormat.format(DateFormat.java:314)
   at org.apache.log4j.helpers.PatternParser$DatePatternConverter.convert(PatternParser.java:444)
   at org.apache.log4j.helpers.PatternConverter.format(PatternConverter.java:65)
   at org.apache.log4j.PatternLayout.format(PatternLayout.java:502)
   at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:302)
   at org.apache.log4j.WriterAppender.append(WriterAppender.java:160)
   at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)
   at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:66)
   at org.apache.log4j.Category.callAppenders(Category.java:206)
   at org.apache.log4j.Category.forcedLog(Category.java:391)
   at org.apache.log4j.Category.log(Category.java:856)
   at org.apache.commons.logging.impl.Log4JLogger.debug(Log4JLogger.java:171)
   at org.apache.catalina.startup.TldConfig.tldScanResourcePaths(TldConfig.java:576)
   at org.apache.catalina.startup.TldConfig.execute(TldConfig.java:283)
   at org.apache.catalina.core.StandardContext.processTlds(StandardContext.java:4307)
   at org.apache.catalina.core.StandardContext.start(StandardContext.java:4144)
   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.deployDescriptor(HostConfig.java:626)
   at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
   at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
   at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
   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:592)
   at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
   at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
DEBUG [org.apache.catalina.startup.TldConfig]  Accumulating TLD resource paths
log4j:ERROR Error occured while converting date.
java.lang.NullPointerException
   at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:488)
   at java.lang.StringBuffer.append(StringBuffer.java:302)
   at org.apache.log4j.helpers.ISO8601DateFormat.format(ISO8601DateFormat.java:134)
   at java.text.DateFormat.format(DateFormat.java:314)
   at org.apache.log4j.helpers.PatternParser$DatePatternConverter.convert(PatternParser.java:444)
   at org.apache.log4j.helpers.PatternConverter.format(PatternConverter.java:65)
   at org.apache.log4j.PatternLayout.format(PatternLayout.java:502)
   at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:302)
   at org.apache.log4j.WriterAppender.append(WriterAppender.java:160)
   at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)
   at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:66)
   at org.apache.log4j.Category.callAppenders(Category.java:206)
   at org.apache.log4j.Category.forcedLog(Category.java:391)
   at org.apache.log4j.Category.log(Category.java:856)
   at org.apache.commons.logging.impl.Log4JLogger.debug(Log4JLogger.java:171)
   at org.apache.catalina.startup.TldConfig.tldScanResourcePaths(TldConfig.java:576)
   at org.apache.catalina.startup.TldConfig.execute(TldConfig.java:283)
   at org.apache.catalina.core.StandardContext.processTlds(StandardContext.java:4307)
   at org.apache.catalina.core.StandardContext.start(StandardContext.java:4144)
   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.deployDescriptor(HostConfig.java:626)
   at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
   at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
   at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
   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:592)
   at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
   at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
DEBUG [org.apache.catalina.startup.TldConfig]  Accumulating TLD resource paths
2011-03-29 16:10:44,864 ERROR [org.apache.catalina.core.StandardContext] Error reading tld listeners java.lang.NullPointerException
java.lang.NullPointerException
   at org.apache.log4j.Category.isEnabledFor(Category.java:749)
   at org.apache.commons.logging.impl.Log4JLogger.isTraceEnabled(Log4JLogger.java:327)
   at org.apache.catalina.startup.TldConfig.tldScanResourcePaths(TldConfig.java:582)
   at org.apache.catalina.startup.TldConfig.execute(TldConfig.java:283)
   at org.apache.catalina.core.StandardContext.processTlds(StandardContext.java:4307)
   at org.apache.catalina.core.StandardContext.start(StandardContext.java:4144)
   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.deployDescriptor(HostConfig.java:626)
   at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
   at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
   at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
   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:592)
   at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
   at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
2011-03-29 16:10:44,864 DEBUG [org.apache.catalina.startup.ContextConfig] ContextConfig: Processing START
2011-03-29 16:10:44,864 DEBUG [org.apache.catalina.startup.ContextConfig] ContextConfig: Processing START
2011-03-29 16:10:44,864 DEBUG [org.apache.catalina.startup.ContextConfig] Processing context [/host-manager] web configuration resource file://C:\apps\tomcat\conf\web.xml
2011-03-29 16:10:44,864 DEBUG [org.apache.catalina.startup.ContextConfig] Processing context [/host-manager] web configuration resource file://C:\apps\tomcat\conf\web.xml
2011-03-29 16:10:44,896 DEBUG [org.apache.catalina.startup.ContextConfig] Parsing application web.xml file at jndi:/localhost/host-manager/WEB-INF/web.xml
2011-03-29 16:10:44,896 DEBUG [org.apache.catalina.startup.ContextConfig] Parsing application web.xml file at jndi:/localhost/host-manager/WEB-INF/web.xml
2011-03-29 16:10:44,911 DEBUG [org.apache.catalina.startup.ContextConfig] Configured an authenticator for method BASIC
2011-03-29 16:10:44,911 DEBUG [org.apache.catalina.startup.ContextConfig] Configured an authenticator for method BASIC
2011-03-29 16:10:44,911 DEBUG [org.apache.catalina.startup.ContextConfig] Pipeline Configuration:
2011-03-29 16:10:44,911 DEBUG [org.apache.catalina.startup.ContextConfig] Pipeline Configuration:
2011-03-29 16:10:44,911 DEBUG [org.apache.catalina.startup.ContextConfig]   org.apache.catalina.authenticator.BasicAuthenticator/1.0
2011-03-29 16:10:44,911 DEBUG [org.apache.catalina.startup.ContextConfig]   org.apache.catalina.authenticator.BasicAuthenticator/1.0
2011-03-29 16:10:44,911 DEBUG [org.apache.catalina.startup.ContextConfig]   org.apache.catalina.core.StandardContextValve/1.0
2011-03-29 16:10:44,911 DEBUG [org.apache.catalina.startup.ContextConfig]   org.apache.catalina.core.StandardContextValve/1.0
2011-03-29 16:10:44,911 DEBUG [org.apache.catalina.startup.ContextConfig] ======================
2011-03-29 16:10:44,911 DEBUG [org.apache.catalina.startup.ContextConfig] ======================
2011-03-29 16:10:45,005 DEBUG [org.apache.catalina.startup.ContextConfig] ContextConfig: Initializing
2011-03-29 16:10:45,005 DEBUG [org.apache.catalina.startup.ContextConfig] ContextConfig: Initializing
2011-03-29 16:10:45,005 DEBUG [org.apache.catalina.startup.ContextConfig] Processing context [/manager] configuration file C:\apps\tomcat conf/context.xml
2011-03-29 16:10:45,005 DEBUG [org.apache.catalina.startup.ContextConfig] Processing context [/manager] configuration file C:\apps\tomcat conf/context.xml
2011-03-29 16:10:45,005 DEBUG [org.apache.catalina.startup.ContextConfig] Successfully processed context [/manager] configuration file C:\apps\tomcat conf/context.xml
2011-03-29 16:10:45,005 DEBUG [org.apache.catalina.startup.ContextConfig] Successfully processed context [/manager] configuration file C:\apps\tomcat conf/context.xml
2011-03-29 16:10:45,005 DEBUG [org.apache.catalina.startup.ContextConfig] Processing context [/manager] configuration file C:\apps\tomcat\conf Catalina/localhost/context.xml.default
2011-03-29 16:10:45,005 DEBUG [org.apache.catalina.startup.ContextConfig] Processing context [/manager] configuration file C:\apps\tomcat\conf Catalina/localhost/context.xml.default
2011-03-29 16:10:45,005 DEBUG [org.apache.catalina.startup.ContextConfig] Processing context [/manager] configuration file C:\apps\tomcat\conf\Catalina\localhost\manager.xml null
2011-03-29 16:10:45,005 DEBUG [org.apache.catalina.startup.ContextConfig] Processing context [/manager] configuration file C:\apps\tomcat\conf\Catalina\localhost\manager.xml null
2011-03-29 16:10:45,005 DEBUG [org.apache.catalina.startup.ContextConfig] Successfully processed context [/manager] configuration file C:\apps\tomcat\conf\Catalina\localhost\manager.xml null
2011-03-29 16:10:45,005 DEBUG [org.apache.catalina.startup.ContextConfig] Successfully processed context [/manager] configuration file C:\apps\tomcat\conf\Catalina\localhost\manager.xml null
log4j:ERROR Error occured while converting date.
java.lang.NullPointerException
   at java.lang.System.arraycopy(Native Method)
   at java.lang.AbstractStringBuilder.getChars(AbstractStringBuilder.java:331)
   at java.lang.StringBuffer.getChars(StringBuffer.java:202)
   at org.apache.log4j.helpers.ISO8601DateFormat.format(ISO8601DateFormat.java:130)
   at java.text.DateFormat.format(DateFormat.java:314)
   at org.apache.log4j.helpers.PatternParser$DatePatternConverter.convert(PatternParser.java:444)
   at org.apache.log4j.helpers.PatternConverter.format(PatternConverter.java:65)
   at org.apache.log4j.PatternLayout.format(PatternLayout.java:502)
   at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:302)
   at org.apache.log4j.WriterAppender.append(WriterAppender.java:160)
   at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)
   at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:66)
   at org.apache.log4j.Category.callAppenders(Category.java:206)
   at org.apache.log4j.Category.forcedLog(Category.java:391)
   at org.apache.log4j.Category.log(Category.java:856)
   at org.apache.commons.logging.impl.Log4JLogger.debug(Log4JLogger.java:171)
   at org.apache.catalina.startup.TldConfig.tldScanResourcePaths(TldConfig.java:576)
   at org.apache.catalina.startup.TldConfig.execute(TldConfig.java:283)
   at org.apache.catalina.core.StandardContext.processTlds(StandardContext.java:4307)
   at org.apache.catalina.core.StandardContext.start(StandardContext.java:4144)
   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.deployDescriptor(HostConfig.java:626)
   at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
   at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
   at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
   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:592)
   at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
   at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
DEBUG [org.apache.catalina.startup.TldConfig]  Accumulating TLD resource paths
log4j:ERROR Error occured while converting date.
java.lang.NullPointerException
   at java.lang.System.arraycopy(Native Method)
   at java.lang.AbstractStringBuilder.getChars(AbstractStringBuilder.java:331)
   at java.lang.StringBuffer.getChars(StringBuffer.java:202)
   at org.apache.log4j.helpers.ISO8601DateFormat.format(ISO8601DateFormat.java:130)
   at java.text.DateFormat.format(DateFormat.java:314)
   at org.apache.log4j.helpers.PatternParser$DatePatternConverter.convert(PatternParser.java:444)
   at org.apache.log4j.helpers.PatternConverter.format(PatternConverter.java:65)
   at org.apache.log4j.PatternLayout.format(PatternLayout.java:502)
   at org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:302)
   at org.apache.log4j.WriterAppender.append(WriterAppender.java:160)
   at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)
   at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:66)
   at org.apache.log4j.Category.callAppenders(Category.java:206)
   at org.apache.log4j.Category.forcedLog(Category.java:391)
   at org.apache.log4j.Category.log(Category.java:856)
   at org.apache.commons.logging.impl.Log4JLogger.debug(Log4JLogger.java:171)
   at org.apache.catalina.startup.TldConfig.tldScanResourcePaths(TldConfig.java:576)
   at org.apache.catalina.startup.TldConfig.execute(TldConfig.java:283)
   at org.apache.catalina.core.StandardContext.processTlds(StandardContext.java:4307)
   at org.apache.catalina.core.StandardContext.start(StandardContext.java:4144)
   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.deployDescriptor(HostConfig.java:626)
   at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
   at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
   at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
   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:592)
   at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
   at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
DEBUG [org.apache.catalina.startup.TldConfig]  Accumulating TLD resource paths
2011-03-29 16:10:45,021 ERROR [org.apache.catalina.core.StandardContext] Error reading tld listeners java.lang.NullPointerException
java.lang.NullPointerException
   at org.apache.log4j.Category.isEnabledFor(Category.java:749)
   at org.apache.commons.logging.impl.Log4JLogger.isTraceEnabled(Log4JLogger.java:327)
   at org.apache.catalina.startup.TldConfig.tldScanResourcePaths(TldConfig.java:582)
   at org.apache.catalina.startup.TldConfig.execute(TldConfig.java:283)
   at org.apache.catalina.core.StandardContext.processTlds(StandardContext.java:4307)
   at org.apache.catalina.core.StandardContext.start(StandardContext.java:4144)
   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.deployDescriptor(HostConfig.java:626)
   at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
   at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
   at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
   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:592)
   at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
   at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
2011-03-29 16:10:45,021 DEBUG [org.apache.catalina.startup.ContextConfig] ContextConfig: Processing START
2011-03-29 16:10:45,021 DEBUG [org.apache.catalina.startup.ContextConfig] ContextConfig: Processing START
2011-03-29 16:10:45,021 DEBUG [org.apache.catalina.startup.ContextConfig] Processing context [/manager] web configuration resource file://C:\apps\tomcat\conf\web.xml
2011-03-29 16:10:45,021 DEBUG [org.apache.catalina.startup.ContextConfig] Processing context [/manager] web configuration resource file://C:\apps\tomcat\conf\web.xml
2011-03-29 16:10:45,052 DEBUG [org.apache.catalina.startup.ContextConfig] Parsing application web.xml file at jndi:/localhost/manager/WEB-INF/web.xml
2011-03-29 16:10:45,052 DEBUG [org.apache.catalina.startup.ContextConfig] Parsing application web.xml file at jndi:/localhost/manager/WEB-INF/web.xml
2011-03-29 16:10:45,052 DEBUG [org.apache.catalina.startup.ContextConfig] Configured an authenticator for method BASIC
2011-03-29 16:10:45,052 DEBUG [org.apache.catalina.startup.ContextConfig] Configured an authenticator for method BASIC
2011-03-29 16:10:45,052 DEBUG [org.apache.catalina.startup.ContextConfig] Pipeline Configuration:
2011-03-29 16:10:45,052 DEBUG [org.apache.catalina.startup.ContextConfig] Pipeline Configuration:
2011-03-29 16:10:45,052 DEBUG [org.apache.catalina.startup.ContextConfig]   org.apache.catalina.authenticator.BasicAuthenticator/1.0
2011-03-29 16:10:45,052 DEBUG [org.apache.catalina.startup.ContextConfig]   org.apache.catalina.authenticator.BasicAuthenticator/1.0
2011-03-29 16:10:45,052 DEBUG [org.apache.catalina.startup.ContextConfig]   org.apache.catalina.core.StandardContextValve/1.0
2011-03-29 16:10:45,052 DEBUG [org.apache.catalina.startup.ContextConfig]   org.apache.catalina.core.StandardContextValve/1.0
2011-03-29 16:10:45,052 DEBUG [org.apache.catalina.startup.ContextConfig] ======================
2011-03-29 16:10:45,052 DEBUG [org.apache.catalina.startup.ContextConfig] ======================
2011-03-29 16:10:45,067 WARN  [org.apache.catalina.startup.HostConfig] A docBase C:\apps\tomcat\webapps\mrm inside the host appBase has been specified, and will be ignored
2011-03-29 16:10:45,067 WARN  [org.apache.catalina.startup.HostConfig] A docBase C:\apps\tomcat\webapps\mrm inside the host appBase has been specified, and will be ignored
2011-03-29 16:10:45,067 WARN  [org.apache.catalina.startup.HostConfig] A docBase C:\apps\tomcat\webapps\mrm inside the host appBase has been specified, and will be ignored
2011-03-29 16:10:45,067 DEBUG [org.apache.catalina.startup.ContextConfig] ContextConfig: Initializing
2011-03-29 16:10:45,067 DEBUG [org.apache.catalina.startup.ContextConfig] ContextConfig: Initializing
2011-03-29 16:10:45,067 DEBUG [org.apache.catalina.startup.ContextConfig] Processing context [/mrm] configuration file C:\apps\tomcat conf/context.xml
2011-03-29 16:10:45,067 DEBUG [org.apache.catalina.startup.ContextConfig] Processing context [/mrm] configuration file C:\apps\tomcat conf/context.xml
2011-03-29 16:10:45,067 DEBUG [org.apache.catalina.startup.ContextConfig] Successfully processed context [/mrm] configuration file C:\apps\tomcat conf/context.xml
2011-03-29 16:10:45,067 DEBUG [org.apache.catalina.startup.ContextConfig] Successfully processed context [/mrm] configuration file C:\apps\tomcat conf/context.xml
2011-03-29 16:10:45,067 DEBUG [org.apache.catalina.startup.ContextConfig] Processing context [/mrm] configuration file C:\apps\tomcat\conf Catalina/localhost/context.xml.default
2011-03-29 16:10:45,067 DEBUG [org.apache.catalina.startup.ContextConfig] Processing context [/mrm] configuration file C:\apps\tomcat\conf Catalina/localhost/context.xml.default
2011-03-29 16:10:45,067 DEBUG [org.apache.catalina.startup.ContextConfig] Processing context [/mrm] configuration file C:\apps\tomcat\conf\Catalina\localhost\mrm.xml null
2011-03-29 16:10:45,067 DEBUG [org.apache.catalina.startup.ContextConfig] Processing context [/mrm] configuration file C:\apps\tomcat\conf\Catalina\localhost\mrm.xml null
2011-03-29 16:10:45,067 DEBUG [org.apache.catalina.startup.ContextConfig] Successfully processed context [/mrm] configuration file C:\apps\tomcat\conf\Catalina\localhost\mrm.xml null
2011-03-29 16:10:45,067 DEBUG [org.apache.catalina.startup.ContextConfig] Successfully processed context [/mrm] configuration file C:\apps\tomcat\conf\Catalina\localhost\mrm.xml null


March 24, 2011

SuperCSV used to parse a csv file

I use superCSV to parse CSV files for module mark upload.  It was straightforward to implement and does some validation, checks for quotes etc.  Since what it does is fairly minimal it was a toss-up whether to use it or just use something like split or StringTokeniser.

The only drawback I've found with it is that while the errors are all very lovely for Kasper Graversen's customer base (me),  they aren't suitable for passing on to our users.  And splatting gobbledegook onto the screen when things go wrong is about as forgivable as overcooking fish.  Here are a couple:

The value array (size 1) must match the processors array (size 6): You are probably reading a CSV line with a different number of columns than the number of cellprocessors specified

- this means the CSV file has the wrong number of columns (or maybe it wasn't a CSV file at all)

uk.ac.warwick.mrm.markUpload.data.ComponentLineInCsvFile.setStudent ID(java.lang.String) Can't find method 'setStudent ID(class java.lang.String)' in class 'uk.ac.warwick.mrm.markUpload.data.ComponentLineInCsvFile'. Is the name correctly spelled in the NameMapping? Have you forgot to convert the data so that a wrong set method is called?

- this means the template doesn't have the expected heading names, on which SuperCSV relies.

Both of these errors are likely to crop up for users.  I've ended up intercepting, parsing and translating them for user consumption.

You also get messages like this if validation fails - this one's almost user-readable, though I'm not sure if "string" is a lay term:

Entry "10-Nov" on line 2 column 2 is not within the string sizes 5 - 5

Expecting users to understand what regular expressions are and interpret them is a bit hopeful:

Entry "x" does not respect the regular expression '[YNyn]'

- worth intercepting that one.

So on balance I'm not sure it was worth using SuperCSV.




March 22, 2011

two simpleJdbcTemplates on the go??

How weird is this – I got a null pointer exception and suspected that “simpleJdbcTemplate” was null – when I used the debugger it appeared to show there were two instances of it, one of which was null and one which wasn’t.

I had it declared as a class variable like this:

SimpleJdbcTemplate simpleJdbcTemplate = getSimpleJdbcTemplate();

To get to the bottom of it I renamed it to sitsJdbcTemplate and the null one was the one that was renamed.

I then removed it altogether and tried to recompile, at which point I got the error message

The field SimpleJdbcDaoSupport.simpleJdbcTemplate is not visible.

Surely the compiler should have complained when I declared a second variable of the same name?  No, I suppose it's just overriding functionality.  In theory I could distinguish between the 2 user super.

All a bit opaque on first encounter.

I just settled for calling getSimpleJdbcTemplate() multiple times.




March 11, 2011

unreliable line breaks in emails

I had an issue with linebreaks in an email being sent from a java app.  Mostly "\n" was coming out as a line break as expected, but sometimes it was being ignored.  This appears to be a "feature" of Outlook, which sometimes mashes lines together - see:

http://stackoverflow.com/questions/136052/how-do-i-format-a-string-in-an-email-so-outlook-will-print-the-line-breaks


SOLUTION: You can force Outlook to recognise the new line by replacing "\n" with "\t\n" (inserting a tab before the new line).

The problem is illustrated by the string below:


0123456/1\nComponent (SAS) mark data captured for IE931-30/A01:- ACTM: 40, AGRM: 40, PRCS: A, SASS: A, PROC: COM\nComponent (SAS) mark data captured for IE931-30/A02:- ACTM: 70, AGRM: 70, PRCS: A, SASS: A, PROC: COM\n\n1234567/1\nOverall (SMR) mark data captured for MA132-12:- ACTM: null, AGRG: B, AGRM: 50, COMA: 1, CRED: 12, CURA: 1, PRCS: A, PROC: COM, RSLT: P, SASS: A, UDF2: 11/03/11:0843\n\n23456782/1\nComponent (SAS) mark data captured for IE929-30/A01:- ACTM: 20, AGRM: 20, PRCS: A, SASS: A, PROC: COM\nOverall (SMR) mark data captured for IE929-30:- ACTM: 50, AGRG: 22, AGRM: 50, COMA: 1, CRED: 30, CURA: 1, PRCS: A, PROC: COM, RSLT: P, SASS: A, UDF2: 11/03/11:0843\n\n

Which produced this email:

0123456/1

Component (SAS) mark data captured for IE931-30/A01:- ACTM: 40, AGRM: 40, PRCS: A, SASS: A, PROC: COM Component (SAS) mark data captured for IE931-30/A02:- ACTM: 70, AGRM: 70, PRCS: A, SASS: A, PROC: COM

1234567/1

Overall (SMR) mark data captured for MA132-12:- ACTM: null, AGRG: B, AGRM: 50, COMA: 1, CRED: 12, CURA: 1, PRCS: A, PROC: COM, RSLT: P, SASS: A, UDF2: 11/03/11:0907

2345678/1

Component (SAS) mark data captured for IE929-30/A01:- ACTM: 20, AGRM: 20, PRCS: A, SASS: A, PROC: COM Overall (SMR) mark data captured for IE929-30:- ACTM: 50, AGRG: 22, AGRM: 50, COMA: 1, CRED: 30, CURA: 1, PRCS: A, PROC: COM, RSLT: P, SASS: A, UDF2: 11/03/11:0907

Most of the line breaks are preserved, but a few aren't - e.g. the one before "Overall (SMR) mark data" in the final para.  I replaced "\n" by "\t\n" there and it was fixed.



January 2022

Mo Tu We Th Fr Sa Su
Dec |  Today  |
               1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31                  

Search this blog

Tags

Galleries

Blog archive

Loading…
RSS2.0 Atom
Not signed in
Sign in

Powered by BlogBuilder
© MMXXII