Skip to content

Instantly share code, notes, and snippets.

@cristcost
cristcost / embedded_jetty.md
Created February 7, 2017 16:00 — forked from jesperfj/embedded_jetty.md
Embedded Jetty Archetype

A better way to set up Java web apps

If you're building a Java web app that you yourself or your organization will be deploying then you can save yourself a lot of trouble by avoiding the whole build-to-war + deploy-to-server approach. Instead, you should build your web app as a normal Java application with an embedded web app server. Don't build a WAR, just compile the code and serve the files out of their source location. This has the following advantages:

  • You can code and test iteratively because you don't have to copy files and create war packages every time you make a change. This is similar to what the mvn jetty:run command is being used for by many developers today.
  • You run the same exact code in production as you do in development. Hopefully I don't have to elaborate on the advantages of that. Most developers today use mvn jetty:run or similar to achieve a quick, iterative dev cycle. But come time for deployment, they build a WAR and throw it over the wall to be deployed in some app server
@cristcost
cristcost / Logs of Preparation
Last active March 21, 2016 15:11
Log outputs of test deleting the endorsed Exception
# prepared clean installations of Karaf 4.0.4, ServiceMix 5.3.0, 6.1.0 and 7.0.0
# clone the repo with the fixes
Handwritten:test cristcost$ git clone https://github.com/cristcost/karaf.git
# compile the patched JARs
Handwritten:test cristcost$ cd karaf/
Handwritten:karaf cristcost$ git checkout fix-karaf-4429-2.4.0
Switched to branch 'fix-karaf-4429-2.4.0'
Handwritten:karaf cristcost$ mvn clean install -q -pl exception
@cristcost
cristcost / servicemix.log
Created March 9, 2016 07:33
Log of Servicemix 7.0.0.M1 frezzing at bootstrap when overloaded with features to start at bootstrap
mar 09, 2016 8:27:39 AM org.apache.karaf.main.Main launch
INFORMAZIONI: Installing and starting initial bundles
mar 09, 2016 8:27:39 AM org.apache.karaf.main.Main launch
INFORMAZIONI: All initial bundles installed and set to start
mar 09, 2016 8:27:39 AM org.apache.karaf.main.lock.SimpleFileLock lock
INFORMAZIONI: Lock acquired
mar 09, 2016 8:27:39 AM org.apache.karaf.main.Main$KarafLockCallback lockAquired
INFORMAZIONI: Lock acquired. Setting startlevel to 100
2016-03-09 08:27:40,265 | INFO | FelixStartLevel | fileinstall | 8 - org.apache.felix.fileinstall - 3.5.0 | Creating configuration from jmx.acl.org.apache.karaf.bundle.cfg
2016-03-09 08:27:40,269 | INFO | FelixStartLevel | fileinstall | 8 - org.apache.felix.fileinstall - 3.5.0 | Creating configuration from org.apache.felix.fileinstall-deploy.cfg
<GameStatus turn="0" phase="DEPLOYMENT" sideASize="10" sideBSize="38"/>
<PreStartSequenceLog deployWinner="Terminators" deployFirst="Terminators" startFirst="Genestealer"/>
<!-- #### TURN 1 : Genestealer MOVEMENT -->
<GameStatus turn="1" side="Genestealer" phase="MOVEMENT" distance="24.0" sideASize="10" sideBSize="38"/>
@cristcost
cristcost / gwt_and_json2014.diff
Created February 8, 2014 20:15
Patch to http://svn.apache.org/repos/asf/servicemix/smx4/bundles/trunk revision 1565947 for adding GWT Servlet and org.json 2014 bundles.
Index: gwt-servlet-2.6.0/pom.xml
===================================================================
--- gwt-servlet-2.6.0/pom.xml (revision 0)
+++ gwt-servlet-2.6.0/pom.xml (working copy)
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <!--
+
@cristcost
cristcost / servicemix.bundles.gwt-servlet.pom.xml
Last active August 29, 2015 13:55
pom.xml for org.apache.servicemix.bundles.gwt-servlet
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
@cristcost
cristcost / org.springframework.aop headers
Created January 8, 2014 07:18
headers of org.springframework.aop bundle
karaf@root> headers org.springframework.aop
You are about to access system bundle 74. Do you wish to continue (yes/no):
Spring AOP (74)
---------------
Manifest-Version = 1.0
Tool = Bundlor 1.0.0.RELEASE
Ant-Version = Apache Ant 1.8.2
Implementation-Version = 3.0.7.RELEASE
Implementation-Title = org.springframework.aop
Created-By = 1.6.0_29-b11-402-11M3527 (Apple Inc.)
@cristcost
cristcost / gist:8312917
Created January 8, 2014 07:06
Imports added using dev:dynamic-imports after using the following aop xml configuration: <aop:config> <aop:aspect ref="testAspect"> <aop:around method="traceInvocation" pointcut="execution(* net.cristcost.study.TestServiceImpl.service*(..))" /> <!-- <aop:around method="traceInvocation" --> <!-- pointcut="bean(annotatedService)" /> --> </aop:aspe…
Additional packages wired since dynamic import was enabled:
- org.springframework.http.converter
- org.springframework.security.web.authentication.www
- org.springframework.web.servlet.support
- org.springframework.context.support
- org.springframework.security.web.servletapi
- org.springframework.security.web.session
- org.springframework.security.web.authentication.session
- org.springframework.security.web.access
- org.springframework.security.web.context
com.google.gwt.activity.shared
com.google.gwt.codegen.server
com.google.gwt.core.server
com.google.gwt.core.shared
com.google.gwt.dev.asm
com.google.gwt.dev.asm.commons
com.google.gwt.dev.asm.signature
com.google.gwt.dev.asm.tree
com.google.gwt.dev.asm.util
com.google.gwt.dev.util
@cristcost
cristcost / Header of GWT-servlet.jar
Last active December 27, 2015 18:29
Comparison of OSGi Header of GWT-servlet.jar from using Export-Package: *;version=@Version@ to using to using Export-Package: !javax.validation, !org.hibernate.validator.*, !*.client.*, !*.impl.*, *;version=@Version@
[MANIFEST gwt-servlet.jar]
Ant-Version Apache Ant 1.9.2
Bnd-LastModified 1383911680216
Bundle-ManifestVersion 2
Bundle-Name GWT :: Servlet
Bundle-SymbolicName com.google.gwt.gwt-servlet
Bundle-Version 2.6.0.rc1
Created-By 1.7.0_40 (Oracle Corporation)
Export-Package com.google.gwt.user.server.rpc;uses:="javax.servlet,javax.servlet.http,com.google.gwt.user.server,com.google.gwt.rpc.server,com.google.gwt.util.tools.shared";version="2.6.0.rc1",com.google.gwt.uibinder.elementparsers;uses:="com.google.gwt.safehtml.shared,com.google.gwt.dev.util";version="2.6.0.rc1",com.google.gwt.logging.shared;version="2.6.0.rc1",com.google.gwt.junit.linker;version="2.6