Upgrade VelocityTools 2.0 new tools.xml doesn't load - velocity

I'm switching to VelocityTools 2.0 but the new tools.xml doesn't load. I replaced toolbox.xml and now I use tools.xml but when I run the server I get:
"XMLToolboxManager:100: XMLToolboxManager has been deprecated. Please
use org.apache.velocity.tools.ToolboxFactory instead.
ServletToolboxManager:131: ServletToolboxManager has been deprecated.
Please use org.apache.velocity.tools.ToolboxFactory instead."
How can I use the ToolboxFactory? XMLToolboxManager or ServletToolboxManager are not referenced anywhere in my code so I can't simply replace the classes.
When I use toolbox.xml with VelocityTools 2.0 it works just fine, but I need to get the new xml syntax work in tools.xml
My bean definition in velocity.xml looks like this:
<bean id="viewResolver" class="org.springframework.web.servlet.view.velocity.VelocityLayoutViewResolver">
<property name="viewClass">
<value>org.springframework.web.servlet.view.velocity.VelocityLayoutView</value>
</property>
<property name="contentType">
<value>text/html;charset=UTF-8</value>
</property>
<property name="cache"><value>true</value></property>
<property name="prefix"><value></value></property>
<property name="suffix"><value>.vm</value></property>
<property name="toolboxConfigLocation"><value>/WEB-INF/tools.xml</value></property>
</bean>
I tried removing the property for "toolboxConfigLocation" from the bean and hoped that the default tools.xml will be available, but when I tried to use i.e $math didn't work. What am I doing wrong?
Can someone help please?

Related

Spring 4 lazy-init not honoured for org.springframework.jms.listener.adapter.MessageListenerAdapter?

I'm trying to convert a Spring 3 app to Spring 4 (4.3.2.RELEASE) but I can't get org.springframework.jms.listener.adapter.MessageListenerAdapter to lazy load anymore.
To isolate the problem I removed all references to the following bean def but it still tries to load and throws a java.lang.NoClassDefFoundError: javax/jms/MessageListener, which is a runtime dependency that I am not providing on purpose in this setup:
<bean id="messageListener" class="org.springframework.jms.listener.adapter.MessageListenerAdapter" lazy-init="true" scope="prototype">
<property name="defaultListenerMethod" value="handleRequest"/>
<property name="defaultResponseDestination" ref="defaultResponseDestination" />
<property name="delegate" ref="stringRequestToStreamRequestHandler" />
</bean>
Is this expected behaviour or a bug?

**Plugging in Custom Serializer in Apache Ignite**

Plugging in Custom Serializer in Apache Ignite
I tried to add Kyro Serializer in the Binary Configuration bean but at runtime it gave me a class type conversion error.
My Code is
<property name="binaryConfiguration">
<bean class="org.apache.ignite.configuration.BinaryConfiguration">
<property name="typeConfigurations">
<list>
<bean class="org.apache.ignite.binary.BinaryTypeConfiguration">
<property name="typeName" value="testPojo" />
<property name="serializer">
<bean class="com.esotericsoftware.kryo.serializers.DefaultSerializers" />
</property>
</bean>
</list>
</property>
</bean>
</property>
Error Log is
Caused by: java.lang.IllegalStateException: Cannot convert value of type [com.esotericsoftware.kryo.serializers.DefaultSerializers] to required type [org.apache.ignite.binary.BinarySerializer] for property 'serializer': no matching editors or conversion strategy found
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:302)
at org.springframework.beans.AbstractNestablePropertyAccessor.convertIfNecessary(AbstractNestablePropertyAccessor.java:576)
... 104 more
On digging in the Apache Ignite provided BinarySerializer, came to a conclusion that one has to write a custom implementation for the serializer as Other plugin Serializers to implement it.
How is the Optimized Marshaller beneficial ?
BinarySerializer is an interface that can be implemented to customize (de)serialization logic for a particular type. This is an analogy to Externalizable for BinaryMarshaller, which is the default marshaller since Ignite 1.5. Refer to this page for details: https://apacheignite.readme.io/docs/binary-marshaller
OptimizedMarshaller implements legacy serialization protocol, which was used before binary format was introduced. It's still available, but binary format is recommended.
You can also implement your own marshaller (e.g., based on Kryo). To do this, implement the Marshaller interface and provide this implementation in configuration via IgniteConfiguration.setMarshaller() property.

Adding new facet to DSpace has no effect (DSpace 4.1)

I changed the discovery.xml file as described in the documentation to add a new facet over dc.type to our DSpace. When I finished reindexing and deleting the cache I see the new search filter at advanced search but not as a facet.
These are the changes I made to discovery.xml:
Added filter to sidbarFacets and SearchFilter:
<ref bean="searchFilterType" />
and this is the filter:
<bean id="searchFilterType" class="org.dspace.discovery.configuration.DiscoverySearchFilterFacet">
<property name="indexFieldName" value="type"/>
<property name="metadataFields">
<list>
<value>dc.type</value>
</list>
</property>
</bean>
Thanks in advance
The following modifications to discovery.xml on the latest DSpace master branch worked on my local setup:
https://github.com/bram-atmire/DSpace/commit/3f084569cf1bbc6c6684d114a09a1617c8d3de5d
One reason why the facet wouldn't appear in your setup, could be that you omitted to add it to both the "defaultconfiguration" as well as the specific configuration for the DSpace homepage.
After building and deploying, a forced discovery re-index using the following command made the facet appear:
./dspace index-discovery -f
Here is an example facet that I have configured in our instance. Try setting the facetLimit, sortOrder, and splitter. Re-index and see if that resolves the issue.
<bean id="searchFilterGeographic"
class="org.dspace.discovery.configuration.HierarchicalSidebarFacetConfiguration">
<property name="indexFieldName" value="geographic-region"/>
<property name="metadataFields">
<list>
<value>dc.coverage.spatial</value>
</list>
</property>
<property name="facetLimit" value="5"/>
<property name="sortOrder" value="COUNT"/>
<property name="splitter" value="::"/>
</bean>

Apache cxf using XSLTJaxbProvider as a JAXRSDataBinding

(apologies for broken links at stackoverflow limits new users to 2 in one post!)
I've scaffolded a web service server using Spring STS and MyEclipse for spring and was interested in transforming the out going soap message.
First thing I wanted to transform was the namespace prefixing so my spring config looked like this
<jaxws:endpoint xmlns:tns="ttps://etc etc">
<jaxws:dataBinding>
<ref bean="data-binding"/>
</jaxws:dataBinding>
</jaxws:endpoint>
<bean ref="data-binding" class="org.apache.cxf.jaxb.JAXBDataBinding">
<property name="namespaceMap">
<map>
<entry>
<key>
<value>ttp://thing</value>
</key>
<value>BeepBeep</value>
</entry>
</map>
</property>
</bean>
this worked fine and my soap message was outputted completely and correctly.
<as>
<b>
<stuff/>
</b>
<c>
<more stuff/>
</c>
</as>
Second I need to change the soap xml but more than the transform features at http://cxf.apache.org/docs/transformationfeature.html allowed
so I read up about the XSLTJaxbProvider at http://cxf.apache.org/docs/jax-rs-advanced-xml.html and plugging in a rs provider to a ws binding at ttp://cxf.apache.org/docs/jax-rs-data-bindings.html#JAX-RSDataBindings-CXFDataBindingsasJAXRSproviders to create the following config
<jaxws:endpoint xmlns:tns="ttps://etc etc">
<jaxws:dataBinding>
<ref bean="jaxrs-data-binding"/>
</jaxws:dataBinding>
<bean id="jaxrs-data-binding" class="org.apache.cxf.jaxrs.provider.JAXRSDataBinding">
<property name="namespaceMap">
<map>
<entry>
<key>
<value>ttp://thing</value>
</key>
<value>BeepBeep</value>
</entry>
</map>
</property>
<property name="provider" ref="xsltProvider"/>
<bean id="xsltProvider" class="org.apache.cxf.jaxrs.provider.XSLTJaxbProvider">
<property name="outTemplate" value="classpath:/WEB-INF/templates/transform.xsl"/>
</bean>
now I get an JAXB Exception: Class not known to this context for classes b and c and even if I have an empty xslt stylesheet I get the xml
<as/>
I have tinkered with the config to every end and added #XmlSeeAlso all over the place to no avail.
I guess I have to ask is what I've done possible in config? The fact that it all works as expected before I try and wire in the rs provider as a ws databinding might mean it's not?
Any advice greatly appreciated. Maybe there is a better way to use xslt/manipulate the xml?
Thanks

Is Proxy Factory necessary in NHibernate?

I've this configuration in the hibernate.cfg.xml:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
<property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>
<property name="connection.connection_string">Data Source=.\SQLEXPRESS;Initial Catalog=MyDB;Integrated Security=SSPI;</property>
<property name="show_sql">true</property>
</session-factory>
</hibernate-configuration>
I've just created a Class Library and I've created an integration test using MbUnit. It fails. A part of the report(the one which I think is enough) goes here:
** NO TESTS WERE RUN (No tests found) **
TestCase 'M:IntegrationTests.RepositoryTests.ListAllPostsReturnsAListOfPost'
failed: The ProxyFactoryFactory was not configured.
Initialize 'proxyfactory.factory_class' property of the session-factory configuration section with one of the available NHibernate.ByteCode providers.
I have read many tutorials and haven't seen this proxy factory configuration. Is specifying it really necessary? If so, how can I do that? Do I've to reference some other library?
If you're using the latest of NHibernate(2.1), you'll notice that mainline for NH doesn't have a dependency on castle for proxy generation anymore, so all those tutorials you've been looking at are probably out of date.
Basically, you now have a few choices of how you want your dynamic proxies created, so you'll need to explicitly configure which proxy generator you want to use. Examples can be found in this how-to post on forge. A full list of the options is referenced here.
P.S. if you want to keep things simple, just use Castle as the older versions of NHibernate all used it by default.