Vaadin 7/8 and embedded Jetty - vaadin

I would like to deploy a vaadin (version 7.2.5) web application using embedded jetty (eclipse luna builtin version).
Currently, my code looks like:
public class Launcher {
private static int httpPort = 8080;
public static void main(String[] args) throws Exception
{
Server server = new Server();
SocketConnector connector = new SocketConnector();
connector.setMaxIdleTime(1000 * 60 * 10);
connector.setSoLingerTime(-1);
connector.setPort(httpPort);
connector.setReuseAddress(false);
QueuedThreadPool pool = new QueuedThreadPool();
pool.setMinThreads(10);
pool.setMaxThreads(100);
server.setConnectors(new Connector[] { connector });
server.setThreadPool(pool);
WebAppContext context = new WebAppContext();
context.setServer(server);
context.setContextPath("/");
context.setWar("ReportWriter.war");
context.setClassLoader(Thread.currentThread().getContextClassLoader());
server.setHandler(context);
try
{
server.start();
} catch (Exception e) {
e.printStackTrace();
}
}
}
I've copied it from a vaadin forum thread. The server seems to start and the WAR actually gets extracted.
Pointing my browser to http://localhost:8080/, instead of starting my vaadin (version 7.2.5) app, all what I see is:
Just in case it might be important: My directory tree of the WAR project in eclipse:
ReportWriter
| .classpath
| .project
| ivy.xml
| ivysettings.xml
|
+---.settings
| (...)
|
+---build
| \---classes
| +---(...)
| \---META-INF
| persistence.xml
|
+---src
| +---(...)
| \---META-INF
| persistence.xml
|
\---WebContent
| dropDDL.sql
| init.sql
| reportwriter.xml
|
+---META-INF
| MANIFEST.MF
|
+---VAADIN
\---WEB-INF
\---lib
BorderLayout-0.5.jar
confirmdialog-2.0.4.jar
dawn-2.jar
derby.jar
derbynet.jar
derbyrun.jar
derbytools.jar
messagebox-2.0.6.jar
refresher-1.2.1.7.jar
vaadin-jpacontainer-3.1.1-javadoc.jar
vaadin-jpacontainer-3.1.1-sources.jar
vaadin-jpacontainer-3.1.1.jar
wizards-for-vaadin-1.0.1.jar
And the one of my RWRunner (launcher) project:
RWRunner
| .classpath
| .project
| ivy.xml
| ivysettings.xml
| ReportWriter.war <-- The war file generated from the project above
| test.txt
| web.xml
|
+---.settings
| .jsdtscope
| com.vaadin.integration.eclipse.prefs
| org.eclipse.jdt.core.prefs
| org.eclipse.wst.common.component
| org.eclipse.wst.common.project.facet.core.xml
| org.eclipse.wst.jsdt.ui.superType.container
| org.eclipse.wst.jsdt.ui.superType.name
|
+---build
| \---classes
| \---ch
| \---darkspot
| \---rwrunner
| Launcher.class
|
\---src
\---ch
\---darkspot
\---rwrunner
Launcher.java

Looks like you are somehow missing the servlet configuration needed to map the /* to the Vaadin web application. There seems to be web.xml in place that should take care of that, but check that the content is referring to right Servlet/UI classes and URI.
Alternatively to mapping in web.xml you can have a #WebServlet annotated servlet in your UI class (when using JSR 315):
#WebServlet(value = "/*", asyncSupported = true)
#VaadinServletConfiguration(productionMode = false, ui = MyDemoUI.class)
public static class Servlet extends VaadinServlet {
}
Furthermore, the WAR structure above looks suspicious (although the directory listing in browser screenshot looks ok). Make sure the classes are under /WEB-INF/classes/, in order to be visible for the servlet container. And also that web.xml under /WEB-INF.

Related

Include path has been specified but still failed to include the header in the path in a Bazel C++ project

I have projects with a directory structure like that
---root
| |--src
| |--project1
| |--model
| | |--incude
| | | |--model
| | | |--modelA.hpp
| | | |--modelB.hpp
| | |--modelA.cpp
| | |--modelB.cpp
| | |--BUILD #1
| |...
| |--view
| |...
| |--common
| | |--include
| | |--common
| | |--data_type.hpp
| |--BUILD #2
|--WORKSPACE
As I have other package in this project and some of them use the same self-defined data type, I defined them in a package named common.
Now I include the data_type.hpp in file modelA.hpp
...
#include "common/data_type.hpp
...
Refering to the stage3 example in the tutorial, the BUID(#1) is like that
cc_library(
name = "modelA",
hdrs = "include/model/modelA.hpp",
deps = ["//src/project/common:data_type"],
copts = ["-Isrc/project/common/include"],
)
and the BUILD(#2) which defines the depedency module data_typeis like that
cc_library(
name = "data_type",
hdrs = ["include/common/data_type.hpp"],
visibility = ["//visibility:public"],
)
However, when I built the code, I got
src/project/model/include/model/modelA.hpp: fatal error: common/data_type.hpp: No such file or directory
Why I have defined copts = ["-Isrc/heimdallr/common/include"] but still got this error?
Please check the Header inclusion checking section of C/C++ Rules from the Bazel document. Relative to the workspace directory, all include paths should be created. Kindly refer to this issue for more information. Thank you!

ROS services are not building properly

I am trying to build my custom ROS services. They are inside a another parent package
the structure is as follows:
|--catkine_ws
| |--src
| | |--Parent
| | | |--CMakeLists.txt
| | | |--package.xml
| | | |--ChildA
| | | | |--CMakeLists.txt
| | | | |--package.xml
| | | | |--srv
| | | | | |--SomeService.srv
| | | |--ChildB
The packages are building correctly and I am able to use them in other nodes and packags.
however when I try to use rossrv list the custom services do not appear. I think that this is causing some issues when I try to build my Simulink controller and it cannot find the service message definition.
Does any one have any idea what is going on?
I was able to fix the problem, while not obvious, the solution was rather simple. I had to change the slightly change the structure of the package by making the parent package a meta package then do some handling to make sure that the sub packages still had access to the cmakes to locate my external packages.

Upgrading from Grails 2.2 to 4.0: Is there a cross-reference between old org.codehaus to new grails classes?

We are upgrading an application from Grails 2.2.0 to Grails 4. Obviously the biggest step is Grails 2 to Grails 3, which requires a lot of code changes.
Several pages in the Grails documentation (e.g. http://docs.grails.org/3.1.7/guide/upgrading.html) state:
All package declaration in sources should be modified for the new
location of the respective classes. Example
org.codehaus.groovy.grails.commons.GrailsApplication is now
grails.core.GrailsApplication.
We have a large set of codehaus classes. This comment sounds like the (old) codehaus classes have been moved to multiple packages (presumably all grails.?).
Is there a cross-reference, listing which grails package each codehaus class has been moved to?
NOTE: After doing most work without taking notes, these are x-references for some I did note, if that helps.
| From | To |
|--------------------------------------------------------------------------+--------------------------------------------------------------------+
| org.codehaus.groovy.grails.orm.hibernate.HibernateSession | org.grails.orm.hibernate.HibernateSession |
| org.codehaus.groovy.grails.web.json.JSONObject | org.grails.web.json.JSONObject |
| org.codehaus.groovy.grails.commons.GrailsDomainClass | grails.core.GrailsDomainClass |
| org.codehaus.groovy.grails.plugins.springsecurity.GrailsUser | grails.plugin.springsecurity.userdetails.GrailsUser |
| org.codehaus.groovy.grails.web.json.JSONArray | org.grails.web.json.JSONArray |
| org.codehaus.groovy.grails.plugins.springsecurity.GormUserDetailsService | grails.plugin.springsecurity.userdetails.GormUserDetailsService |
| org.springframework.security.core.authority.GrantedAuthorityImpl | org.springframework.security.core.authority.SimpleGrantedAuthority |
Is there a cross-reference, listing which grails package each codehaus
class has been moved to?
There is not. In part because it is not the case that each grails package has a codehaus counterpart, and vice versa.

Grails - Disable default url mappings

I want to disable default url mappings of grails. I removed all mappings from UrlMappings.groovy file. It is completely empty. But when I run url-mappings-report command, I still see default mappings as
Dynamic Mappings
| * | ERROR: 404 | View: /notFound |
| * | ERROR: 500 | View: /error |
| * | / | View: /index |
| * | /${controller}/${action}?/${id}?(.${format)? | Action: (default action) |
After deleting all mappings in UrlMappings.groovy file, I expect to get 404 not found or an error but It works because of the last mapping we see. How can I get rid of these default mappings ?
Without seeing your project it is difficult to say where that mapping is coming from. It is possible you are using a plugin that provides that mapping.
See the project at https://github.com/jeffbrown/alituranurls.
https://github.com/jeffbrown/alituranurls/blob/master/grails-app/controllers/alituranurls/UrlMappings.groovy contains nothing but the 404 mapping:
package alituranurls
class UrlMappings {
static mappings = {
"404"(view:'/notFound')
}
}
The URL mapping report is consistent with that:
$ ./grailsw url-mappings-report
| * | ERROR: 404 | View: /notFound |

Log4j Configuration File path

We are working on grails and also have microservices. There is a logging service in grails folder and log4j2.xml in grails-app/conf. Now we want to migrate logging service to jar(means outside of grails to one of microservices). So added log4j.xml in our resources folder of maven project. But it is not detecting the configuration file, so logging only to consoles.
Tried several things like
1. Setting system property in code
2. renaming log4j.xml file as log4j2.xml (but it gives error in grails startup)
Edit: Project Structure
Project
|
+-- grails-app
| |
| +-- conf
| |
| +--log4j2.xml
| +-- services/OldLoggingService.groovy
|
+--logevent(mavenproject)
| |
| +-- src/main/groovy/com/log/LogEventProducer.groovy
| +-- src/main/resources/log4j.xml
xml configuration file link
it is not showing any error (just writing logs to console only)

Resources