Learn how to use the Spring LDAP APIs to authenticate and search for users, as well as to create and modify users in the directory server.
Source: Spring LDAP Overview | Baeldung
Posted by Venkatt Guhesan on March 13, 2017
Learn how to use the Spring LDAP APIs to authenticate and search for users, as well as to create and modify users in the directory server.
Source: Spring LDAP Overview | Baeldung
Posted in Spring, Spring Framework | Tagged: Java, Spring, Spring Framework, LDAP, OpenLDAP, Apache OpenLDAP, Apache | Leave a Comment »
Posted by Venkatt Guhesan on November 3, 2016
If you’re implementing any projects with Spring and Gradle (for build), as your project grows you may run into this issue. Or you’ve landed on this page by searching on Google for “Unable to locate Spring NamespaceHandler for XML schema namespace” (your actual XML that it’s error-ing out may vary).
Either way, you’re in luck! Most likely, you’re using the fatjar gradle plugin to create a single JAR for executing as “java -jar one-big-bundle.jar”. The problem that happens is that if two or more dependent jar libraries contain the same file/artifact, then the last one wins the race in the fatjar bundle.
Let me illustrate this with an example:
Let’s say that your project depends on Spring-Context and Spring-Core. Within each jar, there maybe resources that have a common name such as META-INF/spring.schemas and/or META-INF/spring.handler (To learn more about the two individual files and their purpose in Spring, click on the links). When the fatjar combines the two JAR file, depending upon who goes last, the version of the above two files may belong to one or the other library. What should happen in reality is that it merges the two files contents. They maybe good for some files. But if you have a specific file in a format where you simply cannot concatenate the two files (such as a nested XML or JSON), simply combining the two files will not work. You may need to extend the Gradle plugin tasks to perform something selective and unique to your situation.
But if you ended up here after searching for “Unable to locate Spring NamespaceHandler for XML schema namespace” message, there is hope. You can simply, add the following to the fatJar Gradle plugin and problem is solved:
fatJarPrepareFiles {
include 'META-INF/spring.handlers'
include 'META-INF/spring.schemas'
}
A second option is to use a newer plugin called shadow. [User Guide]
...
apply plugin: 'com.github.johnrengelman.shadow'
...
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.4'
}
}
...
//For building a single jar with all dependencies run "gradlew shadowJar"
// Configure the shadow jar task
shadowJar {
mergeServiceFiles()
}
jar {
manifest {
attributes 'Implementation-Title': 'application name',
'Implementation-Version': version,
'Main-Class': 'com.guhesan.fooapp.Application'
}
}
Cheers!
Today’s Inspirational Quote:
…Bliss is not something to be got.
On the other hand you are always Bliss.
This desire [for Bliss] is born of the sense of incompleteness.
To whom is this sense of incompleteness? Enquire.
In deep sleep you were blissful.
Now you are not so.
What has interposed between that Bliss and this non-bliss?
It is the ego.
Seek its source and find you are Bliss.
- Ramana Maharishi|2nd link (Spiritual Teacher & one of the great minds of this century)
-AUM
Posted in Gradle, Grails, Spring, Spring Framework | Tagged: fatJar, Gradle, shadowJar, Spring Framework, spring.handlers, spring.schemas | Leave a Comment »
Posted by Venkatt Guhesan on September 12, 2010
When trying to integrate both Spring and GWT, one might encounter the following error in the Spring Eclipse IDE:
“java.net.InetAddress is a restricted class”. The problem happens when you try to use Spring configuration for your database. In my case, I was using Spring to update data back to a H2 database.
Well, here’s one way to deal with this issue. Disable the “Google App Engine”. Yes, based on my research, if you’re using GWT, you can disable Google App Engine and still continue your development with GWT.
You can right click on your project and go into properties. Under [Google] -> [App Engine], you can “uncheck” - use Google App Engine. And rebuild the application and resume your debugging.
This allows you to use Spring beans to persist your data in a database.
Cheers.
Posted in GWT, Java | Tagged: GWT, Spring, Spring Framework | 1 Comment »
Posted by Venkatt Guhesan on April 19, 2010
Sometimes it’s good to look at the svn repository for the reference sample that Spring Framework provides.
Here’s a quick link for that URL:
https://src.springframework.org/svn/spring-samples/
You can traverse through it via a HTTP(s) browser or you can download the latest samples via tools like TortiseSVN.
Here is a list of some of the projects samples that are available today:
spring-samples - Revision 431: /
* configuration-basic/
* jpetstore/
* mvc-ajax/
* mvc-basic/
* petcare/
* petclinic/
* petclinic-groovy/
* spring-travel/
* task-basic/
* templates/
* tutorials/
Hopefully this article will be beneficial for someone who is trying to get familiar with Spring Framework.
Cheers.
Posted in Java, Programming, Spring, Spring Framework | Tagged: samples, Spring, Spring Framework | Leave a Comment »