Category: Java

  • Tomcat java.net.BindException: Cannot assign requested address: JVM_Bind

    Today I started getting this weird looking exception while launching tomcat. [sourcecode language=”java”] SEVERE: StandardServer.await: create[localhost:8005]: java.net.BindException: Cannot assign requested address: JVM_Bind at java.net.DualStackPlainSocketImpl.bind0(Native Method) at java.net.DualStackPlainSocketImpl.socketBind(DualStackPlainSocketImpl.java:96) at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376) at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:175) at java.net.ServerSocket.bind(ServerSocket.java:376) at java.net.ServerSocket.<init>(ServerSocket.java:237) at org.apache.catalina.core.StandardServer.await(StandardServer.java:427) at org.apache.catalina.startup.Catalina.await(Catalina.java:766) at org.apache.catalina.startup.Catalina.start(Catalina.java:712) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:451) [/sourcecode]…

  • Full Text Search with Hibernate Search 4.1, Lucene and JPA

    Earlier we worked directly with Lucene API to create and search index Index and Search a Directory using Apache Lucene Create Lucene Index in database using JdbcDirectory”> Instead we can use HibernateSearch which internally uses Lucene functionality to index and search content. With that let’s get some code behind us. We will extend our code from JPA…

  • JPA OneToMany Unidirectional without Join Table

    In earlier post we had OneToMany uni-directional mapping with the help of JoinTable. In this post we will see how can we make it unidirectional without using JoinTable. Let’s create our eclipse project and then add update our pom.xml. pom.xml [sourcecode language=”xml”] <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot; xmlns="http://maven.apache.org/POM/4.0.0&quot; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot; > <modelVersion>4.0.0</modelVersion> <groupId>com.mumz.test.hibernatesearch</groupId> <artifactId>MumzHibernateSearch</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>MumzHibernateSearch</name> <url>http://maven.apache.org</url&gt;…

  • JPA OneToMany Unidirectional with Join Table

    In earlier post we had OneToMany bi-directional mapping. In this post we will see how can we make it unidirectional with the usage of a JoinTable. Let’s create our eclipse project and then add update our pom.xml. pom.xml [sourcecode language=”xml”] <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot; xmlns="http://maven.apache.org/POM/4.0.0&quot; xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd&quot; > <modelVersion>4.0.0</modelVersion> <groupId>com.mumz.test.hibernatesearch</groupId> <artifactId>MumzHibernateSearch</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>MumzHibernateSearch</name> <url>http://maven.apache.org</url&gt; <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>…

  • Integrating Spring Security 3.1 and JSF 2.0

    Today in this tutorial we will integrate our JSF 2.0 application with Spring Security 3.1. We will be using the basic security feature of Spring Security and later on we will expand on this. What we need JDK Eclipse Spring Core Spring Security Some additional jars Project Creation Create a new “Dynamic Web Project” In…

  • Integrate LDAP and Spring Security 3.1 for Authentication and Authorization in a JSF 2.0 Application.

    Backtracking all our previous tutorial you will notice we always had our user definition with password placed in our database. Not every time this will be the case and frequently we will have to integrate our application with LDAP. In this tutorial we will integrate our earlier application with Apache Directory Services. If you don’t…

  • Configuring Apache DS in Eclipse

    Lightweight Directory Access Protocol aka LDAP is a protocol used for maintaining data over distributed ENV. Most of the organization will use LDAP for holding there user information and more often then not in almost all our application we will authenticate user against LDAP. In this post we will configure Apache Directory which is built…

  • Create Lucene Index in database using JdbcDirectory

    In our last post we built a simple index over file system. While our example works fine but cannot be extended over clustered environment and also cannot be used for a large document because of memory foot print. Lucene doesn’t provide a direct in built JDBC interface but Compass does, though the JDBC interface of…

  • Secure your business layer with Spring Security Annotation

    In the last post we secured our business layer with JSR-250 annotation. Spring Security provides similar functionality. In this tutorial we will use @PreAuthorize annotation to secure our business model built earlier. First change is in our BusinessModel.java where we move from @RolesAllowed to @PreAuthorize, one reason why you would need Spring Security annotation is…

  • Integrating Apache Lucene and Maven in Eclipse

    In two steps we will integrate Apache Lucene and Maven in Eclipse. First Create Java Project using Maven in Eclipse Second add lucene dependency in your pom.xml, so you pom.xml should look like this: pom.xml [sourcecode language=”xml”] <project xmlns="http://maven.apache.org/POM/4.0.0&quot; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot; xsi:schemaLocation= "http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt; <modelVersion>4.0.0</modelVersion> <groupId>com.mumz.test.lucene</groupId> <artifactId>ApacheLuceneTest</artifactId> <version>0.0.1-SNAPSHOT</version> <name>ApacheLuceneTest</name> <description>ApacheLuceneTest</description> <dependencies> <dependency> <artifactId>lucene-core</artifactId> <groupId>org.apache.lucene</groupId> <type>jar</type> <version>3.6.1</version> </dependency>…