Posts

Showing posts from 2015

java.lang.annotation.IncompleteAnnotationException: javax.xml.bind.annotation.XmlSchemaType missing element name

Hi The use case happened when i was trying to generate the java files from the wsdl using the CXF codegen maven plugin. The generated code  started failing with the above exception when tried to invoke via Eclipse. Note : the same wsdl worked in Soap UI. The generated code in SOAP UI using the WSIMPORT tool also worked. So the issue i figures out is related to the Jaxb in the project. So what i did is upgraded the Jaxb to this version                  <dependency> <groupId>javax.xml.bind</groupId> <artifactId>jaxb-api</artifactId> <version>2.2</version> </dependency> It all started working. So this has something to do with the internal element generation of Jaxb and what happens is when a latest version is not found falls back to the jaxb version embedded in SDK leading to that error. Now i dont have a proof for that just an educated guess. :)

Field or property 'jobParameters' cannot be found on object of type 'org.springframework.beans.factory.config.BeanExpressionContext' - Spring Batch

This Error happens when you are trying to retrieve a Job Execution parameter and inject it into a Bean. The bean can be anything a Task let, or a StatmentSetter the error can happen. E.g Implementation <bean id = "flatFileItemReader" scope="step" class="org.springframework.batch.item.file.FlatFileItemReader"> <property name = "resource" value = "#{jobParameters[input.file.name]}" /> </bean> The error is because of the Scope parameter missing Using a scope of  Step  is required in order to use late binding since the bean cannot actually be instantiated until the  Step  starts, which allows the attributes to be found. Because it is not part of the Spring container by default, the scope must be added explicitly. Check out the Documentation here ..  http://docs.spring.io/spring-batch/reference/html/configureStep.html#step-scope

Installing OpenCv 3.0 and Javacv on Raspberry Pi

Preface --------- I had a free raspberry pi's version B lying around and a spare PS3 eye and a few hours in hand { which later extended to days and week :) }. Decided to use Javacv for a quick IP-Cam setup and a simple face recognition(Dint get time to work till now).  Thanks a lot for Samuel Audet for helping out with a lot of issues. https://groups.google.com/forum/#!topic/javacv/Ql1v5THKIcQ Going through the above link you can read all my interactions with Samuel. This is gonna be a pretty lengthy post. Read through if you need to compile a later version if not simply skip to interesting parts and links. Events --------- Step 1 Look for existing tutorial and I did found one,very well explained with steps  http://salaboy.com/2013/06/14/using-javacv-in-the-raspberry-pi-linux-arm/ Went through the steps, installed the opencv version 2.4.  Opencv installation success (!yaay!)  . Developer in me decided I will take a latest version of javacv and javacpp a

Autowiring a static variable using Spring

Yes, This sounds wrong and should never try to do it in a proper design (According to me). With the above disclaimer, Might run into such a case where we need to do this kind of thing, you are at the right blog. There are 2 ways to do it i guess, i have the simple working way jotted here. Lets get started Consider the class @Component public class Foo { private static ObjectA objectA; // Static variable to be used in static method in class @Autowired ObjectA autowiredObjectA; // Orginal bean that is autowired @postConstruct public void init() {   Foo.objectA=this.autowiredObjectA; // So this method is responsible for handing out the bean after                                                                     the class is constructed and autowired by the spring                                                                                  container . :) } public static consumerMethod(args..) {   objectA.makeCall(); // making a call with the static auto

\r command not found. Cygwin script

You might have faced this error when creating a cygwin script, Even a simple script can replicate this issue #!/bin/sh date who ls ps ax ./deploy.sh ./deploy.sh: line 2: $'date\r': command not found ./deploy.sh: line 3: $'who\r': command not found https://cygwin.com/ml/cygwin-announce/2010-08/msg00015.html This page has the problem in detail.So the solution is #!/bin/sh # ~/.bashrc: executed by bash(1) for non-login shells. # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) # for examples (set -o igncr) 2>/dev/null && set -o igncr; # this comment is needed date who ls ps ax This line does the trick. Happy Cygwin scripting :)

Debugging the SSL Issues in Linux

First of all the JVM Needs to start in the Debug mode as many servers report the errors vaguely. It is better to start in Debug mode Add the JVM parameter -Djavax.net.debug=all After that before Even trying to run the transaction try to connect the server with the certificate using openssl openssl s_client -showcerts -connect 10.24.256.69:443 If the certificate is present it shows the last statement as Verify return code: 0 (ok) Check the link below for a more detailed tutorial. http://www.cyberciti.biz/faq/test-ssl-certificates-diagnosis-ssl-certificate/ If for some reason is receiving an error OpenSSL: socket: Connection refused connect:errno=111 It means that the PORT might be wrong in the connection. So we need to find the right port on which https is running. This can be done using nmap So what u do is nmap -sS 10.24.256.69 sample output for above command  Host is up (0.0051s latency). Not shown: 999 closed ports PORT    STATE SERVICE 443/tcp

Maven Eclipse heap Space Issue

Add this under JRe tab in Run configuration in eclipse -Xms1024m -Xmx3000m -XX:MaxPermSize=1024m -XX:+CMSClassUnloadingEnabled

counts of IllegalAnnotationExceptions @javax.xml.bind.annotation.XmlElement annotation is found on two places; one would be suffice.

So this happen when you annotate the filed this way @XmlElement(name = "Country") private String country; Throws an Error as below @javax.xml.bind.annotation.XmlElement annotation is found on two places; one would be suffice. this problem is related to the following location: at @javax.xml.bind.annotation.XmlElement(nillable=false, name=Country, defaultValue= The easy fix is to move the annotation to the setter method @XmlElement(name = "Country") public void setCountry(String country) { this.country = country; } This Works Fine.