RSS .92| RSS 2.0| ATOM 0.3
  • Home
  • Artigos
  • Publicações
  • Apresentações
  • Interviews
  • Livros
  • Contact
  • About
  •  

    m2eclipse is the most unstable Eclipse plugin I’ve ever used

    November 16th, 2008

    I gave up using m2eclipse with Eclipse Ganymede. That’s not premature. I tried my best to figure out a way to use the plugin in a reliable way. However, that’s over now, I quit!

    The plugin would be great and extremely useful if it worked. Really, I’d love to have this plugin as an everyday tool, helping me deliver software. It offers a very productive way to work with Maven in Eclipse, except that it brakes Eclipse in such an unbearable way that I cannot afford to think about using it anymore.

    Initially I was using m2eclipse with an external Maven installation, instead of the embedded one. With this setup, I was facing many (and I mean MANY) NullPointerExceptions doing some Maven stuff in the IDE. It was impossible to work with that much errors, so I tried using the embedded Maven installation.

    Initially it seemed like I was gonna be able to work without problems, but I was wrong. Instead of all the NullPointerExceptions, now Eclipse itself would crash hard when I used the POM editor. Adding a dependency, adding a new build plugin. I was frequently having Eclipse crashes doing this stuff.

    I first thought that it could be just an issue in the “graphical” POM editor, so I tried using the simple XML editor. The errors kept occuring, and I got mad.

    I could live with this problem if my Eclipse crashed 2 or 3 times a day. I’d gladly restart it, and keep working. However, facing Eclipse crashes every 5-10 minutes can make you crazy before you deliver any piece of software.

    I am a man of faith, so I’ll try using it with Eclipse Europa and with minimal features, to see if it hangs on. I use this setup at work, and although it doesn’t work perfectly, at least it stands a whole day without crashing.

    Maven is such a widespread Java tool. It’s far from unanymous among developers, but it’s a very valuable tool for me. I think it deserves much better tooling support, so I hope this Ganymede mess is fixed someday. But maybe the Eclipse ecosystem got so complex that it’s becoming impossible to keep everything stable.

    I’ve tried using Netbeans before, but I couldn’t be nearly as productive as I am with Eclipse. So please Eclipse, please don’t let me down!


    Passed today on SCEA Part I

    November 6th, 2008

    This morning I took the Sun Certified Enterprise Architect Part I Exam. I wasn’t very excited studying for this exam, but the exam itself was just fine.

    What I liked the most about the test was that many questions presented different problems and requirements, and asked me to give the most suitable solution. Besides that, most of the design patterns questions were contextual. Based on a given problem, I had to decide which patterns could help in the design of a good solution for the problem. I liked the fact that these questions made me THINK much more than REMEMBER stuff. There were a few questions focused on specific pattern details, but fortunately they were only a small portion of the exam.

    There are many EJB/JPA questions in the exam, but if you’re familiar with the technologies, you should have no problem with them. The questions were not tricky. If you know the main aspects of these technologies, you’ll be just fine.

    There were several Web Services questions, actually more than I expected. I liked this, because such knowledge is very important for any enterprise architect, and I’m particularly interested in the subject. I have a reasonable experience with web services, and I thought the questions were not very demanding.

    The exam objective that I thought was my weakest was security. I didn’t know much about the JVM Security prior to this exam, and now I’m still no expert, but I did learn a few things.

    Overall, I thought this was a nice exam and definitely it was more pleasant than I expected. I had 120 minutes to do the exam, but it took me around 80 minutes to finish it. The SCJP and SCWCD exams were more tiresome than this one. When I finished the exam, I wasn’t sure if I had passed, but the same thing happened to me in the SCJP and SCWCD exams, and I did ok.

    There are 64 questions in the exam, and the minimum score to pass is 57% (37 questions). I answered 49 questions correctly, which translated into a 76% score.

    Now I must checkout the Part 2 Assignment, and design an application during a 1 year span. I definitely won’t touch anything this year, because I must chill out. I hope Part 2 gives me more pleasure than Part 1, and hopefully I’ll learn a few more things.

    If anyone’s planning to take this exam and want to talk about it, feel free to contact me, and I’ll try to help.


    Estudar para SCEA é tão chato que eu vou até rabujar a respeito!

    October 20th, 2008

    Eis que num fim de semana chuvoso, com minha noiva viajando, fico eu várias horas em casa estudando para a prova de Arquiteto Java.

    Tudo bem, a culpa é minha mesmo. No final do ano passado eu resolvi aproveitar uma das promoções de vouchers com retake da Sun, e comprei não 1, mas 2 vouchers de uma vez. Naquela época eu achava que iria gostar de estudar para as provas de EJB 3 e Web Services.

    Bom, ao longo desse ano eu estudei bastante mesmo. E coisas muito legais. Mas em nenhum momento me senti tentado a fazer nenhuma dessas provas, e fui enrolando, enrolando, e meus vouchers vencem dia 30/11. Em setembro eu já sabia que não tinha nenhuma hipótese de eu fazer 2 certificações, então resolvi estudar para a de arquiteto, e usar 1 dos vouchers para a prova teórica, e o outro para a parte prática. E é pra isso que estou estudando, mas como é chato!!!

    Para esta prova eu não sabia muito bem que material seguir, então estou lendo o único livro que me pareceu razoável:

    Na verdade eu não estou gostando do livro, mas estou lendo alguns tópicos por ele. Os 4 primeiros capítulos falam de aspectos gerais de arquitetura, análise e projeto OO e aplicabilidade da arquitetura Java EE. Eu passei rapidamente por eles, e acho que deve ter sido tão divertido como escutar a “Voz do Brasil”. Teoricamente os assuntos poderiam ser interessantes, mas a exposição é feita de forma tão enfadonha e repetitiva que acho que não consegui obter nada de útil desse conteúdo.

    Basicamente eu lia uma porção de coisas que eu já sei, algumas coisas que eu discordo, e alguns devaneios da Sun. É, por exemplo aquele papo insano de que designers podem escrever JSPs… hahahaha! Se eu tentasse ensinar JSP pro designer do meu time ele ia fazer dezenas de caricaturas e montagens minhas no Photoshop, pra eu aprender o que é trabalho de designer :)

    Bom, nesse momento eu estou acabando a parte dedicada a estudar padrões de projeto. Certamente posso dizer que está sendo a melhor parte do estudo, mas me fez refletir um pouco também. Nessa prova são abordados todos os padrões do GoF e todos os Core J2EE Patterns. São 24 padrões do GoF e 22 do Core J2EE Patterns. Uma boa parte eu já conhecia e estou revendo, e outros eu nem conhecia.

    Sempre é bom dedicar um tempo para estudar padrões de projeto, mas deveria ser possível filtrar apenas o que interessa. Eu não gosto de Singletons, não gosto de DTOs e não gosto de usar EJBs, então eu já poderia limar facilmente uns 10 padrões dessa lista. Eu gosto bem mais dos patterns do “Patterns of Enterprise Application Architecture (PEAA)”, mas esses infelizmente não estão na prova… :(

    E outra coisa, é fundamental não ficar bitolado nesses patterns. Se você tiver uma overdose de patterns, sua criatividade ficará prejudicada e talvez você siga por um caminho não muito legal só porque existe um pattern para aquilo. Padrões de projeto são interessantes pela possibilidade de te trazer idéias novas para problemas comuns. Mas o importante é que você adquira o know-how e as ferramentas de raciocínio, e pense por si mesmo. Eu já peguei projetos em que parecia que os desenvolvedores estavam procurando problemas para aplicar os patterns, em vez de usar os patterns como idéias para resolver bem um problema que havia surgido. Mais importante do que qualquer padrão de projeto é raciocinar, pensar bem no problema. Rabisque qualquer abobrinha num papel e resolva bem o seu problema com bom software. Ser uma enciclopédia de patterns não faz de ninguém um programador ou arquiteto melhor.

    Bom, para finalizar meus rabujos sobre esta prova, devo dizer que estou decepcionado com o que estou absorvendo em minha preparação para ela. Quando eu me preparei para as provas de SCJP e SCWCD, eu nitidamente evoluí como desenvolvedor neste processo. Foi muito válido fazer essas 2 provas e o tempo que dediquei estudando para elas me tornou um desenvolvedor mais eficiente.

    Agora, esta prova de SCEA não está me agregando nada até o momento. Eu poderia estar estudando outras coisas mais interessantes e eu não vou ser um arquiteto melhor por ter este título. Talvez a parte prática dessa certificação seja mais legal, mas até agora ela está servindo apenas para eu não desperdiçar meus 2 vouchers que estão expirando.

    Será que na prova prática eu posso usar os patterns do PEAA e montar uma arquitetura sem EJBs, sem SOAP, sem JSF e sem DTOs?? Ou será que isso vai ser censurado? :) Bom, acho que vou pagar pra ver, pelo menos vai ser bem mais divertido! :)


    JSR-311 finally approved!

    September 24th, 2008

    Yesterday the JSR-311 (Java API for RESTFul Web Services - JAX-RS) was finally approved!

    I’m using Jersey (the JSR’s reference implementation) for more than 6 months and I was anxious to have the specification approved.

    In my team we’re currently using Jersey 0.7 in production, and were waiting for the JSR to be approved to analyse the final version of its implementations. Now we’ll wait for both Jersey and JBoss RESTEasy to release their final versions and we’ll analyse both to see which one we’ll use in our RESTFul services.

    If anyone wants to give me good reasons to use either one of the implementations, now it’s the perfect time! I’m hearing… :)


    WSO2 Registry now working in JBoss 4.0.5

    September 24th, 2008

    After some extra effort today, I did manage to get WSO2 Registry working in JBoss 4.0.5

    The huge amount of jdbc error messages in the server logs were not actually errors. JBoss datasources have a configuration element called <track-statements>. When this option is turned on, JBoss logs massively when there are Statements or ResultSets that are left open. The application server closes the Statements and the ResultSets, and shows many many logs indicating this. The log messages I was seeing were not errors in the Registry, they were only JBoss warnings.

    All our datasources in my team have this option turned on, and we always take care to close the ResultSets and Statements in all our applications. But since the server closes the ResultSets and Statements, I can live with the way the Registry does :)

    I had to do some things to get the Registry working in JBoss. First, I had to remove the log4j the Registry had packed inside its war file. Our JBoss servers use the Unified Classloader, for several years already. This setup was there before I even joined the company, and it’d complicated to change this now, because it’d make us modify several applications. Not being able to change the Classloader, the log4j packed inside the Registry (1.2.13) would conflict with the one present in JBoss itself (1.2.8), so I had to remove it from the Registry’s war. The application worked just fine using log4j 1.2.8, so it’s ok to do this.

    After fixing this, I had to enable Java 1.5 code in the jsps. JBoss by default does not allow Java 1.5 code in the jsps, and to modify this, I had to uncomment the code below inside JBOSS_HOME/server/default/deploy/jbossweb-tomcat55.sar/conf/web.xml:

    <init-param>
    <param-name>compilerSourceVM</param-name>
    <param-value>1.5</param-value>
    </init-param>

    This init-param belongs to <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>, and solves the jsp compilation problem.

    Well, that’s what I had to do to make WSO2 Registry work in JBoss. Most of the problems I faced were not Registry’s fault, so I’m sorry for having a wrong impression after some setup problems this week.

    I’m currently integrating WSO2 Registry in our architecture and once I finish, I’ll document our architecture here, so that other people can see what uses we’re making of the product.


    RESTFul Registry update

    September 23rd, 2008

    Well, as I said recently, we want to use a registry to keep URIs of our services and also some configurations that are currently in properties files.

    After looking better at WSO2 Registry, I figured out how to do what I need with the product. I had a very short time to evaluate properly WSO2 Registry and Mule Galaxy before my last post, but after another evaluation of them, I concluded I can use them in this case.

    Last week I developed a Java client to consume my publications from WSO2 Registry. It wasn’t much fun to develop, because I had to make it compatible with JDK 1.4. This prevented me from using their client API, which runs only on JDK 1.5 and above.

    Since I had to use JDK 1.4, I used XStream for my Java <-> XML mappings. Not being able to use the Registry’s Java client, I also had to consume data from their AtomPub API. I used Apache Abdera 0.3 for this task, which was their last version supporting JDK 1.4 (through retroweaver).

    So far so good. Last week I had a prototype client consuming stuff from the Registry, so I moved on to some other tasks. Well, today I started integrating the Registry in my application. That meant moving from Tomcat 6 to JBoss 4.0.5. And that’s when I got in trouble.

    Unfortunately I hadn’t seen this page before. It turns out that the only application server they have tested enough is Tomcat. And not any Tomcat, only Tomcat 6. Since their distribution format is a .war file, I never would think they support only Tomcat. In their download page it says: “This distribution includes the Webapp module with relevant JAR files and other resources to be deployed in the servlet container, providing a Web UI and an APP interface.”

    Well, I’m probably just dumb. They didn’t say “a servlet container“. They said “the servlet container“. This certainly means “the servlet container we support, which is Tomcat 6″. But this is not written there, so dumb people like me will be subject to mistakes.

    “Heck, this is open source, I’m gonna make it work on JBoss!”. This was my first thought. And then I started setting up the Registry in JBoss, right after lunch today.

    The first thing I noticed is that the Registry packs a newer version (1.2.13) of log4j than the one present in JBoss (1.2.8). This shouldn’t be a problem, but anyone who has experienced some of the JBoss Classloader Hell knows that it’s not a wise decision to bring a newer version of log4j inside your application if you’re going to run on JBoss. This is not a Registry fault, so I gladly fixed the problem by removing the log4j they had packed inside the .war file.

    After fixing this, I was gettings errors trying to open the Registry’s index page on JBoss. I quickly found out that their jsps had scriptlets using JDK 1.5 code, and JBoss was not able to compile the jsps. This was easy to fix by uncommenting a init-param in the web.xml in the Tomcat module inside JBoss. However, the amount of scriplets inside their pages was the first symptom that something didn’t smell right.

    After fixing the jsp problem, I configured the Registry to connect to MySql through a JBoss datasource. I then could open their index page and even use some features. However, when I started checking the server logs I was shocked. A huge amount of errors in jdbc operations. I had no clue of what was going wrong, because the UI was apparently working normally and the database was being manipulated.

    Well, since it’s an open source product, I promptly checked out their code and started looking for problems. Most errors occured in simple jdbc operations like the creation of a prepared statement. The application logs were not very helpful, and I couldn’t figure out where the problem was.

    However, something scared me a lot. Between the zillions of jdbc errors, I saw JBoss screaming for help, saying that the PreparedStatements were left open. I went to look at their jdbc code, and it definitely needs care. There were a LOT of jdbc operations inside try/catch blocks, where they treated SQLExceptions. I didn’t see the finally blocks closing the PreparedStatements and the ResultSets. This explains JBoss’s complaints about the PreparedStatements.

    After several hours trying to use WSO2 Registry inside JBoss and looking at their code, I must say I am VERY discouraged to put anything in production right now using the product.

    I just downloaded Mule Galaxy and now I’m gonna try to integrate it in my application. A very good sign is that they say I can use it with ANY servlet container, including Tomcat and Jetty. I think it’ll be a successful effort, but it’s hard to say anything after my problems with WSO2 Registry today.

    But knowing Dan Diephouse’s work for several years, I’m pretty confident in this new attempt. I’ll post the results later this week.


    Vídeos e slides da palestra de REST em Fortaleza

    September 21st, 2008

    Foram publicados os vídeos da minha palestra de REST no aniversário do CEJUG, no dia 16/09/2008. Eu os coloquei embutidos abaixo para facilitar a visualização por parte dos interessados.

    Deixo enormes agradecimentos ao René por ter filmado e pelo esforço heróico de publicar todos esses vídeos no Youtube, para que todos tivessem acesso.

    Como ainda sou um palestrante amador, todo feedback será bem-vindo, para me ajudar a progredir aos poucos. :)

    Web Services Rest

    View SlideShare presentation or Upload your own. (tags: rest)

    Bruno Pereira is Digg proof thanks to caching by WP Super Cache!