Skip to content

SLF4j version changed and namespace included in xpath #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
target/
Gemfile.lock
12 changes: 5 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -57,4 +55,4 @@ DEPENDENCIES
rspec-mocks (= 2.14.3)

BUNDLED WITH
1.10.5
1.15.3
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
27 changes: 16 additions & 11 deletions buildfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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
Expand All @@ -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
Expand All @@ -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']
Expand Down
106 changes: 106 additions & 0 deletions buildfile-tomee
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion profiles.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion src/main/resources/tomcat/bin/setenv.bat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
set CATALINA_OPTS=-Dbtm.root=%CATALINA_HOME% -Dbitronix.tm.configuration=%CATALINA_HOME%\conf\btm-config.properties
set CATALINA_OPTS=-Dbtm.root=%CATALINA_HOME% -Dbitronix.tm.configuration=%CATALINA_HOME%\conf\btm-config.properties -Dorg.jboss.logging.provider=slf4j
2 changes: 1 addition & 1 deletion src/main/resources/tomcat/bin/setenv.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
CATALINA_OPTS="-Dbtm.root=$CATALINA_HOME -Dbitronix.tm.configuration=$CATALINA_HOME/conf/btm-config.properties"
CATALINA_OPTS="-Dbtm.root=$CATALINA_HOME -Dbitronix.tm.configuration=$CATALINA_HOME/conf/btm-config.properties -Dorg.jboss.logging.provider=slf4j"
16 changes: 5 additions & 11 deletions src/main/resources/tomcat/conf/context.xml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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>
</Context>
51 changes: 38 additions & 13 deletions src/main/resources/tomcat/conf/server.xml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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" />
Expand Down Expand Up @@ -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"
Expand All @@ -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 -->
Expand Down Expand Up @@ -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 &quot;%r&quot; %s %b" />

</Host>
Expand Down
19 changes: 19 additions & 0 deletions src/main/resources/tomee/conf/tomee.xml
Original file line number Diff line number Diff line change
@@ -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>