Activator from guest OS - scala

I'm working on a project that is being converted from Groovy and Grails to Play Framework using Scala.
The app includes integration with native windows libraries, but I do my primary development on OSX only switching over to a Windows guest when I run the full app or tests that are dependent on the native libraries.
Using this setup the project files exist on the host file system and are shared with the Windows guest as a shared folder. This setup worked flawlessly for Grails development, but with the switch to Play Framework and Activator I'm encountering a java.io.IOException: incorrect function error when attempting to execute run via activator.
I can successfully compile and run tests. Additionally, I can successfully create and run new play projects from the guest, just can't run the project from the hosts shared folder. Any ideas how to resolve this?
I'm using the latest play framework download as of yesterday. So Play v2.4.3 with Activator v1.3.6. The project was created by running "activator new" and selecting the play-scala template. No changes were made to the template. The host OS is OSX and the guest OS is Windows 7. Java SDK 1.8.0_65
The activator run stacktrace:
[freshproject] $ run
java.io.IOException: Incorrect function.
at sun.nio.fs.WindowsWatchService$Poller.implRegister(WindowsWatchService.java:407)
at sun.nio.fs.AbstractPoller.processRequests(AbstractPoller.java:260)
at sun.nio.fs.WindowsWatchService$Poller.run(WindowsWatchService.java:533)
at java.lang.Thread.run(Thread.java:745)
[trace] Stack trace suppressed: run last compile:run for the full output.
[error] (compile:run) java.io.IOException: Incorrect function.
[error] Total time: 0 s, completed Oct 28, 2015 6:30:56 AM
[freshproject] $ last compile:run
java.io.IOException: Incorrect function.
at sun.nio.fs.WindowsWatchService$Poller.implRegister(WindowsWatchService.java:407)
at sun.nio.fs.AbstractPoller.processRequests(AbstractPoller.java:260)
at sun.nio.fs.WindowsWatchService$Poller.run(WindowsWatchService.java:533)
at java.lang.Thread.run(Thread.java:745)
[error] (compile:run) java.io.IOException: Incorrect function.

Related

Unable to run the gatling test (jvm issue)

I am trying to run the gatling test on MacOS.
Java version: openjdk version "1.8.0_275"
scala version: 2.12.12
sbt version :1.4.4
I am unable to run my tests because of this error. I have tried changing the java versions(recommended one) and tried reinstalling the sbt as well.
The error log is as follows:
Unrecognized VM option 'AggressiveOpts'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
[error] Could not accept connection from test agent: class java.net.SocketException: Socket closed
[error] java.net.SocketException: Socket closed
[error] at java.base/sun.nio.ch.NioSocketImpl.endAccept(NioSocketImpl.java:689)
[error] at java.base/sun.nio.ch.NioSocketImpl.accept(NioSocketImpl.java:762)
[error] at java.base/java.net.ServerSocket.implAccept(ServerSocket.java:684)
[error] at java.base/java.net.ServerSocket.platformImplAccept(ServerSocket.java:650)
[error] at java.base/java.net.ServerSocket.implAccept(ServerSocket.java:626)
[error] at java.base/java.net.ServerSocket.implAccept(ServerSocket.java:583)
[error] at java.base/java.net.ServerSocket.accept(ServerSocket.java:540)
[error] at sbt.ForkTests$Acceptor$1$.run(ForkTests.scala:71)
[error] at java.base/java.lang.Thread.run(Thread.java:832)
I would appreciate your feedback on this. Thank you.
There's no way you're using Java 8 as indicated, as your stacktrace clearly shows Jigsaw modules (java.base/). You're using Java 9 or older.
What happens is that the test forked JVM crashes on boot because it's being passed the AggressiveOpts option that was dropped after Java 8.
This option was removed in recent versions of Gatling's sbt plugin, meaning that you're using an older version.
In short: update your sbt plugin version.

sbt server fails to start throwing error 231

When I am trying to start sbt, it fails throwing an IO exception.
Version of SBT - 1.1.2
Version of Scala - 2.12.6
Error:
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
[info] Loading project definition from C:\Users\username\IdeaProjects\projectname\project
[info] Loading settings from build.sbt ...
[info] Set current project to example (in build file:/C:/Users/username/IdeaProjects/projectname/)
[error] server failed to start on local:sbt-server-ad238fc8ee352b69065c. java.io.IOException: Could not create lock for
\\.\pipe\sbt-server-ad238fc8ee352b69065c_lock, error 231
Analysing the source of the throw it seems error code 231 refers to Windows error:
ERROR_PIPE_BUSY
231 (0xE7)
All pipe instances are busy.
The pipe cannot be accessed because another process is using it, so try closing down IntelliJ and any other SBT server running, and try again later. Perhaps even reboot the machine, and then start a single system SBT server (not IntelliJ), and see if the issue persists.

Failed to load sbt configuration Play-Scala

i was trying to make a new project with play-scala in my activator, but i keep getting this error:
java.lang.NoClassDefFoundError: play/Play$
Use 'last' for the full log.
Failed to load project.
I found the answer here:
Why does sbt fail with NoClassDefFoundError: play/Play$ in Play 2.2.x projects after sbt compile in Play 2.3 project?
The project/play-fork-run.sbt file in the your-project-name\project folder needs to be removed if you tried the entire process through the "activator ui" web interface.

Can't start cq5 service under windows 7 64bit

One year ago I installed successfully CQ5 as a windows service under Windows 7 32bit. After that I've switched to Windows 7 64bit. Currently I have a project using CQ5 so I install again it (under Window 64bit). CQ5 starts fine with crx-quickstart/bin/start.bat using command line. Also I don't see any problem when installing as service with the command instsrv.bat cq5:
Installing service cq5
runs in E:\servers\cq5-server\author\crx-quickstart
uses E:\servers\cq5-server\author\crx-quickstart\opt\helpers\\..\..\app\cq-quickstart-5.5.0-standalone.jar
starts org.apache.sling.launchpad.app.Main
redirects output to: E:\servers\cq5-server\author\crx-quickstart\logs\startup.log
But when I run net start cq5, I get an error as below:
The cq5 service is starting.
The cq5 service could not be started.
A service specific error occurred: 0.
More help is available by typing NET HELPMSG 3547.
And checking log file commons-daemon.2013-09-01.log, I see:
[2013-09-01 23:26:36] [info] Commons Daemon procrun (1.0.8.0 64-bit) started
[2013-09-01 23:26:36] [info] Running 'cq5' Service...
[2013-09-01 23:26:36] [info] Starting service...
[2013-09-01 23:26:36] [error] Failed creating java
[2013-09-01 23:26:36] [error] The system cannot find the file specified.
[2013-09-01 23:26:36] [error] ServiceStart returned 1
[2013-09-01 23:26:36] [error] The system cannot find the file specified.
[2013-09-01 23:26:36] [info] Run service finished.
[2013-09-01 23:26:36] [info] Commons Daemon procrun finished
Could anyone let me know what I'm wrong?
I'm following the instructions at Installing and Starting Adobe Experience Manager as a Windows Service
I've set up JDK by copying java folder from another computer and setting the environment variable JAVA_HOME. So maybe something is missing in registry.
Below is how to fix the problem:
First follow correctly the first 3 steps in the instructions at Installing and Starting Adobe Experience Manager as a Windows Service. (In my case, I used prunsrv_amd64 to replace prunsrv)
Edit again the bat file instsrv.bat by changing
:: path to a jvm.dll or "auto"
set jvm_path="auto"
to
:: path to a jvm.dll or "auto"
set jvm_path="%JAVA_HOME%\jre\bin\server\jvm.dll"
Finally run instsrv.bat CQ5 under \crx-quickstart\opt\helpers
P/S: This way also does help in case of Windows XP 32bit (I've tested)!
You need to modify the instsrv script to use the 64 bit prunsrv.exe. You'll just want to open up the script and change all prunsrv commands to prunsrv_amd64 or prunsrv_ia64.

GWT Development Mode with Eclipse/Maven

I am just starting with GWT. I use Eclipse and have installed the GWT plugin.
I have followed the directions here Maven GWT 2.0 and Eclipse to set up a GWT project using the gwt-maven-plugin. When I run the Maven goals gwt:compile gwt:run, GWT Development Mode is launched and I can copy the url from it to my browser and view the label.
However, the project has this problem:
Description: The web.xml file does not exist
Resource: WEB-INF
Path: /GWTExample/war
Location: Unknown
Type: Google Web App Problem
If I try to run the project as a Google Web Application, I get this warning:
[WARN] No startup URLs supplied and no plausible ones found -- use -startupUrl
I can get rid of the problem by copying the web.xml to the war directory, but I still get the URL issue when running as a Google Web App.
If I'm using Maven and GWT in Eclipse, should I just ignore the web.xml problem and always run applications in development mode via the Maven goals? Or is there a way to set things so I can run as a Google Web App?
EDIT: Related to the above, is it possible to debug a GWT app running in development mode started by gwt:compile gwt:run? I have added breakpoints to my application but it doesn't stop on them. I'm not sure if it is something I've configured wrong or if it's just not possible.
Update:
In response to Prem's answer...
When I run a compile gwt:run, the web.xml file isn't copied. When I run the install gwt:run, I get this error:
[INFO] --- gwt-maven-plugin:1.2:test (default) # SampleGWT ---
[INFO] using GWT jars from project dependencies : 2.0.4
[INFO] establishing classpath list (scope = test)
[ERROR] java.lang.NoClassDefFoundError: org/codehaus/mojo/gwt/test/MavenTestRunner
[ERROR] Caused by: java.lang.ClassNotFoundException: org.codehaus.mojo.gwt.test.MavenTestRunner
[ERROR] at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
[ERROR] at java.security.AccessController.doPrivileged(Native Method)
[ERROR] at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
[ERROR] at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
[ERROR] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
[ERROR] at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
[ERROR] Could not find the main class: org.codehaus.mojo.gwt.test.MavenTestRunner. Program will exit.
[ERROR] Exception in thread "main"
I’m guessing that bug http://jira.codehaus.org/browse/MGWT-24 is included in version 1.2 of the gwt-maven-plugin. Normally I wouldn’t run install on a project that builds a war file, but I would expect to at least get past the test phase of the build cycle.
Does anybody have any idea why I would get this error on the install but not the compile goals? Also, should I be expecting either goal to copy the web.xml file from src/main/webapp/WEB-INF/web.xml to the /war directory?
Description: The web.xml file does not exist
gwt-maven-plugin creates a project with 'war' packaging format (it's a web app so no surpirse here). Web.xml for this project will be under 'src/main/webapp' folder which will be copied to the 'war' directory (which is set as the output directory) as part of the 'resources' phase in the maven build life-cycle. You should always use
mvn compile gwt:run
or
mvn install gwt:run
so that resources are copied, all java files are compiled and gwt:compile is also invoked (since it is bound to the 'compile' phase automatically)
[WARN] No startup URLs supplied and no plausible ones found -- use -startupUrl
As per the stackoverflow link you used as reference, only your maven build file is setup with startupUrl. In order for it to work in Eclipse, you must edit the Run Configuration of your project and add the '-statupUrl' command line arguments to the existing arguments in the "Arguments" panel.
However, this is just a warning and it should not stop you from running your GWT application from eclipse. If you are facing the same "web.xml" problem here as well, it could be because you did not compile your project in your IDE before invoking "Run as Web Application". I suggest you to disable "Build Automatically" option for this project and always build it manually and invoke "GWT Compile" and then try "Run as web application"
EDIT: Related to the above, is it possible to debug a GWT app running in development mode started by gwt:compile gwt:run?
In general you must use "Remote Application" debug configuration for remote debugging a process. However I am not sure if it will work for GWT projects.
I got me too this warning:
No startup URLs supplied and no plausible ones found
when I have followed this gwt tutorial
In that screenshot there is no checkbox with "Generate sample code" . In my IDE ( sdk 2.5) it is, so I have unchecked...
It wasn't created any of the server and client packages, I have created the client manually, as the tutorial required. The tutorial until that step doesn't say I must have a server package too. That and his configuration is missing from project.
If you right-click on your project and go to Properties -> Google -> Web Application, your WAR directory might be something like either war or src/main/webapp/WEB-INF/classes.
Change that to src/main/webapp.
Also un-check the box next to "Launch and delploy from this directory..."
That's what fixed this problem for me. It also fixed the "can't find gwt-servlet.jar" problem at the same time.