I am trying to build an app as a learning experience. I am getting a null pointer exception, but it is happening the second time the code is being called.
So my code calls this as part of it's startup.
// Sanity checks
sanity = new SanityChecks();
logger.info("Checking sanity...");
try {
sanity.doBasicChecks();
logger.info("It all looks sane.");
}
catch( final Exception ex){
logger.error("Something is wrong, we are not sane. Aborting...", ex);
stop();
}
Other classes are:
package nz.co.great_ape.tempusFugit;
import com.almworks.sqlite4java.SQLite;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
/**
* Checks to see if all is ok for standard usage of tempusFugit.
*
* Checks for valid paths, existing database etc, if not assumes that
* this is the first time tempusFugit has been run for this user and
* tries to set up the basic files and data.
*
* #author Rob Brown-Bayliss
* Created on 2/11/14
*/
public class SanityChecks {
public static final Logger logger = LoggerFactory.getLogger(AppConsts.LOGGER_NAME);
public SanityChecks() {
// todo
// todo
SQLite.setLibraryPath(AppConsts.HOME_DIR); // TODO: Why is this required? can we not place the native libs somewhere else or in the jar?
// todo
// todo
}
/**
* Performs basic checks to see if it is ok to run the app. If not it will attempt to
* set up for first time use.
*
* #return true if all is ok
*/
public boolean doBasicChecks() {
logger.info("Starting basic checks...");
if (!HomeDirExists()) {
return false;
}
if (!DatabaseExists()) {
logger.info("Trying to create a new database.");
DatabaseUpgrade dug = new DatabaseUpgrade();
if (!dug.upGrade()) {
return false;
}
logger.info("Created a new database.");
// At this point a usable database should exist and it should be current
}
if (!DatabaseVersionCorrect()) {
// // If the database is old we will upgrade it to the current version.
// DatabaseUpgrade dug = new DatabaseUpgrade();
// if (!dug.upGrade()) {
// return false;
// }
logger.info("is this it?.");
}
// At this point all basic checks have passed and we are good to go...
logger.info("Basic checks are complete. All is good in the universe...");
return true;
}
/**
* Checks if the app home directory exists, if not it tries to create it.
*
* #return true if exists or was able to create the directory
*/
private boolean HomeDirExists() {
if (!Files.isDirectory(Paths.get(AppConsts.HOME_DIR))) {
try {
Files.createDirectory(Paths.get(AppConsts.HOME_DIR));
}
catch (IOException io) {
logger.error("The directory " + AppConsts.HOME_DIR + " does not exist and could not be created. This is not the best but we can survive.", io);
return false;
}
}
logger.info("The directory " + AppConsts.HOME_DIR + " exists. This is good.");
return true;
}
/**
* Checks if the SQLite database exists, if not it tries to create it.
* or was able to create the database
*
* #return true if the database exists
*/
private boolean DatabaseExists() {
if (Files.notExists(Paths.get(AppConsts.TF_DATABASE))) {
logger.error("The database " + AppConsts.TF_DATABASE + " does not exist. This is bad.");
return false;
}
logger.info("The database " + AppConsts.TF_DATABASE + " exists. This is good.");
return true;
}
/**
* Checks if the SQLite database is correct for this version.
*
* #return true if correct version
*/
private boolean DatabaseVersionCorrect() {
Integer expectedVersion = AppConsts.TF_DATABASE_VERSION;
logger.info("Checking the database version is correct. Looking for version "+ expectedVersion + "." );
DatabaseUpgrade dug = new DatabaseUpgrade();
logger.info("Checking the database version is correct. Looking for version "+ expectedVersion + "." );
Integer currentVersion = dug.getVersion();
if (currentVersion < expectedVersion) {
logger.info("Expected version " + expectedVersion + ", but database is version " + currentVersion + ". This is bad.");
return false;
}
logger.info("The database version is correct. This is good.");
return true;
}
}
And:
package nz.co.great_ape.tempusFugit;
import com.almworks.sqlite4java.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
/**
* Setup the database for current version tempusFugit. This will upgrade an
* existing database or create a new empty database if required.
*
* #author Rob Brown-Bayliss
* Created on 4/11/14
*/
public class
DatabaseUpgrade {
public static final Logger logger = LoggerFactory.getLogger(AppConsts.LOGGER_NAME);
private SQLiteConnection dbConn = null;
private SQLiteQueue sQueue = null;
private int currentVersion;
public DatabaseUpgrade() {
}
/**
* Attempts to upgrade the existing database to the current version, or if
* there is no existing database then create one suitable for the current app version.
*
* #return true if there is a current and usable database
*/
public boolean upGrade() {
logger.info(" Started an upgrade on the database, if the database does not exist it will be created at the current version, ");
logger.info(" if it exists but is an older version it will be upgraded to the current version.");
if (openDatabase()) {
currentVersion = getVersion();
if (currentVersion == AppConsts.FAIL) {
logger.info("Database version is unknown. The file will be deleted and a new database created. We can survive this.");
// TODO: Ask user if we should delete the old one or make a backup?
closeDatabase();
deleteDatabase();
openDatabase();
}
if (currentVersion != AppConsts.TF_DATABASE_VERSION) {
logger.info("Current Database version is " + currentVersion);
// TODO: Backup current database.
if (currentVersion < 1) {
if (!makeVersionOne()) {
logger.error("Unable to upgrade the database. This is VERY bad.");
return false;
}
}
currentVersion = 1;
}
closeDatabase(); // good practice
}
logger.info("The database is the current version. This is good.");
return true;
}
/**
* Turns a blank SQLite database into a tempusFugit version 1 database by
* adding the required tables and data.
*/
private boolean makeVersionOne() {
logger.info("Attempting to upgrade to version 1.");
String CT_SQL = "CREATE TABLE IF NOT EXISTS dbVersion (id INTEGER PRIMARY KEY AUTOINCREMENT, version INTEGER NOT NULL UNIQUE, ";
CT_SQL = CT_SQL + "upgraded INTEGER(4) NOT NULL DEFAULT (strftime('%s','now'))); ";
String IN_SQL = "INSERT INTO dbVersion(version) values (1); ";
try {
execSQL("BEGIN TRANSACTION; ");
execSQL(CT_SQL); // create the table
execSQL(IN_SQL); // insert the record
execSQL("COMMIT; ");
}
catch (Exception ex) {
logger.error("Attempted upgrade of " + AppConsts.TF_DATABASE + " to version 1 has failed. This is VERY bad.", ex);
return false;
}
logger.info("The database has been upgraded to version 1. This is good.");
return true;
}
private Integer execSQL(String SQL) {
return sQueue.execute(new SQLiteJob<Integer>() {
protected Integer job(SQLiteConnection con) throws SQLiteException {
SQLiteStatement st = null;
try {
st = con.prepare(SQL);
st.step();
return AppConsts.SUCCESS;
}
catch (Exception ex) {
logger.error("Tried to execute SQL: " + SQL, ex);
return AppConsts.FAIL;
}
finally {
if (st != null) {
st.dispose();
}
}
}
}).complete();
}
/**
* Gets the current database version
*
* #return version as an int
*/
public int getVersion() {
return sQueue.execute(new SQLiteJob<Integer>() {
protected Integer job(SQLiteConnection con) throws SQLiteException {
SQLiteStatement st = null;
try {
st = con.prepare("SELECT version, upgraded FROM dbVersion ORDER BY upgraded DESC LIMIT 1;");
st.step();
return st.columnInt(0);
}
catch (Exception ex) {
logger.error("The database version of " + AppConsts.TF_DATABASE + " is unknown. This is bad.", ex);
return AppConsts.FAIL;
}
finally {
if (st != null) {
st.dispose();
}
}
}
}).complete();
}
/**
* Opens an existing SQLite database or creates a new blank database
* if none exists.
*
* #return false if there is a problem. // TODO: Is it possible to have a problem?
*/
private boolean openDatabase() {
try {
dbConn = new SQLiteConnection(new File(AppConsts.TF_DATABASE));
dbConn.open(true);
sQueue = new SQLiteQueue(new File(AppConsts.TF_DATABASE));
sQueue.start();
return true;
}
catch (Exception ex) {
logger.error("The database " + AppConsts.TF_DATABASE + " could not be opened or created. This is VERY bad.", ex);
return false;
}
}
/**
* Closes an open database.
*
* #return false if there is a problem. // TODO: Is it possible to have a problem?
*/
private boolean closeDatabase() {
try {
if (dbConn != null) {
dbConn.dispose();
}
return true;
}
catch (Exception ex) {
logger.error("The database " + AppConsts.TF_DATABASE + " could not be closed.", ex);
return false;
}
}
/**
* Deletes an existing database.
*
* #return false if there is a problem. // TODO: Is it possible to have a problem?
*/
private boolean deleteDatabase() {
try {
Files.delete(Paths.get(AppConsts.TF_DATABASE));
logger.info("The database " + AppConsts.TF_DATABASE + " has been deleted.");
return true;
}
catch (Exception ex) {
logger.error("The database " + AppConsts.TF_DATABASE + " could not be deleted.", ex);
return false;
}
}
}
Plus the constants:
package nz.co.great_ape.tempusFugit;
/**
* Constants used by tempusFugit
*
* #author Rob Brown-Bayliss
* Created on 31/10/14
*/
public class AppConsts {
// Application
public static final String APP_NAME = "Tempus Fugit";
public static final String VERSION_NUMBER = "0.0.1";
// Debug Mode On-Off
public static final boolean DEBUG_MODE = true;
// Data files and paths
public static final String FS = System.getProperty("file.separator");
public static final String HOME_DIR = System.getProperty("user.home") + FS + ".tempusFugit"; // This is the tempusFugit home, not the users home.
public static final String USER_NAME = System.getProperty("user.name");
public static final String LOGGER_NAME = "nz.co.great_ape.tempusFugit";
public static final String LOG_FILE = HOME_DIR + FS + "tempusFugit.log";
// Database
public static final String TF_DATABASE = HOME_DIR + FS + "tfData.sql";
public static final int TF_DATABASE_VERSION = 1; // This is the current version of the database
// Error codes
public static final int UNKNOWN = -1;
public static final int FAIL = 0;
public static final int SUCCESS = 1;
}
What I don't know is why the call if (!DatabaseVersionCorrect()) crashes with a null pointer.
Can anyone help here?
This is the stack trace
/usr/lib/jvm/java-8-oracle/bin/java -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:49764,suspend=y,server=n -javaagent:/home/rob/Projects/IntelliJ/plugins/Groovy/lib/agent/gragent.jar -Dfile.encoding=UTF-8 -classpath /usr/lib/jvm/java-8-oracle/jre/lib/jsse.jar:/usr/lib/jvm/java-8-oracle/jre/lib/management-agent.jar:/usr/lib/jvm/java-8-oracle/jre/lib/deploy.jar:/usr/lib/jvm/java-8-oracle/jre/lib/javaws.jar:/usr/lib/jvm/java-8-oracle/jre/lib/plugin.jar:/usr/lib/jvm/java-8-oracle/jre/lib/resources.jar:/usr/lib/jvm/java-8-oracle/jre/lib/jfr.jar:/usr/lib/jvm/java-8-oracle/jre/lib/jfxswt.jar:/usr/lib/jvm/java-8-oracle/jre/lib/rt.jar:/usr/lib/jvm/java-8-oracle/jre/lib/jce.jar:/usr/lib/jvm/java-8-oracle/jre/lib/charsets.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/sunec.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/zipfs.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/jfxrt.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/nashorn.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-8-oracle/jre/lib/ext/cldrdata.jar:/home/rob/Projects/tempusFugit/build/classes/main:/home/rob/Projects/tempusFugit/build/resources/main:/home/rob/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-api/1.7.7/2b8019b6249bb05d81d3a3094e468753e2b21311/slf4j-api-1.7.7.jar:/home/rob/.gradle/caches/modules-2/files-2.1/com.almworks.sqlite4java/sqlite4java/1.0.392/d6234e08ff4e1607ff5321da2579571f05ff778d/sqlite4java-1.0.392.jar:/home/rob/.gradle/caches/modules-2/files-2.1/ch.qos.logback/logback-classic/1.1.2/b316e9737eea25e9ddd6d88eaeee76878045c6b2/logback-classic-1.1.2.jar:/home/rob/.gradle/caches/modules-2/files-2.1/ch.qos.logback/logback-core/1.1.2/2d23694879c2c12f125dac5076bdfd5d771cc4cb/logback-core-1.1.2.jar:/home/rob/Projects/IntelliJ/lib/idea_rt.jar nz.co.great_ape.tempusFugit.MainApp
Connected to the target VM, address: '127.0.0.1:49764', transport: 'socket'
10:43:43.371 [JavaFX Application Thread] INFO nz.co.great_ape.tempusFugit - Time flies...
10:43:43.379 [JavaFX Application Thread] INFO nz.co.great_ape.tempusFugit - https://www.youtube.com/watch?v=ESto79osxOY
10:43:43.379 [JavaFX Application Thread] INFO nz.co.great_ape.tempusFugit - Tempus Fugit Version: 0.0.1
10:43:43.379 [JavaFX Application Thread] INFO nz.co.great_ape.tempusFugit - javafx.runtime.version: 8.0.25-b17
10:43:43.380 [JavaFX Application Thread] INFO nz.co.great_ape.tempusFugit - logged on as: rob
10:43:43.383 [JavaFX Application Thread] INFO nz.co.great_ape.tempusFugit - Checking sanity...
10:43:43.383 [JavaFX Application Thread] INFO nz.co.great_ape.tempusFugit - Starting basic checks...
10:43:43.393 [JavaFX Application Thread] INFO nz.co.great_ape.tempusFugit - The directory /home/rob/.tempusFugit exists. This is good.
10:43:43.394 [JavaFX Application Thread] ERROR nz.co.great_ape.tempusFugit - The database /home/rob/.tempusFugit/tfData.sql does not exist. This is bad.
10:43:43.394 [JavaFX Application Thread] INFO nz.co.great_ape.tempusFugit - Trying to create a new database.
10:43:43.397 [JavaFX Application Thread] INFO nz.co.great_ape.tempusFugit - Started an upgrade on the database, if the database does not exist it will be created at the current version,
10:43:43.397 [JavaFX Application Thread] INFO nz.co.great_ape.tempusFugit - if it exists but is an older version it will be upgraded to the current version.
Nov 30, 2014 10:43:43 AM com.almworks.sqlite4java.Internal log
INFO: [sqlite] DB[1]: instantiated [/home/rob/.tempusFugit/tfData.sql]
Nov 30, 2014 10:43:43 AM com.almworks.sqlite4java.Internal log
INFO: [sqlite] Internal: loaded sqlite4java-linux-amd64-1.0.392 from /home/rob/.tempusFugit/libsqlite4java-linux-amd64-1.0.392.so
Nov 30, 2014 10:43:43 AM com.almworks.sqlite4java.Internal log
INFO: [sqlite] Internal: loaded sqlite 3.8.7, wrapper 1.3
Nov 30, 2014 10:43:43 AM com.almworks.sqlite4java.Internal log
INFO: [sqlite] DB[1]: opened
Nov 30, 2014 10:43:43 AM com.almworks.sqlite4java.Internal log
INFO: [sqlite] DB[2]: instantiated [/home/rob/.tempusFugit/tfData.sql]
Nov 30, 2014 10:43:43 AM com.almworks.sqlite4java.Internal log
INFO: [sqlite] DB[2]: opened
Nov 30, 2014 10:43:43 AM com.almworks.sqlite4java.Internal log
INFO: [sqlite] DB[1]: connection closed
Nov 30, 2014 10:43:43 AM com.almworks.sqlite4java.Internal log
INFO: [sqlite] DB[3]: instantiated [/home/rob/.tempusFugit/tfData.sql]
Nov 30, 2014 10:43:43 AM com.almworks.sqlite4java.Internal log
INFO: [sqlite] DB[3]: opened
10:43:43.507 [SQLiteQueue[tfData.sql]] ERROR nz.co.great_ape.tempusFugit - The database version of /home/rob/.tempusFugit/tfData.sql is unknown. This is bad.
com.almworks.sqlite4java.SQLiteException: [1] DB[2] prepare() SELECT version, upgraded FROM dbVersion ORDER BY upgraded DESC LIMIT 1; [no such table: dbVersion]
at com.almworks.sqlite4java.SQLiteConnection.throwResult(SQLiteConnection.java:1436) ~[sqlite4java-1.0.392.jar:392]
at com.almworks.sqlite4java.SQLiteConnection.prepare(SQLiteConnection.java:580) ~[sqlite4java-1.0.392.jar:392]
at com.almworks.sqlite4java.SQLiteConnection.prepare(SQLiteConnection.java:635) ~[sqlite4java-1.0.392.jar:392]
at com.almworks.sqlite4java.SQLiteConnection.prepare(SQLiteConnection.java:622) ~[sqlite4java-1.0.392.jar:392]
at nz.co.great_ape.tempusFugit.DatabaseUpgrade$2.job(DatabaseUpgrade.java:121) [main/:na]
at nz.co.great_ape.tempusFugit.DatabaseUpgrade$2.job(DatabaseUpgrade.java:117) [main/:na]
at com.almworks.sqlite4java.SQLiteJob.execute(SQLiteJob.java:372) [sqlite4java-1.0.392.jar:392]
at com.almworks.sqlite4java.SQLiteQueue.executeJob(SQLiteQueue.java:534) [sqlite4java-1.0.392.jar:392]
at com.almworks.sqlite4java.SQLiteQueue.queueFunction(SQLiteQueue.java:667) [sqlite4java-1.0.392.jar:392]
at com.almworks.sqlite4java.SQLiteQueue.runQueue(SQLiteQueue.java:623) [sqlite4java-1.0.392.jar:392]
at com.almworks.sqlite4java.SQLiteQueue.access$000(SQLiteQueue.java:77) [sqlite4java-1.0.392.jar:392]
at com.almworks.sqlite4java.SQLiteQueue$1.run(SQLiteQueue.java:205) [sqlite4java-1.0.392.jar:392]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_25]
10:43:43.508 [JavaFX Application Thread] INFO nz.co.great_ape.tempusFugit - Database version is unknown. The file will be deleted and a new database created. We can survive this.
10:43:43.509 [JavaFX Application Thread] INFO nz.co.great_ape.tempusFugit - The database /home/rob/.tempusFugit/tfData.sql has been deleted.
10:43:43.510 [JavaFX Application Thread] INFO nz.co.great_ape.tempusFugit - Current Database version is 0
10:43:43.510 [JavaFX Application Thread] INFO nz.co.great_ape.tempusFugit - Attempting to upgrade to version 1.
Nov 30, 2014 10:43:43 AM com.almworks.sqlite4java.Internal log
INFO: [sqlite] DB[4]: instantiated [/home/rob/.tempusFugit/tfData.sql]
Nov 30, 2014 10:43:43 AM com.almworks.sqlite4java.Internal log
INFO: [sqlite] DB[4]: opened
Nov 30, 2014 10:43:43 AM com.almworks.sqlite4java.Internal log
INFO: [sqlite] DB[3]: connection closed
10:43:43.640 [JavaFX Application Thread] INFO nz.co.great_ape.tempusFugit - The database has been upgraded to version 1. This is good.
10:43:43.640 [JavaFX Application Thread] INFO nz.co.great_ape.tempusFugit - The database is the current version. This is good.
10:43:43.640 [JavaFX Application Thread] INFO nz.co.great_ape.tempusFugit - Created a new database.
10:43:43.640 [JavaFX Application Thread] INFO nz.co.great_ape.tempusFugit - Checking the database version is correct. Looking for version 1.
10:43:43.640 [JavaFX Application Thread] INFO nz.co.great_ape.tempusFugit - Checking the database version is correct. Looking for version 1.
10:43:43.641 [JavaFX Application Thread] ERROR nz.co.great_ape.tempusFugit - Something is wrong, we are not sane. Aborting...
java.lang.NullPointerException: null
at nz.co.great_ape.tempusFugit.DatabaseUpgrade.getVersion(DatabaseUpgrade.java:117) ~[main/:na]
at nz.co.great_ape.tempusFugit.SanityChecks.DatabaseVersionCorrect(SanityChecks.java:111) ~[main/:na]
at nz.co.great_ape.tempusFugit.SanityChecks.doBasicChecks(SanityChecks.java:54) ~[main/:na]
at nz.co.great_ape.tempusFugit.MainApp.start(MainApp.java:78) ~[main/:na]
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$153(LauncherImpl.java:821) [jfxrt.jar:na]
at com.sun.javafx.application.LauncherImpl$$Lambda$56/1015064561.run(Unknown Source) [jfxrt.jar:na]
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$166(PlatformImpl.java:323) [jfxrt.jar:na]
at com.sun.javafx.application.PlatformImpl$$Lambda$50/591723622.run(Unknown Source) [jfxrt.jar:na]
at com.sun.javafx.application.PlatformImpl.lambda$null$164(PlatformImpl.java:292) [jfxrt.jar:na]
at com.sun.javafx.application.PlatformImpl$$Lambda$52/1657335803.run(Unknown Source) [jfxrt.jar:na]
at java.security.AccessController.doPrivileged(Native Method) [na:1.8.0_25]
at com.sun.javafx.application.PlatformImpl.lambda$runLater$165(PlatformImpl.java:291) [jfxrt.jar:na]
at com.sun.javafx.application.PlatformImpl$$Lambda$51/1166726978.run(Unknown Source) [jfxrt.jar:na]
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95) [jfxrt.jar:na]
at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method) [jfxrt.jar:na]
at com.sun.glass.ui.gtk.GtkApplication.lambda$null$45(GtkApplication.java:126) [jfxrt.jar:na]
at com.sun.glass.ui.gtk.GtkApplication$$Lambda$42/1167116739.run(Unknown Source) [jfxrt.jar:na]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_25]
10:43:43.641 [JavaFX Application Thread] INFO nz.co.great_ape.tempusFugit - Game Over...
10:43:44.563 [JavaFX Application Thread] INFO nz.co.great_ape.tempusFugit - Game Over...
The problem is te fact that you call
DatabaseUpgrade dug = new DatabaseUpgrade();
logger.info(...);
Integer currentVersion = dug.getVersion();
But your dbConn and sQueue in DatabaseUpgrade are still null. Since you didn't called the private openDatabase() method which initializes your varaibles. So When you call getVersion() your sQueue.execute(...) blowups because you cannot call a method on a null object.
Related
I have a simple java program trying to connect to the local instance of neo4j to create a sample database to play with but I keep getting;
Exception: Error starting org.neo4j.kernel.impl.factory.CommunityFacadeFactory, /home/mleonard/mbig/neodb/testeroo
Trace:[Ljava.lang.StackTraceElement;#7ce7d377
The stack trace is useless and the error is also not overly helpful.
The server is up and running
Starting Neo4j Server console-mode...
2015-08-11 15:28:06.466-0400 INFO Setting startup timeout to 120000ms
2015-08-11 15:28:23.311-0400 INFO Successfully started database
2015-08-11 15:28:25.920-0400 INFO Starting HTTP on port 7474 (24 threads available)
2015-08-11 15:28:26.972-0400 INFO Enabling HTTPS on port 7473
2015-08-11 15:28:28.247-0400 INFO Mounting static content at /webadmin
2015-08-11 15:28:28.704-0400 INFO Mounting static content at /browser
2015-08-11 15:28:30.321-0400 ERROR The class org.neo4j.server.rest.web.CollectUserAgentFilter is not assignable to the class com.sun.jersey.spi.container.ContainerRequestFilter. This class is ignored.
2015-08-11 15:28:31.677-0400 ERROR The class org.neo4j.server.rest.web.CollectUserAgentFilter is not assignable to the class com.sun.jersey.spi.container.ContainerRequestFilter. This class is ignored.
2015-08-11 15:28:32.165-0400 ERROR The class org.neo4j.server.rest.web.CollectUserAgentFilter is not assignable to the class com.sun.jersey.spi.container.ContainerRequestFilter. This class is ignored.
2015-08-11 15:28:33.031-0400 INFO Remote interface ready and available at http://localhost:7474/
And I can see that the database is created as the files and folders for the new database are created.
import java.io.File;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.RelationshipType;
import org.neo4j.graphdb.factory.GraphDatabaseFactory;
public class Main {
private static enum RelTypes implements RelationshipType
{
WORKS,
FRIENDS,
NEMISIS
}
public static void main(String[] args)
{
System.out.println("Starting ARM4J");
GraphDatabaseService db = null ;
try
{
db = new GraphDatabaseFactory().newEmbeddedDatabaseBuilder(new File("/home/mleonard/mbig/neodb/testeroo"))
.loadPropertiesFromFile("/home/mleonard/mbig/neo4j-community-2.3.0-M02/conf/neo4j.properties")
.newGraphDatabase();
/*
try( Transaction tx = db.beginTx() )
{
Node matty = db.createNode();
matty.setProperty("name", "Matthew");
matty.setProperty("age", "31");
matty.setProperty("sex", "male");
Node jay = db.createNode();
jay.setProperty("name", "Jay");;
jay.setProperty("age", "35");
jay.setProperty("sex", "male");
org.neo4j.graphdb.Relationship r = matty.createRelationshipTo(jay, RelTypes.WORKS);
r.setProperty("years", "2");
tx.success();
}
*/
}
catch(Exception x)
{
System.out.println("Exception: " + x.getMessage());
System.out.println("Trace:" + x.getStackTrace().toString());
}
finally
{
if( db != null )
{
db.shutdown();
}
}
System.out.println("Stopping ARM4J");
}
}
I am using the Matrikon OPC Server for Simulation and Testing, instead of TOPServer, along with the tutorial HowToStartWithUtgard. I am not able to connect to the server. This is the error that I get:
15:02:18.452 [main] DEBUG o.j.dcom.transport.JIComTransport - Socket closed... Socket[unconnected] host XXX.XXX.XX.X, port 135
15:02:18.453 [main] WARN org.jinterop.dcom.core.JIComServer - Got the class not registered exception , will attempt setting entries based on status flags...
15:02:18.468 [main] INFO org.openscada.opc.lib.da.Server - Failed to connect to server
org.jinterop.dcom.common.JIException: Class not registered. If you are using a DLL/OCX , please make sure it has "DllSurrogate" flag set. Faq A(6) in readme.html. [0x80040154]
at org.jinterop.dcom.core.JIComServer.init(Unknown Source) ~[org.openscada.jinterop.core_2.0.8.201303051454.jar:na]
at org.jinterop.dcom.core.JIComServer.initialise(Unknown Source) ~[org.openscada.jinterop.core_2.0.8.201303051454.jar:na]
at org.jinterop.dcom.core.JIComServer.<init>(Unknown Source) ~[org.openscada.jinterop.core_2.0.8.201303051454.jar:na]
at org.openscada.opc.lib.da.Server.connect(Server.java:117) ~[org.openscada.opc.lib_1.0.0.201303051455.jar:na]
at com.matrikonopc.utgard.tutorial.UtgardReadTutorial.main(UtgardReadTutorial.java:31) [bin/:na]
Caused by: org.jinterop.dcom.common.JIRuntimeException: Class not registered. If you are using a DLL/OCX , please make sure it has "DllSurrogate" flag set. Faq A(6) in readme.html. [0x80040154]
at org.jinterop.dcom.core.JIRemActivation.read(Unknown Source) ~[org.openscada.jinterop.core_2.0.8.201303051454.jar:na]
at ndr.NdrObject.decode(Unknown Source) ~[org.openscada.jinterop.deps_1.0.0.201303051454.jar:na]
at rpc.ConnectionOrientedEndpoint.call(Unknown Source) ~[org.openscada.jinterop.deps_1.0.0.201303051454.jar:na]
at rpc.Stub.call(Unknown Source) ~[org.openscada.jinterop.deps_1.0.0.201303051454.jar:na]
... 5 common frames omitted
15:02:18.469 [main] INFO org.openscada.opc.lib.da.Server - Destroying DCOM session...
15:02:18.470 [main] INFO org.openscada.opc.lib.da.Server - Destroying DCOM session... forked
80040154: Unknown error (80040154)
15:02:18.499 [OPCSessionDestructor] DEBUG org.openscada.opc.lib.da.Server - Starting destruction of DCOM session
15:02:18.500 [OPCSessionDestructor] INFO org.jinterop.dcom.core.JISession - About to destroy 0 sessesion which are linked to this session: 1325311425
15:02:18.500 [OPCSessionDestructor] INFO o.j.dcom.core.JIComOxidRuntime - destroySessionOIDs for session: 1325311425
15:02:18.500 [OPCSessionDestructor] INFO org.openscada.opc.lib.da.Server - Destructed DCOM session
15:02:18.501 [OPCSessionDestructor] INFO org.openscada.opc.lib.da.Server - Session destruction took 27 ms
I do not know where I should register the Class and what Class it refers to.
It is referring to the clsid you're attempting to use -- it is not in the registry. Can you double check that you're using the correct one for Matrikon OPC Simulation Server?
Working demo, tested on Windows 10 and Java 8.
User must have administrator rights on Windows.
Errors that might occur:
00000005: Login error (does the user has administrator rights !?)
8001FFFF: Firewall, RPC dynamic ports are not open (see below)
80040154: Double check CLSID in registry, below HKEY_CLASSES_ROOT
Firewall rules
netsh advfirewall firewall add rule^
name="DCOM-dynamic"^
dir=in^
action=allow^
protocol=TCP^
localport=RPC^
remoteport=49152-65535
rem the next one does not seems needed
netsh advfirewall firewall add rule name="DCOM" dir=in action=allow protocol=TCP localport=135
Java code
package demo.opc;
import java.util.concurrent.Executors;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.openscada.opc.lib.common.ConnectionInformation;
import org.openscada.opc.lib.da.AccessBase;
import org.openscada.opc.lib.da.DataCallback;
import org.openscada.opc.lib.da.Item;
import org.openscada.opc.lib.da.ItemState;
import org.openscada.opc.lib.da.Server;
import org.openscada.opc.lib.da.SyncAccess;
public class UtgardReaderDemo {
/**
* Main application, arguments are provided as system properties, e.g.<br>
* java -Dhost="localhost" -Duser="admin" -Dpassword="secret" -jar demo.opc.jar<br>
* Tested with a windows user having administrator rights<br>
* #param args unused
* #throws Exception in case of unexpected error
*/
public static void main(String[] args) throws Exception {
Logger.getLogger("org.jinterop").setLevel(Level.ALL); // Quiet => Level.OFF
final String host = System.getProperty("host", "localhost");
final String user = System.getProperty("user", System.getProperty("user.name"));
final String password = System.getProperty("password");
// Powershell: Get-ItemPropertyValue 'Registry::HKCR\Matrikon.OPC.Simulation.1\CLSID' '(default)'
final String clsId = System.getProperty("clsId", "F8582CF2-88FB-11D0-B850-00C0F0104305");
final String itemId = System.getProperty("itemId", "Saw-toothed Waves.Int2");
final ConnectionInformation ci = new ConnectionInformation(user, password);
ci.setHost(host);
ci.setClsid(clsId);
final Server server = new Server(ci, Executors.newSingleThreadScheduledExecutor());
server.connect();
final AccessBase access = new SyncAccess(server, 1000);
access.addItem(itemId, new DataCallback() {
public void changed(final Item item, final ItemState state) {
System.out.println(state);
}
});
access.bind();
Thread.sleep(10_000L);
access.unbind();
}
}
build.gradle
plugins {
id 'java-library'
id 'eclipse'
}
repositories {
mavenCentral()
}
dependencies {
implementation 'org.bouncycastle:bcprov-jdk15on:1.60'
implementation 'org.openscada.utgard:org.openscada.opc.lib:1.5.0'
}
jar {
manifest {
attributes(
'Class-Path': configurations.runtimeClasspath.collect { 'lib/' + it.getName() }.join(' '),
'Main-Class': 'demo.opc.UtgardReaderDemo'
)
}
}
assemble {
dependsOn 'dependenciesCopy'
}
task dependenciesCopy(type: Copy) {
group 'dependencies'
from sourceSets.main.compileClasspath
into "$libsDir/lib"
}
When I run the ejb3 remote client the service deployed in the server, WildFly8.1.0 Final I get the expected results. But now I am trying to benchmark this and when I run the client through the JMH #Benchmark method it runs fine for but after some iterations in warm up process it gives the following error.
Mar 04, 2015 12:29:15 PM org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver associate
INFO: EJBCLIENT000013: Successful version handshake completed for receiver context EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext#13689c
56, receiver=Remoting connection EJB receiver [connection=org.jboss.ejb.client.remoting.ConnectionPool$PooledConnection#25d8cd6c,channel=jboss.ejb,nodename=mast
er:server-three]} on channel Channel ID c1426f51 (outbound) of Remoting connection 3836a177 to /192.168.17.150:8330
Result is given by [ host: isurug ], [ Result: ONE ]
____ejb:poc_ear-1.0/poc_ejbs-1.0//DataGridServiceImpl!com.oms.ejbs.stateless.DataGridService
Mar 04, 2015 12:29:15 PM org.jboss.ejb.client.remoting.VersionReceiver handleMessage
INFO: EJBCLIENT000017: Received server version 2 and marshalling strategies [river]
Mar 04, 2015 12:29:15 PM org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver associate
INFO: EJBCLIENT000013: Successful version handshake completed for receiver context EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext#538da6
b, receiver=Remoting connection EJB receiver [connection=org.jboss.ejb.client.remoting.ConnectionPool$PooledConnection#25d8cd6c,channel=jboss.ejb,nodename=maste
r:server-three]} on channel Channel ID bed866b3 (outbound) of Remoting connection 3836a177 to /192.168.17.150:8330
Result is given by [ host: isurug ], [ Result: ONE ]
____ejb:poc_ear-1.0/poc_ejbs-1.0//DataGridServiceImpl!com.oms.ejbs.stateless.DataGridService
Mar 04, 2015 12:29:15 PM org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver$1 handleFailed
ERROR: Failed to open channel for context EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext#62af85f9, receiver=Remoting connection EJB rece
iver [connection=org.jboss.ejb.client.remoting.ConnectionPool$PooledConnection#25d8cd6c,channel=jboss.ejb,nodename=master:server-three]}
org.jboss.remoting3.ProtocolException: Too many channels open
at org.jboss.remoting3.remote.RemoteConnectionHandler.handleOutboundChannelOpen(RemoteConnectionHandler.java:185)
at org.jboss.remoting3.remote.RemoteConnectionHandler.open(RemoteConnectionHandler.java:318)
at org.jboss.remoting3.ConnectionImpl.openChannel(ConnectionImpl.java:75)
at org.jboss.ejb.client.remoting.ConnectionPool$PooledConnection.openChannel(ConnectionPool.java:227)
at org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver.associate(RemotingConnectionEJBReceiver.java:169)
at org.jboss.ejb.client.EJBClientContext.registerEJBReceiver(EJBClientContext.java:375)
at org.jboss.ejb.client.EJBClientContext.registerEJBReceiver(EJBClientContext.java:327)
at org.jboss.ejb.client.remoting.ConfigBasedEJBClientContextSelector.setupEJBReceivers(ConfigBasedEJBClientContextSelector.java:159)
at org.jboss.ejb.client.remoting.ConfigBasedEJBClientContextSelector.getCurrent(ConfigBasedEJBClientContextSelector.java:115)
at org.jboss.ejb.client.remoting.ConfigBasedEJBClientContextSelector.getCurrent(ConfigBasedEJBClientContextSelector.java:47)
at org.jboss.ejb.client.EJBClientContext.getCurrent(EJBClientContext.java:271)
at org.jboss.ejb.client.EJBClientContext.requireCurrent(EJBClientContext.java:281)
at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:176)
at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:144)
at com.sun.proxy.$Proxy1.getData(Unknown Source)
at com.oms.client.EJBInvoker.invokeDataGridService(EJBInvoker.java:71)
at com.test.MyBenchmark.testEjbClient(MyBenchmark.java:43)
at com.test.generated.MyBenchmark_testEjbClient.testEjbClient_avgt_jmhLoop(MyBenchmark_testEjbClient.java:160)
at com.test.generated.MyBenchmark_testEjbClient.testEjbClient_AverageTime(MyBenchmark_testEjbClient.java:129)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.openjdk.jmh.runner.LoopBenchmarkHandler$BenchmarkTask.call(LoopBenchmarkHandler.java:210)
at org.openjdk.jmh.runner.LoopBenchmarkHandler$BenchmarkTask.call(LoopBenchmarkHandler.java:192)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Error says too many channels open, so is it like I should close the channel after a call? Or what is the cause for this and what is the solution.
Following is my remote client.
public class EJBInvoker {
/**
* Invoke Data Grid Service.
*/
public void invokeDataGridService() {
EJBInvoker client = null;
try {
for (int i = 0; i < 1; i++) {
client = new EJBInvoker();
String dataGridServiceJndi = "ejb:poc_ear-1.0/poc_ejbs-1.0//DataGridServiceImpl!com.oms.ejbs.stateless.DataGridService";
DataGridService dataGridService = (DataGridService) client.lookupRemoteEJB(dataGridServiceJndi);
String result = dataGridService.getData("1");
System.out.println(result);
}
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* Lookup for Remote EJB
*
* #return {#link Object} instance.
* #throws NamingException
* naming exception.
*/
#SuppressWarnings({"unchecked", "rawtypes"})
private Object lookupRemoteEJB(String jndiName) throws NamingException {
Context context = null;
try {
Properties clientProperties = new Properties();
clientProperties.put("remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED", "false");
clientProperties.put("remote.connections", "default");
clientProperties.put("remote.connection.default.port", "8330");
clientProperties.put("remote.connection.default.host", "192.168.17.150");//192.168.16.40
clientProperties.put("remote.connection.default.username", "admin");
clientProperties.put("remote.connection.default.password", "1qaz2wsx#");
clientProperties.put("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS", "false");
EJBClientConfiguration ejbClientConfiguration = new PropertiesBasedEJBClientConfiguration(clientProperties);
ContextSelector<EJBClientContext> contextSelector = new ConfigBasedEJBClientContextSelector(ejbClientConfiguration);
EJBClientContext.setSelector(contextSelector);
Properties properties = new Properties();
properties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
context = new InitialContext(properties);
System.out.println("____" + jndiName);
return context.lookup(jndiName);
} finally {
if (context != null) {
context.close();
}
}
}
}
We can't create too many InitialContext. In my application, I made InitialContext as a static variable; so in the whole app, only a instance.
That solved the issue.
enter code here I try to push from Java by using JAVAPNS 2.2
this is my code
import java.util.*;
import org.apache.log4j.BasicConfigurator;
import org.json.JSONException;
import javapns.*;
import javapns.communication.exceptions.CommunicationException;
import javapns.communication.exceptions.KeystoreException;
import javapns.notification.PushNotificationPayload;
import javapns.notification.PushedNotification;
import javapns.notification.ResponsePacket;
public class Test {
/**
* #param args
*/
public static void main(String[] args) {
BasicConfigurator.configure();
try {
PushNotificationPayload payload = PushNotificationPayload.complex();
payload.addAlert("Hello World");
payload.addBadge(1);
payload.addSound("default");
payload.addCustomDictionary("id", "1");
System.out.println(payload.toString());
List<PushedNotification> NOTIFICATIONS = Push.payload(payload, "D:\\keystore1.p12", "123456", true, "AA67F2F18586D2C83398F9E5E5BE8BA1CD3FF80257CC74BACF2938CE144BA71D");
for (PushedNotification NOTIFICATION : NOTIFICATIONS) {
if (NOTIFICATION.isSuccessful()) {
/* APPLE ACCEPTED THE NOTIFICATION AND SHOULD DELIVER IT */
System.out.println("PUSH NOTIFICATION SENT SUCCESSFULLY TO: " +
NOTIFICATION.getDevice().getToken());
/* STILL NEED TO QUERY THE FEEDBACK SERVICE REGULARLY */
}
else {
String INVALIDTOKEN = NOTIFICATION.getDevice().getToken();
/* ADD CODE HERE TO REMOVE INVALIDTOKEN FROM YOUR DATABASE */
/* FIND OUT MORE ABOUT WHAT THE PROBLEM WAS */
Exception THEPROBLEM = NOTIFICATION.getException();
THEPROBLEM.printStackTrace();
/* IF THE PROBLEM WAS AN ERROR-RESPONSE PACKET RETURNED BY APPLE, GET IT */
ResponsePacket THEERRORRESPONSE = NOTIFICATION.getResponse();
if (THEERRORRESPONSE != null) {
System.out.println(THEERRORRESPONSE.getMessage());
}
}
}
} catch (CommunicationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (KeystoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
The library sent successfully but I never get a push on my device. I've try many tokens of my devices and even try to regenerate the certificate .12 but still no use.
Log
0 [main] DEBUG javapns.notification.Payload - Adding alert [Hello World]
1 [main] DEBUG javapns.notification.Payload - Adding badge [1]
1 [main] DEBUG javapns.notification.Payload - Adding sound [default]
1 [main] DEBUG javapns.notification.Payload - Adding custom Dictionary [id] = [1]
{"id":"1","aps":{"sound":"default","alert":"Hello World","badge":1}}
292 [main] DEBUG javapns.communication.ConnectionToAppleServer - Creating SSLSocketFactory
341 [main] DEBUG javapns.communication.ConnectionToAppleServer - Creating SSLSocket to gateway.push.apple.com:2195
972 [main] DEBUG javapns.notification.PushNotificationManager - Initialized Connection to
Host: [gateway.push.apple.com] Port: [2195]: 1923e91b[SSL_NULL_WITH_NULL_NULL: Socket[addr=gateway.push.apple.com/17.149.35.173,port=2195,localport=65225]]
974 [main] DEBUG javapns.notification.PushNotificationManager - Building Raw message from deviceToken and payload
974 [main] DEBUG javapns.notification.PushNotificationManager - Built raw message ID 1 of total length 113
974 [main] DEBUG javapns.notification.PushNotificationManager - Attempting to send notification: {"id":"1","aps":{"sound":"default","alert":"Hello World","badge":1}}
974 [main] DEBUG javapns.notification.PushNotificationManager - to device: AA67F2F18586D2C83398F9E5E5BE8BA1CD3FF80257CC74BACF2938CE144BA71D
1743 [main] DEBUG javapns.notification.PushNotificationManager - Flushing
1743 [main] DEBUG javapns.notification.PushNotificationManager - At this point, the entire 113-bytes message has been streamed out successfully through the SSL connection
1743 [main] DEBUG javapns.notification.PushNotificationManager - Notification sent on first attempt
1743 [main] DEBUG javapns.notification.PushNotificationManager - Reading responses
1744 [main] DEBUG javapns.notification.PushNotificationManager - Closing connection
PUSH NOTIFICATION SENT SUCCESSFULLY TO: AA67F2F18586D2C83398F9E5E5BE8BA1CD3FF80257CC74BACF2938CE144BA71D
anyone has any idea ?
this line should
List<PushedNotification> NOTIFICATIONS = Push.payload(payload, "D:\\keystore1.p12", "123456", true, "AA67F2F18586D2C83398F9E5E5BE8BA1CD3FF80257CC74BACF2938CE144BA71D");
should change to this
List<PushedNotification> NOTIFICATIONS = Push.payload(payload, "D:\\keystore1.p12", "123456", false, "AA67F2F18586D2C83398F9E5E5BE8BA1CD3FF80257CC74BACF2938CE144BA71D");
I'm currently working on a SalesForce.com tutorial entitled Force.com for Google App Engine for Java: Getting Started
I've installed the Google Eclipse Plugin, downloaded the libraries, and entered the "Hello World App" (as seen on the tutorial page):
package com.force;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.http.*;
import java.util.logging.*;
import com.sforce.ws.*;
import com.sforce.soap.partner.*;
import com.sforce.soap.partner.sobject.SObject;
#SuppressWarnings("serial")
public class HelloWorldServlet extends HttpServlet {
private static final Logger log = Logger.getLogger(HelloWorldServlet.class.getName());
private String username = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
private String password = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
private PartnerConnection connection;
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
resp.setContentType("text/html");
resp.getWriter().println("Hello, world. this is a test2");
PrintWriter t = resp.getWriter();
getConnection( t, req);
if ( connection == null ) { return; }
QueryResult result = null;
try {
result = connection.query( "select id, name, phone from Account order by LastModifiedDate desc limit 10 ");
} catch (ConnectionException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
for (SObject account : result.getRecords()) {
t.println("<li>"+ (String)account.getField("Name") + "</li>");
}
}
void getConnection(PrintWriter out, HttpServletRequest req) {
try {
// build up a ConnectorConfig from a sid
String sessionid = req.getParameter("sid");
String serverurl = req.getParameter("srv");
if ( connection == null ) {
out.println("<p>new connection needed</p>");
// login to the Force.com Platform
ConnectorConfig config = new ConnectorConfig();
if ( sessionid != null && serverurl != null) {
config.setServiceEndpoint(serverurl);
config.setSessionId(sessionid);
config.setManualLogin(false);
out.println("using session from query string");
} else {
config.setUsername(username);
config.setPassword(password);
}
connection = Connector.newConnection(config);
out.println( connection.getConfig().getSessionId() );
out.println( connection.getConfig().getServiceEndpoint() );
} else {
out.println("<p> reuse existing connection");
out.println( connection.getConfig().getSessionId() );
}
log.warning("Connection SID " +connection.getConfig().getSessionId());
} catch ( ConnectionException ce) {
log.warning("ConnectionException " +ce.getMessage());
out.println( ce.getMessage() + " s " + ce.getClass() );
}
}
}
When I run the application as a "Web Application" I get the following in the console:
Initializing AppEngine server
Logging to JettyLogger(null) via com.google.apphosting.utils.jetty.JettyLogger
Successfully processed D:\education\java\HelloWorldOriginal\war\WEB-INF/appengine-web.xml
Successfully processed D:\education\java\HelloWorldOriginal\war\WEB-INF/web.xml
The server is running at http://localhost:8888/
Warning: default mime table not found: C:\devtool\Java\jre6\lib\content-types.properties
When I try to visit http://localhost:8080/ , I see:
Oops! Google Chrome could not connect to localhost:8080
Did you mean: localhost-8080.com
Additional suggestions:
Try reloading: localhost:8080
Search on Google:
Google Chrome Help - Why am I seeing this page?
©2011 Google - Google Home
But when I visit http://localhost:8888/ , I get:
Web Application Starter Project
Please enter your name:
Send
(Which, also isn't the desired or expected outcome.)
What is this content-type.properties that I'm missing and how can I fix it? Or is that just a symptom of a greater problem?
Have you checked that your web.xml directs requests for / to the appropriate handler class? Just writing the class isn't enough - you have to make sure that incoming requests are directed to it.