Category Archives: Java

JSF ViewState Hack Attempt: java.lang.StringIndexOutOfBoundsException: String index out of range: -1 – com.sun.faces.renderkit.ServerSideStateHelper.getState (ServerSideStateHelper.java:313)

Hack Attempt on JSF ViewState

This article explains why the error java.lang.StringIndexOutOfBoundsException: String index out of range: -1 in the class ServerSideStateHelper in the method getState (313) might be someone trying to hack your application server. It is getting quite technical in here… but bear with me… it’s really interesting. I also break down the actual attack to demonstrate what the attacker was trying to do.

Continue reading

WildFly 10 with Apache and AJP

This article demonstrates how inbound request from a webserver (Apache) can be proxied to an application server (WildFly 10) using the Apache JServ Protocol (AJP). For more information on what AJP actually is, take a look at https://en.wikipedia.org/wiki/Apache_JServ_Protocol .

WildFly 10 Configuration

First you have to add an ajp-listener to the undertow subsystem (line 4).

standalone.xml –  undertow subsystem:

Then you also have to add a socket-binding (line 4).

Continue reading

EJB Remoting with Wildfly

In Java Enterprise, the EJB (Enterprise Java Bean) technology is often used to create a service layer of a J2EE application running in an application Server (like Glassfish or Wildfly). While accessing these EJB instance is relatively easy from inside the same application (using  @Inject  or  @EJB  annotations for automatic dependency injection), it is sometimes also required to call some methods on the EJBs from outside the application server.

The JavaEE standard provides the “EJB remoting” functionality to do so. In this article I want to show how to access an EJB running in a Wildfly application server from a standalone Java application.

All code examples are also available on our Github page: https://github.com/illucIT/remote-ejb-example

Continue reading

Running Solr 4.10.3 with Maven, Eclipse 4.4 and Wildfly 8.1.0

The basic setup of Solr 4.10 with Eclipse 4.4 and Wildfly 8.1 requires quite a bit of configuration. First of all, be sure that your system fulfills the following requirements.

Prerequisites

  • Java Development Kit (jdk1.8.0_25)
  • Eclipse Java EE IDE for Web Developers (Luna Service Release 1 (4.4.1))
  • Apache Maven (already included in Eclipse)
  • WildFly Application Server (wildfly-8.1.0.Final)
  • JBossAS Tools (3.0.0.CR1) for Eclipse)

The specified version numbers are the versions I’m using. The tutorial should however apply to other major versions, too.

Continue reading