jetty error

84 views
Skip to first unread message

Peiter Brown

unread,
Jun 6, 2016, 6:02:11 AM6/6/16
to jPOS Users
Hi,

I am trying to start jetty from jposee. I have used jpos-template to make my sample.
following is my build.gradle file :


apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'idea'
apply plugin: 'eclipse'
// apply plugin: 'docker'

buildscript {
    repositories { jcenter() }
//    dependencies {
//        classpath 'se.transmode.gradle:gradle-docker:1.2'
//    }
}

group = 'org.jpos.template'
version = '2.0.6'
sourceCompatibility = 1.8
targetCompatibility = 1.8

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

dependencies {
    compile ('org.jpos:jpos:2.0.+') {
        exclude(module: 'junit')
        exclude(module: 'hamcrest-core')
    }

    compile ('org.jpos.ee:jposee-jetty:2.2.+')

    testCompile 'junit:junit:4.8.2'
}

apply from: 'jpos-app.gradle'


also I have added 90_jetty.xml to my deploy directory
and also added jetty.xml and webdefault.xml to my cfg directory.
and I have copied webservice1.war to webapps directory.

after running the application I get following error :

2016-06-06 14:18:29.294:DBUG:oejw.WebInfConfiguration:Q2-f79cafd2-34ed-497c-bd6c-2bc68357beef: Try webapp=file:/home/oracle/workspace/jPOS-jetty/build/install/jPOS-jetty/webapps/webservice1.war, exists=true, directory=false file=/home/oracle/workspace/jPOS-jetty/build/install/jPOS-jetty/webapps/webservice1.war                        
2016-06-06 14:18:29.295:DBUG:oejw.WebInfConfiguration:Q2-f79cafd2-34ed-497c-bd6c-2bc68357beef: Extract jar:file:/home/oracle/workspace/jPOS-jetty/build/install/jPOS-jetty/webapps/webservice1.war!/ to /tmp/jetty-0.0.0.0-8080-webservice1.war-_webservice1-any-7777980681771862519.dir/webapp                                                
2016-06-06 14:18:29.295:DBUG:oejur.JarResource:Q2-f79cafd2-34ed-497c-bd6c-2bc68357beef: Extract jar:file:/home/oracle/workspace/jPOS-jetty/build/install/jPOS-jetty/webapps/webservice1.war!/ to /tmp/jetty-0.0.0.0-8080-webservice1.war-_webservice1-any-7777980681771862519.dir/webapp                                                       
2016-06-06 14:18:29.295:DBUG:oejur.JarResource:Q2-f79cafd2-34ed-497c-bd6c-2bc68357beef: Extracting entry = null from jar file:/home/oracle/workspace/jPOS-jetty/build/install/jPOS-jetty/webapps/webservice1.war                                                                                                                               
2016-06-06 14:18:29.296:WARN:oejw.WebAppContext:Q2-f79cafd2-34ed-497c-bd6c-2bc68357beef: Failed startup of context o.e.j.w.WebAppContext@4e42f7f1{/webservice1,null,null}{/webservice1.war}                                                                                                                                                    
java.io.FileNotFoundException: /tmp/jetty-0.0.0.0-8080-webservice1.war-_webservice1-any-7777980681771862519.dir/webapp (Is a directory)                                
        at java.io.FileOutputStream.open0(Native Method)                                                                                                               
        at java.io.FileOutputStream.open(FileOutputStream.java:270)                                                                                                    
        at java.io.FileOutputStream.<init>(FileOutputStream.java:213)                                                                                                  
        at java.io.FileOutputStream.<init>(FileOutputStream.java:162)                                                                                                  
        at org.eclipse.jetty.util.resource.JarResource.copyTo(JarResource.java:238)                                                                                    
        at org.eclipse.jetty.webapp.WebInfConfiguration.unpack(WebInfConfiguration.java:468)                                                                           
        at org.eclipse.jetty.webapp.WebInfConfiguration.preConfigure(WebInfConfiguration.java:72)                                                                      
        at org.eclipse.jetty.webapp.WebAppContext.preConfigure(WebAppContext.java:468)                                                                                 
        at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:504)                                                                                      
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)                                                                         
        at org.eclipse.jetty.deploy.bindings.StandardStarter.processBinding(StandardStarter.java:41)                                                                   


do you have any idea?




Victor Salaman

unread,
Jun 6, 2016, 10:43:34 AM6/6/16
to jpos-...@googlegroups.com
Can you unpack the war inside the /webapps and see what happens?

/V

--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
 
Join us in IRC at http://webchat.freenode.net/?channels=jpos
 
You received this message because you are subscribed to the "jPOS Users" group.
Please see http://jpos.org/wiki/JPOS_Mailing_List_Readme_first
To post to this group, send email to jpos-...@googlegroups.com
To unsubscribe, send email to jpos-users+...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/jpos-users
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/e5992eee-7a9e-495e-8606-892f989612f4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Peiter Brown

unread,
Jun 14, 2016, 12:54:46 AM6/14/16
to jPOS Users
Hi Victor,

Thank you very much for your help.
Sorry for my delay, during these days I was investigating on this issue following the way you showed me.
and at last I found the problem.
I am really wondered to tell you, the problem is with "gradle installApp" command.
I have following directories in my src/dist/ directory :

 bin
 cfg
 deploy
 log
 webapps

I just copied the webservice1.war application to webapps directory, then used "gradle installApp" command to install my project.
until this step every thing works fine and all above directories are copied to "install" directory
then I started the application using "build/install/jPOS-jetty/bin/q2" command.
in this case I get reported error in my first post.

During my researches, I found that if I copy webservice1.war to install directory manually it works fine!!!
when I compared the files, I found that when I use "installApp" command to copy src/dist/webapps/webservice1.war file to install directory, the file size changes!!!
But when I copy the file manually every thing works fine.

Do you know what the reason is ?!








Alejandro Revilla

unread,
Jun 14, 2016, 7:29:48 AM6/14/16
to jpos-...@googlegroups.com
I think I do. It's related to the replace token. We need to ignore .war files. This works alright when we create the wars, but not when you create it elsewhere. Will follow-up with the fix to jpos-app.gradle. 
--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
 
Join us in IRC at http://webchat.freenode.net/?channels=jpos
 
You received this message because you are subscribed to the "jPOS Users" group.
Please see http://jpos.org/wiki/JPOS_Mailing_List_Readme_first
To post to this group, send email to jpos-...@googlegroups.com
To unsubscribe, send email to jpos-users+...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/jpos-users
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jpos-users/e4a501fa-2dee-4c12-b953-7cf40342200d%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.


--

Peiter Brown

unread,
Jun 14, 2016, 8:33:23 AM6/14/16
to jPOS Users
Hi Alejandro,

Thank you for your help.
could you please tell me how can I create war file inside my application?


Alejandro Revilla

unread,
Jun 14, 2016, 12:27:29 PM6/14/16
to jPOS Users

This change to jpos-app.gradle should fix your problem: https://github.com/jpos/jPOS-template/commit/8e161b9245fd71e7df7f182214ba55b5f3336797

Can you give it a try?




--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
 
Join us in IRC at http://webchat.freenode.net/?channels=jpos
 
You received this message because you are subscribed to the "jPOS Users" group.
Please see http://jpos.org/wiki/JPOS_Mailing_List_Readme_first
To post to this group, send email to jpos-...@googlegroups.com
To unsubscribe, send email to jpos-users+...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/jpos-users
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.

Peiter Brown

unread,
Jun 15, 2016, 2:41:49 AM6/15/16
to jPOS Users

Thank you, I did the changes and it is working like a charm.
up to now my problem is solved.

But I have another question,
if I want to make the war file inside my project, I think I should compile it into build/libs.
in the jpos-app.gradle I can see following lines :
..
def archiveJarName="${project.name}-${project.version}.jar"
def archiveWarName="${project.name}-${project.version}.war"
def installDir=file("${project.buildDir}/install/${project.name}")
project.ext {
    targetConfiguration = new Properties()
    def target = project.hasProperty('target') ? target : 'devel'
    targetConfiguration.put('jarname', archiveJarName.toString())
    targetConfiguration.put('warname', archiveWarName.toString())
    targetConfiguration.put('target', target.toString())
    targetConfiguration.put("buildTimestamp", new Date().format("yyyy-MM-dd HH:mm:ss z"));
..

how can I compile my application to create war file inside my application?
what is the use of red lines of jpos-app.gradle?
should I write a new Task?

Alejandro Revilla

unread,
Jun 15, 2016, 10:23:08 PM6/15/16
to jPOS Users
Those red lines are required to build the war from the jPOS build. If you want to create it elsewhere, then you are on your own, just follow the instructions to create a war in your desired build environment, you don't need ours.



Peiter Brown

unread,
Jun 18, 2016, 1:52:38 AM6/18/16
to jPOS Users
Could you please tell me how can I build the war from the jPOS build?

Alejandro Revilla

unread,
Jun 20, 2016, 7:29:03 PM6/20/16
to jPOS Users

Hi Pieter,

You can use Gradle’s war plugin:

apply plugin: 'war'
apply from: 'jpos-app.gradle'

with a war configuration like this:

war {
  from (webAppDirName) {
    exclude '**/*.ico'
    exclude '**/*.png'
    exclude '**/*.jpg'
    exclude '**/*.gif'
    exclude '**/*.pdf'
    filter(org.apache.tools.ant.filters.ReplaceTokens, tokens:[targetConfiguration])
  }
}
Hope this helps.



On Sat, Jun 18, 2016 at 2:52 AM, Peiter Brown <peiter...@gmail.com> wrote:
Could you please tell me how can I build the war from the jPOS build?

--
--
jPOS is licensed under AGPL - free for community usage for your open-source project. Licenses are also available for commercial usage. Please support jPOS, contact: sa...@jpos.org
 
Join us in IRC at http://webchat.freenode.net/?channels=jpos
 
You received this message because you are subscribed to the "jPOS Users" group.
Please see http://jpos.org/wiki/JPOS_Mailing_List_Readme_first
To post to this group, send email to jpos-...@googlegroups.com
To unsubscribe, send email to jpos-users+...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/jpos-users
---
You received this message because you are subscribed to the Google Groups "jPOS Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jpos-users+...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages