GithubHelp home page GithubHelp logo

drogatkin / tjws2 Goto Github PK

View Code? Open in Web Editor NEW
66.0 18.0 42.0 1.63 MB

Tiny Java Web and App server second generation

Shell 0.46% HTML 2.41% Java 95.48% JavaScript 0.09% C++ 1.47% C 0.06% Batchfile 0.03%

tjws2's Introduction

TJWS

Tiny Java Web and App server

The server sources hosting on sourceforge is currently stopped. All sources are available here.

However a general documentation can be still accessed from Source Forge

Releases

Check release notes and a change log in a corresponding release number directory: TJWS2/1.x/notes/

Good news

The project doesn't use Log4J, and other not reliable open source libraries.

alt this project Log4j free

tjws2's People

Contributors

drogatkin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tjws2's Issues

Unhandled null pointer exception at initializing a servlet

I post this issue on behalf of Robert Roth
I had a typo in the
attribute name and because I didn't check for null I created a
NullPointerException. The problem was that it happened in the init()
function of a servlet that was supposed to be initiated at startup.
This lead to Atjeews crashing every time I tried to start it. Because
of that and becasue it happened on an unrooted phone I couldn't remove
the offending servlet either. The only option was to re-install
Atjeews.

I think the problem lies here:

} catch (ServletException se) {

try {
instance.init(ServletAccessDescr.this);
} catch (ServletException se) { // this should probably be: }
catch((Exception e) {
exHolder[0] = se;
}

Minor modification for ubuntu 14.04 deamon mode

Just sharing my setup experience:

bin/tjwserv

description "tjwserv"

start on (local-filesystems and net-device-up IFACE!=lo)
stop on runlevel [!2345]

env HOME=/home/user
setuid "user"
setgid "user"

exec /opt/tjws/bin/tjwserv.sh

respawn

bin/tjwserv.sh

#!/bin/bash
RETVAL=0;

JDK_HOME=$(readlink -f /usr/bin/javac | sed "s:/bin/javac::")
tjws=/opt/tjws
cp=$tjws/lib/javax.servlet.jar:$tjws/lib/war.jar:$tjws/lib/webserver.jar:$tjws/lib/app.jar:$tjws/lib/class-scanner.jar:$tjws/lib/wskt.jar:$tjws/lib/javax.websocket-client-api.jar:$tjws/lib/javax.websocket-server-api.jar:$tjws/lib/jsp.jar:$tjws/lib/jasper.jar:$JDK_HOME/lib/tools.jar
log=/var/log/tjws
webapps=/usr/share/java/webapps

tjws_cmd=$JDK_HOME/bin/java\ -cp\ $cp\ -Dtjws.webappdir=$tjws/webapps\ -Dtjws.wardeploy.dynamically\ -Dorg.slf4j.simpleLogger.defaultLogLevel=DEBUG\ rogatkin.app.Main\ -nohup\ -a\ $tjws/aliases\ -p\ 8011\ -l\ -c\ cgi-bin\ -d\ $log\ -g\ 10000\ -acceptorImpl\ Acme.Serve.SelectorAcceptor

$tjws_cmd

exit $RETVAL

Installation and Configuration

  • prepare log file
    • sudo mkdir -p /var/log/tjws/
    • sudo chown user.user /var/log/tjws/
    • sudo chmod u+wx /var/log/tjws/
  • sudo chmod a+rx /opt/tjws/lib/
  • sudo chmod +rx /opt/tjws/bin/
  • sudo cp /opt/tjws/bin/tjwserv /etc/init/tjwserv.conf
  • sudo chmod +x /opt/tjws/bin/tjwserv.sh
  • sudo /opt/tjws
  • update the port and log mode(debug or info, etc.) at /opt/tjws/bin/tjwserv.sh
  • sudo service tjwserv start
  • wait a moment, ~1 min, see the log file
  • log file at tail -n 200 /var/log/tjws/TJWS-*.log
  • update xyz.war into webapps/ at any time, wait ~30Sec, it will update the new content by itself

FastClasspathScanner is outdated -- consider porting to ClassGraph

Your project, drogatkin/TJWS2, depends on the outdated library FastClasspathScanner in the following source files:

FastClasspathScanner has been significantly reworked since the version your code depends upon:

  • a significant number of bugs have been fixed
  • some nontrivial API changes have been made to simplify and unify the API
  • FastClasspathScanner has been renamed to ClassGraph: https://github.com/classgraph/classgraph

ClassGraph is a significantly more robust library than FastClasspathScanner, and is more future-proof. All future development work will be focused on ClassGraph, and FastClasspathScanner will see no future development.

Please consider porting your code over to the new ClassGraph API, particularly if your project is in production or has downstream dependencies:

Feel free to close this bug report if this code is no longer in use. (You were sent this bug report because your project depends upon FastClasspathScanner, and has been starred by 50 users. Apologies if this bug report is not helpful.)

Missing some packages

Hi,

some packages are missing ex : rogatkin.app.remote

it uses in /rogatkin/app/SimpleJndi.java

can you publish them please

Philippe

servlet invoked twice when use wildcard /*

public class MainTest {
public static void main(String[] args) {
final Serve srv = new Serve();
java.util.Properties properties = new java.util.Properties();
properties.put("port", 80);
properties.setProperty(com.koogu.server.Serve.ARG_NOHUP, "nohup");

	//properties.setProperty("acceptorImpl", "Acme.Serve.SelectorAcceptor"); // this acceptor is requireed for websocket support.
	srv.arguments = properties;
	srv.addServlet("/*", new HttpServlet() {
		private static final long serialVersionUID = 1L;
		protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
			System.out.println("test="+req.getParameter("test"));
		}
	}, null); // optional
	Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
		public void run() {
			srv.notifyStop();
			srv.destroyAllServlets();
		}
	}));
	srv.serve();
}

}

then doGet was invoked twice:
URL: http://localhost/a?test=123
output as:
test=123
test=null

support for jsp is broken?

Try run jsp page and get this error:
java.lang.NoSuchMethodError: javax.servlet.jsp.JspFactory.getJspApplicationContext(Ljavax/servlet/ServletContext;)Ljavax/servlet/jsp/JspApplicationContext;
at org.apache.jasper.compiler.Validator$ValidateVisitor.(Validator.java:516)
at org.apache.jasper.compiler.Validator.validateExDirectives(Validator.java:1845)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:218)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:374)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:354)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:341)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:654)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:364)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at rogatkin.web.WebAppServlet$SimpleFilterChain.doFilter(WebAppServlet.java:3585)
at rogatkin.web.WebAppServlet$WebAppContextFilter.doFilter(WebAppServlet.java:3206)
at rogatkin.web.WebAppServlet$SimpleFilterChain.doFilter(WebAppServlet.java:3557)
at rogatkin.web.WebAppServlet.service(WebAppServlet.java:1451)
at Acme.Serve.Serve$ServeConnection.runServlet(Serve.java:2408)
at Acme.Serve.Serve$ServeConnection.parseRequest(Serve.java:2330)
at Acme.Serve.Serve$ServeConnection.run(Serve.java:2110)
at Acme.Utils$ThreadPool$PooledThread.run(Utils.java:1238)
at java.lang.Thread.run(Unknown Source)

[Wed Oct 18 13:26:58 MSK 2017] TJWS: javax.servlet.ServletException: java.lang.NoSuchMethodError: javax.servlet.jsp.JspFactory.getJspApplicationContext(Ljavax/servlet/ServletContext;)Ljavax/servlet/jsp/JspApplicationContext;

How do i register a filter

I tried server.addFilter(String, Filter) but it doesn't seem to work. I am looking to add a basic filter which checks if session is valid on each request.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.