Java
Gradle Script to Generate Java classes from a wsdl using axis 1.6
daniel Mon, 07/22/2013 - 1:40pm
Some Resouces:
This is an update of the gradle build script from a previous post which uses a newer version of axis and gradle:
apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'eclipse'
apply plugin: 'maven'
sourceCompatibility = 1.7
version = '1.0.0'
group = 'com.bowerstudios'
jar {
manifest {
attributes 'Implementation-Title': 'MyApp', 'Implementation-Version': version
}
}
repositories {
mavenCentral()
}
configurations {
compile
runtime
axisGenAntTask
}
dependencies {
groovy group: 'org.codehaus.groovy', name: 'groovy', version: '2.0.5'
compile 'log4j:log4j:1.2.16',
'commons-collections:commons-collections:3.2.1',
'commons-codec:commons-codec:1.5'
compile('org.apache.axis2:axis2-adb:1.6.2') //may need to exclude woden
compile 'org.apache.axis2:axis2-transport-local:1.6.2',
'org.apache.axis2:axis2-transport-http:1.6.2'
testCompile group: 'junit', name: 'junit', version: '4.+'
axisGenAntTask 'org.apache.axis2:axis2-ant-plugin:1.6.2'
}
task genWsdlClasses() << {
ant.echo(message:'Generating Classes for use with WSDL')
ant.taskdef(
name: 'genClassesFromWSDL',
classname: 'org.apache.axis2.tool.ant.AntCodegenTask',
classpath: configurations.axisGenAntTask.asPath
)
ant.genClassesFromWSDL(
wsdlfilename: 'https://mywebservice.com/xml/wsdls/OrgInfo.wsdl',
databindingName: 'adb',
allPorts: true,
overWrite: true,
// skipBuildXML: true, // optional
// syncOnly: true, //optional
targetSourceFolderLocation: 'src/main/java',
unpackClasses: true
)
}
Determine whether your java install has limited key strength due to export restrictions
daniel Tue, 07/16/2013 - 2:28pm
Detect the allowed size of AES keys on the JVM on github by jehrhardt
Or, in Groovy:
import javax.crypto.Cipher;
import java.security.NoSuchAlgorithmException;
int allowedKeyLength = 0
try {
allowedKeyLength = Cipher.getMaxAllowedKeyLength("AES")
} catch (NoSuchAlgorithmException e) {
e.printStackTrace()
}
if(allowedKeyLength < Integer.MAX_VALUE){
println "The allowed key length for AES is: $allowedKeyLength, which is less than Integer.MAX_VALUE, and therefore 'Limited' as defined in the JavaDoc for Cipher.getMaxAllowedKeyLength()"
}else{
println "The allowed key length for AES is: $allowedKeyLength, which is equal to Integer.MAX_VALUE, and therefore 'Unlimited' as defined in the JavaDoc for Cipher.getMaxAllowedKeyLength()"
}
Spring Batch and Grails
daniel Thu, 07/11/2013 - 11:19am
- Spring Batch and Hibernate info
- Grails Spring Batch plugin with updates by Infinum
- Using spring batch and spring integration together
- Infinum Spring Batch Utils - utils for using spring batch with groovy
- Read more about Spring Batch and Grails
- Log in to post comments
Spring @RequestBody in Grails
daniel Thu, 07/11/2013 - 10:59am
Use Ian Roberts's response instead
- Read more about Spring @RequestBody in Grails
- Log in to post comments
Spring / Pivotal Branding
daniel Thu, 07/11/2013 - 10:27am
As a former user of Pivotal Tracker (great product), the recent combined branding of Spring/Pivotal had me scratching my head.
This post explains it a bit.
- Read more about Spring / Pivotal Branding
- Log in to post comments
Configuring multiple tomcat instances as services on windows
daniel Wed, 05/08/2013 - 12:41pm
- Install Services (tomcat)
- stackoverflow - gave me a clue on where to look for my situation
- Tomcat Workers Reference
- Running Multiple Tomcat Instances on windows
- Setup multiple instance of tomcat on windows
- previous BowerStudios article on installing tomcat with iis on windows
I ended up installing everything tomcat related to:
C:\tomcat
Under that directory, I have:
- apache-tomcat-6.0.36.win64
- apps
- critical_apps
- isapi
I put all the isapi stuff under the one directory (isapi_redirect.dll, isapi_redirect.properties, uriworkermap.properties, and workers.properties, and it all worked fine. Just be sure to get the paths correct in the rest of the config (follow the BowerStudios guide above to configure isapi).
The apache-tomcat-6.0.36.win64 is just the windows version of tomcat extracted from a zip file. You'll need the the tomcat6.exe and tomcat6w.exe executables in the bin directory
Once you've got those two things done, create your additional instances (mine are apps and critical_apps, with basically empty directories save the conf directory. The guides above will help for seeing what to put in them. You'll need to configure the ports for each of the instances, and tweak other bits in the conf directories. Your webapps will go in their respective webapps directories of the instances.
Then in each of the instance directories, I added the following scripts (which are all based off the service.bat script in the bin directory):
install_service.bat: run once to install this instance of tomcat as a service
set CATALINA_BASE=C:\tomcat\apps
set CATALINA_HOME=C:\tomcat\apache-tomcat-6.0.36.win64
set "EXECUTABLE=%CATALINA_HOME%\bin\tomcat6.exe"
set SERVICE_NAME=TomcatApps
set TOMCAT_DISPLAY_NAME=Tomcat Apps
set PR_DESCRIPTION=Apps - Apache Tomcat 6.0.36
set "PR_LOGPATH=%CATALINA_BASE%\logs"
set "PR_CLASSPATH=%CATALINA_HOME%\bin\tomcat-juli.jar;%CATALINA_HOME%\bin\bootstrap.jar"
set "PR_JVM=%JAVA_HOME%\jre\bin\server\jvm.dll"
set PR_STDOUTPUT=auto
set PR_STDERROR=auto
set PR_INSTALL=%EXECUTABLE%
%CATALINA_HOME%\bin\tomcat6 //IS//%SERVICE_NAME% --DisplayName="%TOMCAT_DISPLAY_NAME%" --Install --Jvm=auto --StartMode=jvm --StopMode=jvm --StartClass=org.apache.catalina.startup.Bootstrap --StartParams=start --StopClass=org.apache.catalina.startup.Bootstrap --StopParams=stop
%CATALINA_HOME%\bin\tomcat6 //US//%SERVICE_NAME% --JvmOptions "-Dcatalina.base=%CATALINA_BASE%;-Dcatalina.home=%CATALINA_HOME%;-Djava.endorsed.dirs=%CATALINA_HOME%\endorsed" --StartMode jvm --StopMode jvm
%CATALINA_HOME%\bin\tomcat6 //US//%SERVICE_NAME% ++JvmOptions "-Xdebug;-Xrunjdwp:transport=dt_socket,address=8001,server=y,suspend=n;-Djava.rmi.server.hostname=127.0.0.1;-Dcom.sun.management.jmxremote.ssl=false;-Dcom.sun.management.jmxremote.authenticate=false;-Djava.io.tmpdir=%CATALINA_BASE%\temp;-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager;-Djava.util.logging.config.file=%CATALINA_BASE%\conf\logging.properties" --JvmMs 512 --JvmMx 1024
echo The service '%SERVICE_NAME%' has been installed.
remove_service.bat (only run if necessary)
set CATALINA_BASE=D:\tomcat\apps
set CATALINA_HOME=D:\tomcat\apache-tomcat-6.0.36.win64
set SERVICE_NAME=TomcatApps
%CATALINA_HOME%\bin\tomcat6 //DS//%SERVICE_NAME%
echo The service '%SERVICE_NAME%' has been removed.
update_service.bat (run as necessary to update attributes of the service through the ui
set CATALINA_BASE=D:\tomcat\apps
set CATALINA_HOME=D:\tomcat\apache-tomcat-6.0.36.win64
set SERVICE_NAME=TomcatApps
start %CATALINA_HOME%\bin\tomcat6w.exe //ES//%SERVICE_NAME%
Hibernate - using sql reserved words in your domain model
daniel Wed, 05/08/2013 - 11:25am
It is possible, as noted here on stackoverflow
Hopefully my need for this is only temporary
This can also be applied to grails in your conf/DataSource.groovy (the last line):
hibernate {
cache.use_second_level_cache = true
cache.use_query_cache = false
cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory'
globally_quoted_identifiers=true
}
Group Management app
daniel Wed, 05/08/2013 - 11:11am
I've heard bits about Grouper by the internet2 consortium, and I'll probably check it out in detail sometime. It appears to be a Java app built with svn and maven for managing groups of users.
- Read more about Group Management app
- Log in to post comments
HttpClient doesn't seem to send secure cookies (for https/ssl)
daniel Thu, 03/14/2013 - 11:09am
In my case, it was because I was using the wrong constructor:
I was using:
public HttpHost(final String hostname, int port)
instead of:
public HttpHost(final String hostname, int port, final String scheme)
