Monday, April 7, 2014

Delicious

I finally started bookmarking everything I find online that may be of some use to me at a later date.  You can find that list at https://delicious.com/rpaxton516.  I especially like Smashing Magazine and Scott Hanselman's blog.

Friday, August 2, 2013

Applet Not Loading - HTML5

I was asked to debug an issue that was coming up in a colleague's application while he is on vacation this week.  The problem is that intermittently the applet that allows a user to drag a file to a section on the webpage and save it to a network location loads most of the time but not all of the time.  Users are having to close and reload the page to get the applet to load.

I looked in the log files to determine that occasionally the .jnlp file and the .jar file are loaded within a second of each other while most of the time the are loaded simultaneously.  I went through logs for an hour. 

Then someone walks up and takes a look at the actual code with me and we find that we're using the <applet> tag.  Hmmm.  What version of HTML are we using?  5.  OK.  Let's look up the applet tag.

http://www.w3schools.com/tags/tag_applet.asp

You'll notice that HTML5 does not support the <applet> tag.  We're going to change it to <object> and see if that works any better.  This will probably take a couple of weeks to be implemented, so I will be back with a definite answer when this is resolved!

Thursday, June 13, 2013

Error Creating Bean

It's happening again!!! 

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.kinsale.framework.web.json.ObjectMapperFactory#0' defined in ServletContext resource [/WEB-INF/config/spring/applicationContext-common.xml]: Cannot create inner bean 'com.kinsale.framework.web.json.serializer.Iso8601DateFormat#4d6418b4' of type [com.kinsale.framework.web.json.serializer.Iso8601DateFormat] while setting bean property 'dateFormat'; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [com.kinsale.framework.web.json.serializer.Iso8601DateFormat] for bean with name 'com.kinsale.framework.web.json.serializer.Iso8601DateFormat#4d6418b4' defined in ServletContext resource [/WEB-INF/config/spring/applicationContext-common.xml]; nested exception is java.lang.ClassNotFoundException: com.kinsale.framework.web.json.serializer.Iso8601DateFormat
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:281)
    at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:120)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1360)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:383)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4779)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5273)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1566)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1556)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)

This is ridiculous. I have started a new project and in the application context file we have a placeholder for the name of the project called "myproject."  All I had to do was go back and switch all that out to my real project name.  Easy Peasy!

Friday, May 31, 2013

Could not autowire field

This is mostly a note to myself, but maybe this will also help someone else along the way.  I have a problem with forgetting to add the annotation @Repository to the top of my Dao classes.  When I forget to do this, I ALWAYS get a "Could not autowire" error.  Then I clean, rebuild, and republish for like an hour thinking that will solve the problem.  Well, guess what?!?!  That's not the solution!  ADD THE ANNOTATION!

Thursday, May 30, 2013

java.math.BigDecimal cannot be cast to java.lang.Boolean

I have a table that has a column with a value of either -1 or 0 depending on if that row item is default or not.  What it returns in my query is a BigDecimal.  Well guess what?  I don't want a BigDecimal, I want a boolean!  I have to admit, it was near the end of the day and I just wanted to get this knocked out, so I didn't really try searching all over Stack Overflow this time for the answer.  I emailed a coworker and this is how I fixed the problem:

        for (Object[] item : unorganizedList){
            AssignedLimitDefaults assignedLimitDefaultsItem = new AssignedLimitDefaults();
            //accept it as a BigDecimal (because that's how it is returned), then take its
            //integer value (because it's just going to be -1 or 0 anyway)
            //and if it's anything but 0 it will return true and if it's 0 it will return false
            assignedLimitDefaultsItem.setIndDefault(((BigDecimal) item[0]).intValue() != 0);
            assignedLimitDefaultsItem.setNmeLimit(item[1].toString());
            assignedLimitDefaultsItem.setCdeLimit(item[2].toString());
            assignedLimitDefaultsList.add(assignedLimitDefaultsItem);
        }

As you can see, I have an array of Objects that I'm iterating through to create a new object called assignedLimitDefaultsItem.  I had to create a whole new object because I have info coming back from my query that comes from two different tables.  One Hvo object just didn't do the job.  It had never occurred to me before this project that I'm working on now that when I need some info from the db I can just cherry-pick the columns I want and I don't have to use the Hvo objects that are already provided.  If you'd like a detailed example, just ask and I'll make a new post about it!

Tuesday, May 28, 2013

403 Forbidden!!

Yuck.  What is going on with that?!  Everything was going fine until I try to save to my database!  I looked all over Stack Overflow before posting a question... and getting a response from John, who sits across from me at work:

http://stackoverflow.com/questions/16718701/403-forbidden-returned-when-attempting-to-save-to-database

I had encountered this problem before and I didn't write down what the fix was, or where the problem even came from.  No we'll all know what to do!  ResponseMap!!! & produces = "application/json".

Friday, May 24, 2013

No Hibernate Session bound to thread

Here's my error:

{"message":"No Hibernate Session bound to thread, and configuration does not allow creation of  non-transactional one here","success":false}

I've looked all over Stack Overflow (which I find to be a fantastic site for questions and answers). Then before posting a question there, I looked at the message, specifically where it says "configuration does not allow creation of non-transactional one here." I thought to myself and then looked down at one of several sticky notes I have on my monitor stands... "Annotate" it says. Hmmm.
Where have I seen something about "Transactional" before? OH! It's an annotation!  So I added @Transactional to my Dao method that the system was getting hung up on and viola!! Success. Application starts up like normal now! **feeling smart**

Here is the link to my Stack Overflow profile in case you're interested:

http://stackoverflow.com/users/2383389/robyn-paxton

I plan on posting questions there and also commenting in this blog about it.  You're also welcome to ask questions about what I'm doing or about a problem you've encountered.  I'd be happy to help in any way I can!