Struts -Hello World – HTTP Status [404]

I am simply trying to created Hello World Struts Application . I have implemented every possible configuration , Still 404 error didnot resolved . My Server config and Project Structure Index.jsp <%@ page language=”java” contentType=”text/html; charset=ISO-8859-1″ pageEncoding=”ISO-8859-1″%> <%@ taglib prefix=”s” uri=”/struts-tags”%> <!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “”> <html> <head> <title>Hello World</title> </head> <body> … Continue reading “Struts -Hello World – HTTP Status [404]”

Do I need to install JRE8

I created a Java application with Java 8. I’ve deployed it to a server and got the following error: Exception in thread “main” java.lang.UnsupportedClassVersionError: Rest : Unsupported major.minor version 52.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass( at at at$100( at$ at$ at Method) at at java.lang.ClassLoader.loadClass( at sun.misc.Launcher$AppClassLoader.loadClass( at … Continue reading “Do I need to install JRE8”

Can a group of Thread (ThreadGroup) be started using Thread Pool ExecutorService or by any method at once?

I want to start all the threads from Thread Group at once. ThreadGroup1 obj = new ThreadGroup1(); ThreadGroup tg1 = new ThreadGroup(“Parent ThreadGroup”); Thread t1=new Thread(tg1, obj, “one”); Thread t2=new Thread(tg1, obj, “two”); Thread t3=new Thread(tg1, obj, “three”); t1.start(); t2.start(); t3.start();

Interfaces, Classes and Code Smell

Suppose I have the following interfaces: public interface GameObject { void viewDetails(); } public interface Weapon extends GameObject { void attack(); } //A weapon is not the only item reloadable. A container could be refilled. public interface Reloadable extends GameObject { void replenish (final int amount); } and Implementation: public final class ReloadableWeapon implements Reloadable, … Continue reading “Interfaces, Classes and Code Smell”

JodaTime show weeks in duration

I am trying to display the difference in time between two DateTimes in the following format: ? years, ? months, ? weeks, ? days, ? hours, ? minutes, ? seconds and ? milliseconds I’ve got it displaying almost like this, however it does not display the weeks. I have tried using PeriodType.standard(), but that omits … Continue reading “JodaTime show weeks in duration”

How to inherit fields properly without making them open to the package?

Say, I have a package Pack containing classes A and B. A is self-contained and no one (even in the Pack) should see A‘s insides, so most of the fields and methods are private. Now I want to extend A to change one of its private methods keeping the rest – let it be class … Continue reading “How to inherit fields properly without making them open to the package?”

Spring Data Custom Method Error : No property xxx found for type

I’m trying to create base repository class to add new custom methods, but getting errors. @NoRepositoryBean public interface XRepository<T, ID extends Serializable> extends JpaRepository<T, ID> { Optional<T> xxx(ID id); } public class XRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRepository<T, ID> implements XRepository<T, ID> { private final EntityManager entityManager; public XRepositoryImpl(JpaEntityInformation entityInformation, EntityManager entityManager) { super(entityInformation, entityManager); … Continue reading “Spring Data Custom Method Error : No property xxx found for type”

Using JDBC to connect with AWS Redshift

I wanted to connect and insert data into my Amazon Redshift table using JDBC. I wrote the following code but keep getting an error at line Class.forName import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; import java.util.Properties; public class RedShiftDataEmitter { static final String redshiftUrl = “jdbc:redshift://xxxxxxxxx:5439/xxxxxx”; static final String masterUsername = “xxxxxxx”; static final … Continue reading “Using JDBC to connect with AWS Redshift”