Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » java.io.FileNotFoundException
java.io.FileNotFoundException [message #1833189] Tue, 06 October 2020 10:02 Go to next message
z232 I is currently offline z232 IFriend
Messages: 48
Registered: February 2016
Member
Hi,

recently i have installed eclipse Version: 2019-12 (4.14.0) with Build id: 20191212-1212 . The Xtext plugin is 2.20.0.v20191202-1256
On the creation of a new xtext project i select the web integration support and gradle as prefered build system.
The artifacts of the hello world example language are generated successful. The problem comes after i try to run the jetty server.

The following message appears on the console log .

[main] INFO org.eclipse.jetty.util.log - Logging initialized @235ms to org.eclipse.jetty.util.log.Slf4jLog
[main] INFO org.eclipse.jetty.server.Server - jetty-9.4.22.v20191022; built: 2019-10-22T13:37:13.455Z; git: b1e6b55512e008f7fbdf1cbea4ff8a6446d1073b; jvm 1.8.0_261-b12
[main] WARN org.eclipse.jetty.webapp.WebAppContext - Failed startup of context o.e.j.w.WebAppContext@29774679{/,file:///C:/Users/michael/Desktop/eclipse201912/WorkspaceServer/org.xtext.example.mydsl.parent/org.xtext.example.mydsl.web/WebRoot/,UNAVAILABLE}
java.io.FileNotFoundException: C:\org.xtext.example.mydsl.web\bin\default (The system cannot find the path specified)
	at java.util.zip.ZipFile.open(Native Method)
	at java.util.zip.ZipFile.<init>(Unknown Source)
	at java.util.zip.ZipFile.<init>(Unknown Source)
	at java.util.jar.JarFile.<init>(Unknown Source)
	at java.util.jar.JarFile.<init>(Unknown Source)
	at sun.net.www.protocol.jar.URLJarFile.<init>(Unknown Source)
	at sun.net.www.protocol.jar.URLJarFile.getJarFile(Unknown Source)
	at sun.net.www.protocol.jar.JarFileFactory.get(Unknown Source)
	at sun.net.www.protocol.jar.JarURLConnection.connect(Unknown Source)
	at sun.net.www.protocol.jar.JarURLConnection.getJarFile(Unknown Source)
	at org.eclipse.jetty.webapp.MetaInfConfiguration.getTlds(MetaInfConfiguration.java:445)
	at org.eclipse.jetty.webapp.MetaInfConfiguration.scanForTlds(MetaInfConfiguration.java:361)
	at org.eclipse.jetty.webapp.MetaInfConfiguration.scanJars(MetaInfConfiguration.java:172)
	at org.eclipse.jetty.webapp.MetaInfConfiguration.preConfigure(MetaInfConfiguration.java:101)
	at org.eclipse.jetty.webapp.WebAppContext.preConfigure(WebAppContext.java:488)
	at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:523)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72)
	at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:169)
	at org.eclipse.jetty.server.Server.start(Server.java:407)
	at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:110)
	at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:106)
	at org.eclipse.jetty.server.Server.doStart(Server.java:371)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:72)
	at org.xtext.example.mydsl.web.ServerLauncher.main(ServerLauncher.java:47)
[main] INFO org.eclipse.jetty.server.AbstractConnector - Started ServerConnector@64b8f8f4{HTTP/1.1,[http/1.1]}{localhost:8080}
[main] INFO org.eclipse.jetty.server.Server - Started @828ms
[main] INFO org.xtext.example.mydsl.web.ServerLauncher - Server started http://localhost:8080/...
[Thread-8] INFO org.xtext.example.mydsl.web.ServerLauncher - Press enter to stop the server...


This is the ServerLauncher.xtend file produced by xtext

/*
 * generated by Xtext 2.20.0
 */
package org.xtext.example.mydsl.web

import java.net.InetSocketAddress
import org.eclipse.jetty.annotations.AnnotationConfiguration
import org.eclipse.jetty.server.Server
import org.eclipse.jetty.util.log.Slf4jLog
import org.eclipse.jetty.webapp.MetaInfConfiguration
import org.eclipse.jetty.webapp.WebAppContext
import org.eclipse.jetty.webapp.WebInfConfiguration
import org.eclipse.jetty.webapp.WebXmlConfiguration

/**
 * This program starts an HTTP server for testing the web integration of your DSL.
 * Just execute it and point a web browser to http://localhost:8080/
 */
class ServerLauncher {
	def static void main(String[] args) {
		val server = new Server(new InetSocketAddress('localhost', 8080))
		server.handler = new WebAppContext => [
			resourceBase = 'WebRoot'
			welcomeFiles = #["index.html"]
			contextPath = "/"
			configurations = #[
				new AnnotationConfiguration,
				new WebXmlConfiguration,
				new WebInfConfiguration,
				new MetaInfConfiguration
			]
			setAttribute(WebInfConfiguration.CONTAINER_JAR_PATTERN, '.*/org\\.xtext\\.example\\.mydsl\\.web/.*,.*\\.jar')
			setInitParameter("org.mortbay.jetty.servlet.Default.useFileMappedBuffer", "false")
		]
		val log = new Slf4jLog(ServerLauncher.name)
		try {
			server.start
			log.info('Server started ' + server.getURI + '...')
			new Thread[
				log.info('Press enter to stop the server...')
				val key = System.in.read
				if (key != -1) {
					server.stop
				} else {
					log.warn('Console input is not available. In order to stop the server, you need to cancel process manually.')
				}
			].start
			server.join
		} catch (Exception exception) {
			log.warn(exception.message)
			System.exit(1)
		}
	}
}



As expexted after visiting http://localhost:8080 i get the following error HTTP ERROR 503 Service Unavailable

Is this a bug ?
Thanks
Re: java.io.FileNotFoundException [message #1833190 is a reply to message #1833189] Tue, 06 October 2020 10:08 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
do you have proper gradle tooling installed in eclipse? if yes the we project src folders should be configured like shown in the image. there also should not be any errors oin any of the projects

and then eclipse shoulft not check bin default
can you check the buildship version?




Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Tue, 06 October 2020 10:09]

Report message to a moderator

Re: java.io.FileNotFoundException [message #1833191 is a reply to message #1833190] Tue, 06 October 2020 10:12 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
ps: you can also run the jettyRun goal from gradle

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: java.io.FileNotFoundException [message #1833193 is a reply to message #1833191] Tue, 06 October 2020 10:45 Go to previous messageGo to next message
z232 I is currently offline z232 IFriend
Messages: 48
Registered: February 2016
Member
Hi Christian

My projects src folders build path configuration is exactly the same as shown in the image. Also no errors are present in any of my projects.
I haven' t installed inside eclipse any extra toolchain for the building system .
I use the build ship provided by the official release of this eclipse version.
The build ship information is the following

Eclipse Buildship Buildship, Eclipse Plug-ins for Gradle 3.1.3.v20191118-1057 org.eclipse.buildship


i have also installed Gradle version 6.6.1. in my pc
After running thru the console the jetty Server, i don't get any errors at all.

Should i update the build ship inside eclipse ? And if yes witch version is preferable ?


Thanks again

[Updated on: Thu, 20 May 2021 14:59]

Report message to a moderator

Re: java.io.FileNotFoundException [message #1833194 is a reply to message #1833193] Tue, 06 October 2020 11:05 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
i dont know why the bin default is NOT on classpath in my code but is on yours.
can be a buildship problem or a project config problem or something else.
how does your .classpath file look like?

unfortunately i dont have a xtext 2.20 at hand to test


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: java.io.FileNotFoundException [message #1833196 is a reply to message #1833194] Tue, 06 October 2020 11:35 Go to previous message
z232 I is currently offline z232 IFriend
Messages: 48
Registered: February 2016
Member
I have uploaded 2 png files.
The classPath.png shows my current build Path setup of my source
The gradle.png shows my selection for the Gradle build ship used in the eclipse
After selecting the Local installation directory the problem disappears.
Hope this was the issue !!!


  • Attachment: classPath.png
    (Size: 71.77KB, Downloaded 84 times)
  • Attachment: gradle.png
    (Size: 47.59KB, Downloaded 74 times)
Previous Topic:Integrate Kotlin src-dependencies into the workflow with gradle
Next Topic:Separating New Wizards and File Templates
Goto Forum:
  


Current Time: Fri Apr 26 03:32:13 GMT 2024

Powered by FUDForum. Page generated in 0.03736 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top