diff --git a/.gitignore b/.gitignore index 2f7896d..2b39c86 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ target/ +Gemfile.lock diff --git a/Gemfile.lock b/Gemfile.lock index ca2d92b..2ab3b83 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -2,15 +2,14 @@ GEM remote: https://rubygems.org/ specs: atoulme-Antwrap (0.7.5-java) - bouncy-castle-java (1.5.0147) builder (3.2.2) - buildr (1.4.23-java) + buildr (1.4.25-java) atoulme-Antwrap (= 0.7.5) builder (= 3.2.2) bundler diff-lcs (= 1.2.4) hoe (= 3.7.1) - jruby-openssl (~> 0.8.2) + jruby-openssl (~> 0.9.16) jruby-pageant (= 1.1.1) json_pure (= 1.8.0) minitar (= 0.5.4) @@ -23,15 +22,14 @@ GEM diff-lcs (1.2.4) hoe (3.7.1) rake (>= 0.8, < 11.0) - jruby-openssl (0.8.10) - bouncy-castle-java (>= 1.5.0147) + jruby-openssl (0.9.21-java) jruby-pageant (1.1.1-java) json_pure (1.8.0) minitar (0.5.4) net-sftp (2.1.2) net-ssh (>= 2.6.5) net-ssh (2.7.0) - nokogiri (1.6.6.2-java) + nokogiri (1.8.0-java) orderedhash (0.0.6) rake (0.9.2.2) rspec (2.14.1) @@ -57,4 +55,4 @@ DEPENDENCIES rspec-mocks (= 2.14.3) BUNDLED WITH - 1.10.5 + 1.15.3 diff --git a/README.md b/README.md index 2c3761f..8f85f23 100644 --- a/README.md +++ b/README.md @@ -24,8 +24,12 @@ In the same fashion, other database setups can be added. All database configurat be changed in tomcat/conf/resources.properties later on. To create the pre-configured bundle, change the settings in `profiles.yaml` and then run - + + For Tomcat /jruby1.x-x/bin/jruby -S buildr clean package -e mysql + + For TomEE + /jruby1.x-x/bin/jruby -S buildr -f buildfile-tomee clean package -e mysql `-e mysql` identifies the mysql profile. If you have added other profiles in your profiles.yaml, you can select them using the `-e` switch. diff --git a/buildfile b/buildfile index bd08b62..672f88d 100644 --- a/buildfile +++ b/buildfile @@ -17,18 +17,20 @@ require 'nokogiri' # The ODE version to bundle with Tomcat: -ODE_WAR = "org.apache.ode:ode-axis2-war:war:1.3.7-SNAPSHOT" +ODE_WAR = "org.apache.ode:ode-axis2-war:war:1.3.8-SNAPSHOT" # the Tomcat version to bundle ODE with: -TOMCAT_ZIP = "org.apache.tomcat:tomcat:zip:7.0.63" +TOMCAT_ZIP = "org.apache.tomcat:tomcat:zip:8.5.16" # BTM + dependencies BITRONIX = group("btm", "btm-tomcat55-lifecycle", :under=>"org.codehaus.btm", :version=>"2.1.4") -SLF4J = ['org.slf4j:slf4j-api:jar:1.6.4', 'org.slf4j:slf4j-jdk14:jar:1.6.4'] -JTA = 'org.apache.geronimo.specs:geronimo-jta_1.1_spec:jar:1.1.1' -HIBERNATE = [ "org.hibernate:hibernate-core:jar:3.3.2.GA", "asm:asm:jar:3.3.1", - "antlr:antlr:jar:2.7.6", "cglib:cglib:jar:2.2", "net.sf.ehcache:ehcache:jar:1.2.3", - "dom4j:dom4j:jar:1.6.1", "javassist:javassist:jar:3.9.0.GA" ] +SLF4J = ['org.slf4j:slf4j-api:jar:1.7.12', 'org.slf4j:jcl-over-slf4j:jar:1.7.12'] +JTA = 'org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:jar:1.0.0.Final' +HIBERNATE = ["org.hibernate:hibernate-core:jar:4.3.11.Final", "org.javassist:javassist:jar:3.18.1-GA", "antlr:antlr:jar:2.7.7", + "dom4j:dom4j:jar:1.6.1", "org.hibernate.common:hibernate-commons-annotations:jar:4.0.5.Final", + "org.jboss:jandex:jar:1.1.0.Final", "org.jboss.logging:jboss-logging:jar:3.1.3.GA" , + "org.jboss.logging:jboss-logging-annotations:jar:1.2.0.Beta1", + "org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final"] repositories.remote << "http://repo1.maven.org/maven2" @@ -38,7 +40,7 @@ define "apache-ode-tomcat-bundle" do project.version = artifact(ODE_WAR).version project.group = 'de.taval.ode' - exploded_tomcat = unzip(_("target/tomcat") => artifact(TOMCAT_ZIP)).from_path("apache-tomcat-7.0.63").target + exploded_tomcat = unzip(_("target/tomcat") => artifact(TOMCAT_ZIP)).from_path("apache-tomcat-8.5.16").target exploded_ode = unzip(_(:target, 'tomcat/webapps/ode') => artifact(ODE_WAR)).target # filter resources @@ -64,7 +66,10 @@ define "apache-ode-tomcat-bundle" do rm_rf _(:target, "tomcat/webapps/docs") # remove conflicting jar - rm _(:target, "tomcat/webapps/ode/WEB-INF/lib/geronimo-jta_1.1_spec-1.1.jar") + rm _(:target, "tomcat/webapps/ode/WEB-INF/lib/geronimo-jta_1.1_spec-1.1.1.jar") + rm _(:target, "tomcat/webapps/ode/WEB-INF/lib/geronimo-transaction-3.1.3.jar") + rm _(:target, "tomcat/webapps/ode/WEB-INF/lib/geronimo-jpa_2.0_spec-1.1.jar") + # add resources to web.xml resourcesxml = Nokogiri::XML <<-eos @@ -76,12 +81,12 @@ define "apache-ode-tomcat-bundle" do </resource-ref> eos webxml = Nokogiri::XML(File.open(_(:target, "tomcat/webapps/ode/WEB-INF/web.xml"))) - webxml.xpath('//web-app').first.add_child(resourcesxml.root) + webxml.xpath('//xmlns:web-app').first.add_child(resourcesxml.root) File.open(_(:target, "tomcat/webapps/ode/WEB-INF/web.xml"),'w') {|f| webxml.write_xml_to f} # add TomcatFactory to ode-axis2.properties File.open(_(:target, "tomcat/webapps/ode/WEB-INF/conf/ode-axis2.properties"), 'a') do |file| - file.puts "\node-axis2.tx.factory.class = org.apache.ode.axis2.util.TomcatFactory" + file.puts "\node-axis2.tx.factory.class=org.apache.ode.axis2.util.TomcatFactory" file.puts "ode-axis2.db.mode=EXTERNAL" file.puts "ode-axis2.db.ext.dataSource=java:comp/env/jdbc/ode" file.puts "ode-axis2.dao.factory=#{Buildr.settings.profile['filter']['ode.dao']}" if Buildr.settings.profile['filter']['ode.dao'] diff --git a/buildfile-tomee b/buildfile-tomee new file mode 100644 index 0000000..7d7f807 --- /dev/null +++ b/buildfile-tomee @@ -0,0 +1,106 @@ +# 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 +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +require 'nokogiri' + +# The ODE version to bundle with Tomcat: +ODE_WAR = "org.apache.ode:ode-axis2-war:war:1.3.7-SNAPSHOT" +# the Tomcat version to bundle ODE with: +TOMEE_ZIP = "org.apache.openejb:apache-tomee:zip:webprofile:1.7.2" + +SLF4J = ['org.slf4j:slf4j-api:jar:1.7.12', 'org.slf4j:jcl-over-slf4j:jar:1.7.12'] +OPENJPA = ['org.apache.openjpa:openjpa:jar:1.2.3'] +HIBERNATE = [ "org.hibernate:hibernate-core:jar:3.3.2.GA", "asm:asm:jar:3.3.1", + "antlr:antlr:jar:2.7.6", "cglib:cglib:jar:2.2", "net.sf.ehcache:ehcache:jar:1.2.3", + "dom4j:dom4j:jar:1.6.1", "javassist:javassist:jar:3.9.0.GA" ] + + +repositories.remote << "http://repo1.maven.org/maven2" +repositories.remote << "https://repository.apache.org/content/groups/snapshots" + +desc "The Apache ODE Tomcat Bundle project" +define "apache-ode-tomee-bundle" do + + project.version = artifact(ODE_WAR).version + project.group = 'de.taval.ode' + + exploded_tomcat = unzip(_("target/tomcat") => artifact(TOMEE_ZIP)).from_path('apache-tomee-webprofile-1.7.2').target + exploded_ode = unzip(_(:target, 'tomcat/webapps/ode') => artifact(ODE_WAR)).target + + # filter resources + resources.filter.using(:ruby, Buildr.settings.profile['filter']) + + resources.enhance [exploded_tomcat] + resources.enhance do + # explode ODE + exploded_ode.invoke + + # copy filtered resources to tomee + cp_r 'target/resources/tomee/.', _(:target, "tomcat") + + # remove conflicting jar from tomee + rm _(:target, "tomcat/lib/commons-logging-1.1.1.jar") + rm _(:target, "tomcat/lib/slf4j-api-1.7.7.jar") + rm _(:target, "tomcat/lib/slf4j-jdk14-1.7.7.jar") + rm _(:target, "tomcat/lib/openjpa-2.4.0.jar") + + # remove unneeded webapps + rm_rf _(:target, "tomcat/webapps/examples") + rm_rf _(:target, "tomcat/webapps/docs") + + # remove conflicting jar from ODE + rm _(:target, "tomcat/webapps/ode/WEB-INF/lib/geronimo-jta_1.1_spec-1.1.jar") + rm _(:target, "tomcat/webapps/ode/WEB-INF/lib/geronimo-transaction-2.0.1.jar") + rm _(:target, "tomcat/webapps/ode/WEB-INF/lib/geronimo-spec-jms-1.1-rc4.jar") + rm _(:target, "tomcat/webapps/ode/WEB-INF/lib/geronimo-javamail_1.4_spec-1.7.1.jar") + + # copy SLF4J, OPENJPA, JDBC driver to Tomcat + cp artifacts(SLF4J, OPENJPA, Buildr.settings.profile['filter']['jdbc.gav']).collect { |t| t.invoke; t.to_s }, _(:target, 'tomcat/lib') + + if Buildr.settings.profile['filter']['ode.dao'] and Buildr.settings.profile['filter']['ode.dao'].include? "daohib" + cp artifacts(HIBERNATE).collect { |t| t.invoke; t.to_s }, _(:target, 'tomcat/webapps/ode/WEB-INF/lib') + end + + # add resources to web.xml + resourcesxml = Nokogiri::XML <<-eos + <resource-ref> + <res-ref-name>jdbc/ode</res-ref-name> + <res-type>javax.sql.DataSource</res-type> + <res-auth>Container</res-auth> + <res-sharing-scope>Shareable</res-sharing-scope> + </resource-ref> + eos + + webxml = Nokogiri::XML(File.open(_(:target, "tomcat/webapps/ode/WEB-INF/web.xml"))) + + # AxisAdminServlet is not available in the classpath, need to remove it. + webxml.xpath('//xmlns:web-app/xmlns:servlet[xmlns:servlet-name[text()="AxisAdminServlet"]]').remove + webxml.xpath('//xmlns:web-app/xmlns:servlet-mapping[xmlns:servlet-name[text()="AxisAdminServlet"]]').remove + + webxml.xpath('//xmlns:web-app').first.add_child(resourcesxml.root) + + File.open(_(:target, "tomcat/webapps/ode/WEB-INF/web.xml"),'w') {|f| webxml.write_xml_to f} + + # add TomcatFactory to ode-axis2.properties + File.open(_(:target, "tomcat/webapps/ode/WEB-INF/conf/ode-axis2.properties"), 'a') do |file| + file.puts "\node-axis2.tx.factory.class=org.apache.ode.axis2.util.TomcatFactory" + file.puts "ode-axis2.db.mode=EXTERNAL" + file.puts "ode-axis2.db.ext.dataSource=java:comp/env/jdbc/ode" + file.puts "ode-axis2.dao.factory=#{Buildr.settings.profile['filter']['ode.dao']}" if Buildr.settings.profile['filter']['ode.dao'] + end + end + package(:zip).include _("target/tomcat"), :as=>"apache-ode-tomee-bundle-#{project.version}" +end \ No newline at end of file diff --git a/profiles.yaml b/profiles.yaml index 8afe410..74d3e23 100644 --- a/profiles.yaml +++ b/profiles.yaml @@ -9,6 +9,6 @@ mysql: jdbc.url: "jdbc:mysql://localhost:3306/ode" jdbc.user: "root" jdbc.password: "" - jdbc.gav: "mysql:mysql-connector-java:jar:5.1.26" + jdbc.gav: "mysql:mysql-connector-java:jar:5.1.43" ode.dao: "org.apache.ode.daohib.bpel.BpelDAOConnectionFactoryImpl" # for Hibernate #ode.dao: "org.apache.ode.dao.jpa.BPELDAOConnectionFactoryImpl" # for OpenJPA diff --git a/src/main/resources/tomcat/bin/setenv.bat b/src/main/resources/tomcat/bin/setenv.bat index 0719d42..a70814b 100644 --- a/src/main/resources/tomcat/bin/setenv.bat +++ b/src/main/resources/tomcat/bin/setenv.bat @@ -1 +1 @@ -set CATALINA_OPTS=-Dbtm.root=%CATALINA_HOME% -Dbitronix.tm.configuration=%CATALINA_HOME%\conf\btm-config.properties \ No newline at end of file +set CATALINA_OPTS=-Dbtm.root=%CATALINA_HOME% -Dbitronix.tm.configuration=%CATALINA_HOME%\conf\btm-config.properties -Dorg.jboss.logging.provider=slf4j diff --git a/src/main/resources/tomcat/bin/setenv.sh b/src/main/resources/tomcat/bin/setenv.sh index a0c3813..affa35d 100644 --- a/src/main/resources/tomcat/bin/setenv.sh +++ b/src/main/resources/tomcat/bin/setenv.sh @@ -1 +1 @@ -CATALINA_OPTS="-Dbtm.root=$CATALINA_HOME -Dbitronix.tm.configuration=$CATALINA_HOME/conf/btm-config.properties" \ No newline at end of file +CATALINA_OPTS="-Dbtm.root=$CATALINA_HOME -Dbitronix.tm.configuration=$CATALINA_HOME/conf/btm-config.properties -Dorg.jboss.logging.provider=slf4j" diff --git a/src/main/resources/tomcat/conf/context.xml b/src/main/resources/tomcat/conf/context.xml index b65826a..2ec0fae 100644 --- a/src/main/resources/tomcat/conf/context.xml +++ b/src/main/resources/tomcat/conf/context.xml @@ -1,4 +1,4 @@ -<?xml version='1.0' encoding='utf-8'?> +<?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -18,19 +18,13 @@ <!-- The contents of this file will be loaded for each web application --> <Context> - <!-- Default set of monitored resources --> + <!-- Default set of monitored resources. If one of these changes, the --> + <!-- web application will be reloaded. --> <WatchedResource>WEB-INF/web.xml</WatchedResource> + <WatchedResource>${catalina.base}/conf/web.xml</WatchedResource> <Transaction factory="bitronix.tm.BitronixUserTransactionObjectFactory" /> - <!-- Uncomment this to disable session persistence across Tomcat restarts --> <!-- <Manager pathname="" /> --> - - <!-- Uncomment this to enable Comet connection tacking (provides events - on session expiration as well as webapp lifecycle) --> - <!-- - <Valve className="org.apache.catalina.valves.CometConnectionManagerValve" /> - --> - -</Context> \ No newline at end of file +</Context> diff --git a/src/main/resources/tomcat/conf/server.xml b/src/main/resources/tomcat/conf/server.xml index 84eefc9..d9e0ce1 100644 --- a/src/main/resources/tomcat/conf/server.xml +++ b/src/main/resources/tomcat/conf/server.xml @@ -1,4 +1,4 @@ -<?xml version='1.0' encoding='utf-8'?> +<?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with @@ -20,13 +20,12 @@ Documentation at /docs/config/server.html --> <Server port="8005" shutdown="SHUTDOWN"> + <Listener className="org.apache.catalina.startup.VersionLoggerListener" /> <!-- Security listener. Documentation at /docs/config/listeners.html <Listener className="org.apache.catalina.security.SecurityListener" /> --> <!--APR library loader. Documentation at /docs/apr.html --> <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" /> - <!--Initialize Jasper prior to webapps are loaded. Documentation at /docs/jasper-howto.html --> - <Listener className="org.apache.catalina.core.JasperListener" /> <!-- Prevent memory leaks due to use of particular java/javax APIs--> <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" /> <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" /> @@ -63,10 +62,10 @@ <!-- A "Connector" represents an endpoint by which requests are received and responses are returned. Documentation at : - Java HTTP Connector: /docs/config/http.html (blocking & non-blocking) + Java HTTP Connector: /docs/config/http.html Java AJP Connector: /docs/config/ajp.html APR (HTTP/AJP) Connector: /docs/apr.html - Define a non-SSL HTTP/1.1 Connector on port 8080 + Define a non-SSL/TLS HTTP/1.1 Connector on port 8080 --> <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" @@ -78,14 +77,40 @@ connectionTimeout="20000" redirectPort="8443" /> --> - <!-- Define a SSL HTTP/1.1 Connector on port 8443 - This connector uses the JSSE configuration, when using APR, the - connector should be using the OpenSSL style configuration - described in the APR documentation --> + <!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443 + This connector uses the NIO implementation. The default + SSLImplementation will depend on the presence of the APR/native + library and the useOpenSSL attribute of the + AprLifecycleListener. + Either JSSE or OpenSSL style configuration may be used regardless of + the SSLImplementation selected. JSSE style configuration is used below. + --> + <!-- + <Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol" + maxThreads="150" SSLEnabled="true"> + <SSLHostConfig> + <Certificate certificateKeystoreFile="conf/localhost-rsa.jks" + type="RSA" /> + </SSLHostConfig> + </Connector> + --> + <!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443 with HTTP/2 + This connector uses the APR/native implementation which always uses + OpenSSL for TLS. + Either JSSE or OpenSSL style configuration may be used. OpenSSL style + configuration is used below. + --> <!-- - <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" - maxThreads="150" scheme="https" secure="true" - clientAuth="false" sslProtocol="TLS" /> + <Connector port="8443" protocol="org.apache.coyote.http11.Http11AprProtocol" + maxThreads="150" SSLEnabled="true" > + <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" /> + <SSLHostConfig> + <Certificate certificateKeyFile="conf/localhost-rsa-key.pem" + certificateFile="conf/localhost-rsa-cert.pem" + certificateChainFile="conf/localhost-rsa-chain.pem" + type="RSA" /> + </SSLHostConfig> + </Connector> --> <!-- Define an AJP 1.3 Connector on port 8009 --> @@ -134,7 +159,7 @@ Documentation at: /docs/config/valve.html Note: The pattern used is equivalent to using pattern="common" --> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" - prefix="localhost_access_log." suffix=".txt" + prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t "%r" %s %b" /> </Host> diff --git a/src/main/resources/tomee/conf/tomee.xml b/src/main/resources/tomee/conf/tomee.xml new file mode 100644 index 0000000..118d4bb --- /dev/null +++ b/src/main/resources/tomee/conf/tomee.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<tomee> + <!-- see http://tomee.apache.org/containers-and-resources.html --> + <!-- activate next line to be able to deploy applications in apps --> + <!-- <Deployments dir="apps" /> --> +<TransactionManager type="TransactionManager"> +</TransactionManager> + +<Resource id="jdbc/ode" type="DataSource"> + jdbcDriver=com.mysql.jdbc.Driver + jdbcUrl=jdbc:mysql://localhost/ode + userName=root + password= + defaultAutoCommit=false + jtaManaged=true + initialSize=2 + maxActive=30 +</Resource> +</tomee>