Search This Blog

Thursday, October 10, 2013

Proximity sensor on IPhone 5 and IOS7 not working

Since the update to IOS7 on my IPhone 5 I sometimes switched the speaker on during a running phone call with my ears. To avoid this you should do the follwing after update your device to IOS 7:

  1. Go to Settings->General->Reset->Reset All Settings
  2. Reboot your device

thats it. A simple test can be done by calling your voice mail an during the call just put your finger on the sensor (it's located  left beside the camera on IPhone5). The sensor will turn of the display once you finger approaches the sensor.

Wednesday, October 9, 2013

HP-UX WebLogic and a Jaxb2Marshaller startup failed with ArrayIndexOutOfBoundsException

I ran in to a problem on a weblogic 10.3.5 instance where we installed an ear file with a new springframework ws application. This application uses a Jaxb2Marshaller for handling the ws messages in a spring config like this:


    <bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller"
          p:contextPath="com.mycomp.ws..client.model" />
    <bean id="sampleWsTemplate" class="org.springframework.ws.client.core.WebServiceTemplate">
    <constructor-arg ref="messageFactory"/>
    <property name="marshaller"      ref="marshaller" />
    <property name="unmarshaller"   ref="marshaller" />
    </bean>

the weblogic container failed to start up the application with the follwing messages:

org.springframework.web.context.ContextLoader Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'service': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.ws.client.core.WebServiceTemplate net.kambrium.service.impl.ServiceImpl.webServiceTemplate; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'WsTemplate' defined in class path resource [webservices.xml]: Cannot resolve reference to bean 'marshaller' while setting bean property 'marshaller'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'marshaller' defined in class path resource [webservices.xml]: Invocation of init method failed; nested exception is java.lang.ArrayIndexOutOfBoundsException: 1
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.ws.client.core.WebServiceTemplate net.kambrium.service.impl.ServiceImpl.webServiceTemplate; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'WsTemplate' defined in class path resource [webservices.xml]: Cannot resolve reference to bean 'marshaller' while setting bean property 'marshaller'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'marshaller' defined in class path resource [webservices.xml]: Invocation of init method failed; nested exception is java.lang.ArrayIndexOutOfBoundsException: 1
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'WsTemplate' defined in class path resource [webservices.xml]: Cannot resolve reference to bean 'marshaller' while setting bean property 'marshaller'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'marshaller' defined in class path resource [webservices.xml]: Invocation of init method failed; nested exception is java.lang.ArrayIndexOutOfBoundsException: 1
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'marshaller' defined in class path resource [webservices.xml]: Invocation of init method failed; nested exception is java.lang.ArrayIndexOutOfBoundsException: 1
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1

after deep diving into a lot of config an other WebLogic settings I found one settings, which was caused the problem. Within the startup of the WebLogic we used some of the tuning options HP recommends for performance reasons:

-XX:-StackTraceInThrowable



after removing that flag from the startup everything went fine. Looks like one of the initialization routines of Jaxb2 or of one of their dependent libs rely on interpreting the StackTrace. With that option we remove the stacktrace and with that we remove the chance for interpreting getStackTrace().

Dirk finally find out the reason for this error within the jaxb implementation. The jaxb uses a Util class, which uses the follwoing code

public static Logger getClassLogger() {
    try {
      StackTraceElement[] trace = new Exception().getStackTrace();      return Logger.getLogger(trace[1].getClassName());    } catch( SecurityException _ ) {
      return Logger.getLogger("com.sun.xml.bind"); // use the default    }
}
well and that's it. The getStackTrace method returns null if the parm -StackTraceInThrowable is set thus resulting in ArrayIndexOutOfBoundsException. Thanks for not catching Exception beside Security Exception.

Friday, September 13, 2013

Eclipse Keppler and the missing type ahead ctrl-space

Well when coding in eclipse I tend to hit ctrl-space frequently. Usually you'll see the proposed methods or vars of the class you point at. After installing a special Keppler build from one of our customers I hit ctrl-space and see a screen with just new, nls, runnable and to array:


well thats the new kind of type ahead from the eclipse guys? Ah, not at all!

Just go to Windows->Preferences->Java->Editor->Content Assist->Advanced and activate "Java Proposals" again:


eh voilá



Thursday, August 22, 2013

Unable to start Rule Studio of WODM aka JRules

I ran into a situation where the rule studio component of JRules 7.1.14 doesn't start anymore. While tumbling around I found out that the Rule Studio.exe just fires up an ant script behind the scenes to start eclipse.
The config of all that desaster lives in \shared\bin. If you have a look at the build.xml in here you'll find a target called runrulestudio. This is the target, which the standard starter fires up. You could even configure your permsize and other config flags here.

As I blamed some misconfiguration of my windows profile or my machine I just wrote a small ant starter to fire the RuleStudio with the environment of my joice like this:


set INSTALLDIR=C:\Program Files (x86)\IBM\WebSphereILOGJRules711
set JAVA_HOME=%INSTALLDIR%\jdk
set ANT_HOME=%INSTALLDIR%\shared\tools\ant
set PATH=%JAVA_HOME%\bin;%ANT_HOME%\bin

c:

cd %INSTALLDIR%\shared\bin

ant runrulestudio -Declipse.location="%INSTALLDIR%\eclipse"



well and that does the trick. Rule Studio starts up again 

Wednesday, July 31, 2013

Windows 7 good to know

Screenshots or snapshots with onboard tool

With Windows 7 you don't need external tools like snagit, gimp, etc. Just use the SnippingTool, which ships with Windows 7!


Send to clipboard as path or name

Well who hasn't used the windows 95 powertoys? One of the need features was "Send to Clipboard as..." which has copied the currently selected file or folder and copied the name or path of it to the clipboard. 
With windows 7 just hold shift key while right clicking the selected files and you will find a new entry within the context menu "Copy as Path". 

Tuesday, July 16, 2013

Pretty print a SOAP Message

Here's a code snip for pretty printing a SOAP message 

import java.io.ByteArrayOutputStream;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;


    private static final Logger LOG = Logger.getLogger(PrettyPrint.class);
 

    /**
     * Pretty print the XML SOAP message
     *
     * @param source the source payload of a SOAP response or request
     * @return the pretty format of the SOAP message
     */

    private String getPrettyPrintSoapSource(Source source) {
        try {
            TransformerFactory tf = TransformerFactory.newInstance();
            Transformer t = tf.newTransformer();
            t.setOutputProperty(OutputKeys.INDENT, "yes");
            t.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");

            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            StreamResult result = new StreamResult(bos);
            t.transform(source, result);
            return bos.toString();
        } catch (Exception e) {
            LOG.error("Error while pretty printing SOAP source", e);
            return "Error while pretty printing SOAP source";
        }
    }

Wednesday, April 10, 2013

No spaces in Misson Control Mac OSX 10.8.3

I like misson control (aka Exposé) in Mac OSX and the spaces functionality, which allows you to control multiple desktops in Mac OSX. Sincce 10.8.3 I noticed sometimes that the spaces just won't show up anymore in Misson Control. To me it seems to be a problem with the Dock as well. The Dock doesn't display correctly. So open up a terminal and enter

killall Dock

after that your spaces within Mission Control will be back and the Dock will restart.

Thursday, April 4, 2013

How to export a google docs document with comment to pdf

If you export a document with google docs to pdf you will loose all your comments. Heres a way to export the doc with comment

  1. Export google docs document to .odt open office file
  2. Open document in OO
  3. Go to export as PDF and select the "export comments" option
  4. Export to PDF with comment