24 setembro 2012

Dropbox locked me out

I know Dropbox had a few security issues recently, that required them to add an extra security layer, like the 2-step verification. And that's great! But not allowing its users to, somehow, recover their account access is a little bit, frustrating. All started when I bought a new phone (Samsung Galaxy S3) at the same time that I was changing between carriers (so, different phone number).

Thing is, I missed the opportunity to log in to my Dropbox account to change my phone number, before ending the contract with the previous carrier. And that got me into a weird situation.

Right before ending the carrier contract, I turned on my SGS3, logged in with my Google account and with my Dropbox account, and got 50GB of extra space thanks to Samsung and its partnership with Dropbox. Important note: I still have access to my Dropbox account on my SGS3 throught Dropbox's own Android application.

So I still had the 2-step verification code on my old phone. But after loading lots and lots of apps to the SGS3, and with Dropbox connected, functional and so on, I decided it was OK to Data Factory reset that old phone. Shame on me: I forgot to save that 2svc.

So I emailed Dropbox explaining this, and then I got this reply:

Matthew B. - Dropbox Support, Sep 17 03:09 pm (PDT):Hi Bruno,
Thanks for contacting the Dropbox Support! I'd be happy to help you out.
If you can, please try to login to the website through a computer that you have already logged in since you enabled 2FA. This way you can head to the settings and disable 2FA, and then re-enable it.
If you are unable to log in under any machine, please let me know!
Best,
Matthew

So I replied to him saying that no, I do not have access to my Dropbox account from any computer. Why? Cookies expire, you know? And Dropbox is not the kind of service that we access that often. This time, a new support guy replied this:
Kevin - Dropbox Support, Sep 19 12:20 am (PDT):Hi Bruno,
Unfortunately, for security purposes, if you can't enter the two-step code, and you failed to store the emergency backup code, we have no way to help you regain access to your Dropbox account.
If you still have access to a computer with your Dropbox files on it, you can transfer your files to your new account by unlinking and relinking your Dropbox desktop application to your new account.
For detailed instructions on how to do this, visithttps://www.dropbox.com/help/25Please let me know if there is anything else I can do for you.
Best,
Kevin
Ok, let me put this straight:

  1. I don't have access to my Dropbox from a desktop
  2. I do have access to my Dropbox account from my phone
    1. I can CRUD all files in there
  3. Dropbox says that, for security purposes, they have no way to help me regain access
  4. Dropbox ignores the fact of #2 and #2-1, which is not secure at all, if I wasn't... me
  5. I am able to change my account password without 2-step verif. code
So Dropbox, update your Android app, so I can turn off the 2-step verification, like I would do if I had access from a desktop as you told me to do.

Tip for services like this: if you ever offer some high priority, so freaking important feature like this in your web interface, make sure your mobile app has that same feature.

Box.net, prepare for some mass uploads arriving today in the meanwhile.

14 setembro 2012

Customizing Camel components within Scala DSL

Even though I joined Oracle last July, I continue to have fun with some of other technologies, like the Scala language. And as I used to evangelize the Apache Camel framework in Brazil, I think I still owe some things to the Open Source community.

In a few weeks, I will be at JavaOne to talk about Apache Camel and the Camel Twitter component that I contributed, together with Brett Meyer, months ago. So while developing the demo, I found a small issue with the Camel Scala DSL that couldn't find anywhere else.

How to customize components within the Scala DSL for Apache Camel?
It happens that, using Java DSL, you can customize components simply like this:

But using Scala DSL, does that really work?

Not really... If you try this, the Camel Twitter component will throw an error saying that no token was provided for authentication. So here is how you make it work:

Hope this helps you some day! And you are welcome to attend my session "Leverage Enterprise Integration Patterns with Apache Camel and Twitter", at JavaOne 2012!

25 junho 2012

Maven Archetype: dynamic name for folders

Maven Archetypes are great! But some things lack documentation. If you are considering building your own archetypes, you may need this sooner or later.

I have a Maven Archetype to create modules for Apache Camel, and all of them will come up at the same ClassPath, but how to avoid conflicts when loading the Spring XML ApplicationContext? Put your XML files in different folders, or give them a different name.

I chose the first solution. If you want to give a folder a dynamic name, just call it __someProperty__ (yes, with double underscores). Think as you wanted to name the folder like ${artifactId}, but your operational system may not like this, so that's why Maven works with __artifactId__.

This is an example of my archetype.xml:


<?xml version="1.0" encoding="UTF-8"?>
<archetype>
 <id>module-archetype</id>
 <sources>
  <source>src/main/java/com/mycompany/myproject/Bootstrap.java</source>
 </sources>
 <resources>
  <resource>
    src/main/resources/META-INF/${artifactId}/applicationContext.xml
  </resource>
  <resource>
   src/main/resources/META-INF/${artifactId}/camelContext.xml
  </resource>
  <resource>
   src/main/resources/META-INF/jboss-deployment-structure.xml
  </resource>
 </resources>
</archetype>

And this is the project structure:



This is an archetype to load a Camel Context - with Spring - into JBoss 7.1.1 (as you may noticed from my previous posts) 

:-D

If you want to see more about this architecture, please let me know by +1 this post.

20 junho 2012

JBoss 7.1.1 and CXF WS Client

JBoss 7.1.1 has a slightly small bug that prevents one to use a WS Client (implemented on JBoss with Apache CXF). This issue has already been reported to the JBoss WS component and fixed on JBoss EAP 6.0.0 ER 5 (see this specific issue ticket).

This is the stack trace you may see on your server.log:


Caused by: java.lang.ClassNotFoundException: org.springframework.beans.BeansException from [Module "org.apache.cxf:main" from local module loader @15cda3f (roots: /opt/dev/servers/jboss-as-7.1.1.Final/modules)]
  at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
  at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
  at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
  at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)
  at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
  at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
  ... 96 more


If you have JBoss EAP and a license, just update it. But if you are on JBoss 7.1.1, you have two options to workaround this problem:

  1. One is updating JBoss WS to the upcoming 4.1.0 release (still in beta and it seems it has not been released publicly).
  2. Your best option is to add a Spring module to your JBoss instance and then add a dependency on Spring to the CXF module:

How to add a Spring module to JBoss AS 7?

First thing to do is to choose the best version of Spring. Prefer the latest one (in the time of this writing, 3.1.1). But if your application is using 3.0.x, pick the latest version of this branch.
  1. On the jboss-as-7.1.1-Final folder, create this path:
    • modules/org/springframework/spring/main
      • on Unix, you can do this using $ mkdir -p <path>
  2. Add the following module.xml to this newly created folder
  3. Download these JARs and add them to this  newly created folder
  4. Open this file
    • jboss-as-7.1.1-Final/modules/org/apache/cxf/main/module.xml
  5. At the end of this file, make sure you have this module dependency:
    • <module name="org.springframework.spring" />
Restart your application server.

19 junho 2012

Issue with JBoss and Camel

If you are like me and are trying to run Apache Camel on JBoss 7.1.1, you may face an issue related to this exception:
Error description: You receive a stacktrace with an inner exception
on the form below.
Caused by: java.lang.NullPointerException
at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.checkOverrideProperties(ClassBeanInfoImpl.java:205)
at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.<init>(ClassBeanInfoImpl.java:186)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:509)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:528)
at com.sun.xml.bind.v2.runtime.property.ArrayReferenceNodeProperty.<init>(ArrayReferenceNodeProperty.java:87)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[ ... and a looong intermediary stack trace removed ... The stacktrace
ends with: ]
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:128)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:277)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:372)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:337)
at org.apache.camel.spring.handler.CamelNamespaceHandler.createJaxbContext
This happens because there's a bug on JAXB 2.2.4, the version used by default on JBoss 7.1.1.
I honestly don't know if this also happens to any other JBoss 7 versions, but this is a bug only with JAXB 2.2.4, so if the version you have has this JAXB version, you also have this problem.

To fix this, follow these instructions:

  1. Download the new version of JAXB (from Maven Repo)
    1. jaxb-impl-2.2.5-2
    2. jaxb-xjc-2.2.5-2
  2. Put these files on this JBoss folder:
    1. jboss-as-7.1.1.Final/modules/com/sun/xml/bind/main
  3. Open the file module.xml
    1. replace the old version (2.2.4) with the new one (2.2.5-2)
  4. Done!
Now get back to work!

PS: part of this solution (updating JAXB) is thanks to this thread.
Contato

Email:bruno.borges(at)gmail.com

LinkedIn: www.linkedin.com/in/brunocborges
Twitter: www.twitter.com/brunoborges
Comprei e Não Vou
Rio de Janeiro, RJ Brasil
Oracle
São Paulo, SP Brasil