Giter Site home page Giter Site logo

jpos-template's Introduction

jPOS Template

Clone this project in order to create your own jPOS based application.

We recommend that you install Gradle in order to build your jPOS projects, but if you don't have it installed, you can use the Gradle wrapper scripts gradlew and gradlew.bat. In the following instructions, when we say gradle we really mean either your installed Gradle or one of the wrapper scripts (depending if you are on Unix or DOS based platforms).

Build an eclipse project

gradle eclipse

Build an IDEA project

gradle idea

Build your own jar

gradle jar

Check the jPOS version

gradle version

Create a distribution of your application

gradle dist

This creates a tar gzipped file in the build/distributions directory.

Install application in 'build/install' directory

gradle installApp

Installs application in build/install with everything you need to run jPOS. Once the directory is created, you can cd build/install and call java -jar your-project-version.jar or the bin/q2 (or q2.bat) script available in the bin directory.

Generate an install a Maven artifact

gradle install

List available Gradle tasks

gradle tasks

jpos-template's People

Contributors

ar avatar barspi avatar gregorioosorio avatar it240884sii avatar jameshilliard avatar vsalaman 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jpos-template's Issues

Can't get Echo response from jPOS-REST guide

Can't get Echo response from jPOS-REST guide

Hi, I'm tryng to run an API Rest project from scratch, and I'm following the jPOS-REST guide, but when I execute it, I can't get an echo response.

Files

`build.gradle` file:
apply plugin: 'java'
apply plugin: 'maven-publish'
apply plugin: 'idea'
apply plugin: 'eclipse'
apply plugin: 'war'

group = 'org.jpos.template'
version = '2.1.7'
sourceCompatibility = 1.8
targetCompatibility = 11

repositories {
    mavenCentral()
    maven { url 'https://jpos.org/maven' }
    mavenLocal()
}

dependencies {
    implementation 'org.jpos:jpos:2.1.7'
    implementation "org.jpos.ee:jposee-eerest:2.2.8"
    implementation "javax.ws.rs:javax.ws.rs-api:2.0.1"
    implementation "org.jpos.ee:jposee-jetty:2.2.8"
    implementation "org.glassfish.jersey.media:jersey-media-json-jackson:2.22.1"
    implementation "org.glassfish.jersey.core:jersey-server:2.22.1"
    implementation "org.glassfish.jersey.containers:jersey-container-servlet:2.22.1"

}

configurations.all {
    resolutionStrategy.force 'org.slf4j:slf4j-api:1.7.30'
}

apply from: 'jpos-app.gradle'

import org.apache.tools.ant.filters.ReplaceTokens
war {
    filter(ReplaceTokens, tokens:[targetConfiguration])
}

installApp.dependsOn('war')
dist.dependsOn('war')
`90_jetty.xml` file:
<jetty class="org.jpos.q2.jetty.Jetty">
  <attr name="config">cfg/jetty.xml</attr>
  <!-- 
    For production systems, replace the literal value with a reference 
    to a system or environment property.
    For further information on the jPOS configuration sub-system, 
    see jPOS Programmer's Guide, section 3.3. 
  -->
  <property name="keystorePassword" value="jposjposjposjpos"/>
</jetty>
`web.xml` file:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
         version="3.0">
    <servlet>
        <display-name>jPOS</display-name>
        <servlet-name>Sample-REST-API</servlet-name>
        <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
        <init-param>
            <param-name>javax.ws.rs.Application</param-name>
            <param-value>org.jpos.rest.App</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Sample-REST-API</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>
</web-app>
`jetty-web.xml` file:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN"
        "http://www.eclipse.org/jetty/configure_9_0.dtd">
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
    <Set name="contextPath">/api</Set>
    <Set name="war"><SystemProperty name="jetty.home" default="."/>
        /webapps/@warname@</Set>
    <Set name="extractWAR">false</Set>
</Configure>

Note that:

  • ./gradlew installResources step has been performed as mentioned in the guide.
  • App and Echo classes are the same as in the guide.

Behaviour

Once started:

<html>

<head>
	<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
	<title>Error 404 Not Found</title>
</head>

<body>
	<h2>HTTP ERROR 404 Not Found</h2>
	<table>
		<tr>
			<th>URI:</th>
			<td>/api/echo</td>
		</tr>
		<tr>
			<th>STATUS:</th>
			<td>404</td>
		</tr>
		<tr>
			<th>MESSAGE:</th>
			<td>Not Found</td>
		</tr>
		<tr>
			<th>SERVLET:</th>
			<td>default</td>
		</tr>
	</table>
	<hr><a href="http://eclipse.org/jetty">Powered by Jetty:// 9.4.23.v20191118</a>
	<hr />

</body>

</html>

Jetty server seems to be working, but the App class with the Jersey configuration isn't.

Execution failing in the tutorial whenever a REST service is needed

In tutorial 3, we set out to do a REST interface. Attending all the prerequisites specified in the tutorial (that is, the build files looks exactly as the tutorial wrote), when testing the Echo call the service fails.

Going through the initialization logger this message can be seen:

<log realm="slf4j::org.eclipse.jetty.webapp.StandardDescriptorProcessor" at="2020-08-11T15:15:12.765660">
  <info>
    NO JSP Support for /api, did not find org.apache.jasper.servlet.JspServlet
  </info>
</log>

The JSP service is unavailable and thus we cannot send an HTTP request to the server. I first thought this was a dependency error, but it isn't. What could be happening in this case?

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.