Spring Batch and JiBX: how to debug? - spring-batch

I am testing Spring Batch 2.1.9 on Spring ToolSuite 3.1.0.RELEASE Build Id: 201210061306.
All the depend jars are contained inside the project thro' Gradle/Maven.
I compiled my schema using JiBX on JDK1.6 and run the Spring Batch test program on JDK1.7.
But I got issue with JiBX (1.2.4.5):
The schema jar for my source schema should be correct (i.e. contains the JiBX_binding*" classes) as the job using this jibx-marshaller did complete but only the readcount is zero.
Any hint and recommendation is welcome.
Thanks

Related

Spring Roo. Deleting .aj archives without generating new ones

I have installed the Roo Shell 2.0.0.RELEASE in my eclipse. I have never worked with Roo, but, as I understood, it will regenerate the .aj files of my imported roo project when I modify something in them.
However, when you open the projects, it just delete the .aj with commands like this:
roo> Deleted SRC_MAIN_JAVA\com\bbva\front\oorg\cirbe\cirbedaos\dto\vinculaciones\DetalleVinculacionesDaoOutDto_Roo_JavaBean.aj - not required for governor com.bbva.front.oorg.cirbe.cirbedaos.dto.vinculaciones.DetalleVinculacionesDaoOutDto
I don't know if I should write or configure something else, since most manuals I see only say that the Shell should generate these files automatically. Any idea about what im missing?
Indicate that I think the project used to work with shell 1.1.5 (i imported an existing project), but I was unable to open it, so I used 2.0.0. It is assumed that Roo has also updated this in the POM files:
Updated ROOT\pom.xml [updated property 'roo.version' to '2.0.0.RELEASE'; updated property 'roo.version' to '2.0.0.RELEASE']
Spring Roo uses the annotations included in your .java files to generate the .aj files. Each version of Spring Roo could provide/deprecate different annotations. Spring Roo 2.x is a major update, and it does not support some of the annotations of Spring Roo 1.x
https://docs.spring.io/spring-roo/docs/current/reference/html/#no-backward-compatibility
As you said, the project was created with the 1.x version of Spring Roo, so the generated code included annotations that are not supported by the 2.x version of Spring Roo. That is the reason because your .aj files are being removed with the message not required for governor.
Also, I guess that a warning message appeared to you in the Spring Roo shell before to open the project.
Hope it helps.

Spring Batch Project with Annotation Integrated with Spring Batch Admin

I have a Spring Batch Project which uses annotation based configurations and is a working code by itself. I now want to integrate this with a new Spring Batch Admin project.
I tried some solutions available/answered in the blogs, like adding dependency of batch project to the batch admin project and modifying the META-INF/spring/batch/servlet/override/context-config.xml file to point to the batch project config file.
i.e. . The com.sample.springbatch.job package is present in the Spring Batch project.
However, I am not successful with the integration.
Can anybody point me to or suggest a solution where Spring Batch Project - Annotation Based is integrated with Spring Batch Admin project.
Thank you!
Sonali
I tried this with Batch Admin 2.0.0, you don't want to use #EnableBatchProcessing which is already provided with Spring Batch Admin rather you may use #EnableBatchAdmin. I've added the code in github

Facing Spring Roo issue while converting JPA project to non-JPA project

I have a Spring - JPA project generated using Spring Roo. Now for some requirement we are replacing our JPA layer with some other framework (MyBatis) which is not JPA-compliant. I have done the changes and they are working fine also. I have removed all the JPA dependencies from my pom.xml file.
I am facing issues with my JUnit test project which is used to test DAO layer. Spring Roo is looking for the javax.persistence.Entity class which is part of JPA specific jar.
Please find below the error details below:
can't determine annotations of missing type javax.persistence.Entity
when weaving type ****.**.***Test
when weaving classes
when weaving
when batch building BuildConfig[null] #Files=12 AopXmls=#0
[Xlint:cantFindType]
error at (no source information available
Can anyone please advise me how to remove this error without adding a JPA dependency?
You could try to make a push-in from your test .aj file to the related .java file and then remove the necessary code (imports, annotations) that makes that your Spring Roo shell shows that error.
If you are not sure about how to make a push-in, you could read Spring Roo 1.3.2.RELEASE documentation http://docs.spring.io/spring-roo/docs/1.3.2.RELEASE/reference/html/removing.html#removing-step-by-step-1
Regards,

Walkthrough the spring source code

I wanted to walkthrough the spring code. For that I cloned the code and built it using ./import-into-eclipse.sh command. There are some instructions given in README.md file for checking out source in eclipse.
After following above instructions I was able to see the spring code in my eclipse workspace. To refer the spring source from my project I added all of spring projects (like spring-beans, spring-aop etc) in my project's Java build path. I was able to use spring code in my project.
Now the issue is that whenever I run the test cases in my project, I get initialization error. I removed spring projects from my java build path and junit test started working.
I tried to dig into the issue. For that I tried to run some of the test cases of spring projects itself like BeanUtilsTests.
but I got:
Class not found org.springframework.beans.BeanUtilsTests
java.lang.ClassNotFoundException: org.springframework.beans.BeanUtilsTests
I verified that classpath is set:
Don't know what is the issue. Can someone please tell me that what I did wrong.
Is there any better way to view/edit spring code?
Usually the below error,
Class not found org.springframework.beans.BeanUtilsTests
java.lang.ClassNotFoundException: org.springframework.beans.BeanUtilsTests
occurs when the corresponding jar is missing in the classpath. Since you have already added the spring-beans jar manually, I suspect you are using an incompatible version of the spring-beans jar with your spring-boot.
You can check the Maven repo Spring Beans to check the compatible version. But I would suggest using a dependency management tool like Gradle or Maven to include the required dependency jars. Spring-Boot Gradle file

Running a Map Reduce Program in Eclipse

I have a Map/Reduce program which loads a file and reads it into hbase. How do I execute my program through Eclipse? I googled and found 2 ways:
1) Using Eclipse Hadoop plugin
2) Create a jar file and execute it in Hadoop server
But, can I execute my Map/Reduce program by giving connection details and run in eclipse? Can any one tell me the exact procedure to run an Hbase Map/Reduce program?
I have done the following:
Installed and configured hadoop (and hdfs) on my machine
Built a maven-ized java project with all of the classes for my hadoop job
One of those classes is my "MR" or "Job" class that has a static main method that configures and submits my hadoop job
I run the MR class in Eclipse as a java application
The job runs in hadoop using the libraries in the java project's classpath (and therefore doesn't show up in the job tracker). Any reference to HDFS files uses the HDFS file system you installed and formatted using the non-eclipse hadoop install.
This works great with the debugger in Eclipse, although JUnit tests are kind of a pain to build by hand.