views:

64

answers:

2

Hi All,

This kind of question has been asked before, but has not been well supported at StackOverlfow...maybe because some people think its elementary..but beginners like me have spent days on this but to no avail. Kindly help [I'm sure its going to be an ever occurring issue]

I'm trying to make a flex project and want to integrate Spring 3.0 with it and later Hibernate.

I was trying to follow James Ward's Refcard instructions - http://refcardz.dzone.com/refcardz/flex-4-and-spring-3 , Sadly, I got stuck at an initial point itself as some problem in deploying the project to JBoss (in refcardz it says Tomcat)..

I was trying to use the book 'Flex and Java integration Bible' [it uses JBoss], can somebody tell me if its the right way...or is there some other text ? please help as I have been stuck on this for 2 days now...I want to code and move ahead, not be stuck in configuration issues. I'll be most thankful.

UPDATE-MORE DETAILS :

I started off with using 'Flex and Java Integration Bible, as had no idea of how to integrate so many things (there is no text out there what so ever)'. When I reached the middle of the book, I was not able to do some steps as I guess the version of things changed. I searched and went towards James Ward example (again, not very detailed for a stupid beginner like Me). Using Refcardz, I am stuck at following -- While making the flex spring project, I see the error in console that cannot deploy to server (tried both JBoss and Tomcat). Error trace is as follows (I think some jar as mentioned in Refcardz is to do with it) :

Oct 8, 2010 2:07:24 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.6.0_21\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;c:\Program Files\Common Files\Lenovo;C:\Program Files\Common Files\Roxio Shared\10.0\DLLShared\;C:\Program Files\Common Files\Roxio Shared\DLLShared\;C:\Program Files\Common Files\Roxio Shared\DLLShared\;C:\Program Files\Common Files\Roxio Shared\10.0\DLLShared\;C:\Program Files\ThinkPad\ConnectUtilities;C:\Program Files\Lenovo\Client Security Solution;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\WinSCP3\;C:\Program Files\Java\jdk1.6.0_21\bin;C:\apache-ant-1.8.1\bin;C:\Program Files\Java\jdk1.6.0_21\bin;C:\apache-ant-1.8.1\bin
Oct 8, 2010 2:07:24 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.j2ee.server:flexspring' did not find a matching property.
Oct 8, 2010 2:07:24 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-80
Oct 8, 2010 2:07:24 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 398 ms
Oct 8, 2010 2:07:24 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Oct 8, 2010 2:07:24 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.29
Oct 8, 2010 2:07:25 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
Oct 8, 2010 2:07:25 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [org.springframework.flex.core.ExceptionTranslationAdvice] for bean with name 'org.springframework.flex.core.ExceptionTranslationAdvice#0' defined in null: problem with class file or dependent class; nested exception is java.lang.NoClassDefFoundError: org/aopalliance/aop/Advice
    at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1238)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:576)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getType(AbstractBeanFactory.java:549)
    at org.springframework.flex.config.RemotingAnnotationPostProcessor.findRemotingDestinations(RemotingAnnotationPostProcessor.java:148)
    at org.springframework.flex.config.RemotingAnnotationPostProcessor.postProcessBeanFactory(RemotingAnnotationPostProcessor.java:79)
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:663)
    at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:653)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:407)
    at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
    at org.apache.catalina.core.StandardService.start(StandardService.java:519)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.NoClassDefFoundError: org/aopalliance/aop/Advice
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2733)
    at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1124)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1612)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2733)
    at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1124)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1612)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2733)
    at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1124)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1612)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
    at org.springframework.util.ClassUtils.forName(ClassUtils.java:257)
    at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:408)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1256)
    at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1227)
    ... 25 more
Caused by: java.lang.ClassNotFoundException: org.aopalliance.aop.Advice
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
    ... 53 more
Oct 8, 2010 2:07:25 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
Oct 8, 2010 2:07:25 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/flexspring] startup failed due to previous errors
Oct 8, 2010 2:07:25 PM org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext

Can somebody please give some step by step method to do so..or some existent text to get that intuition. I am a student and interning. Have not felt this helpless in years. I just can't make things happen. [I wonder am I the dumbest to have such a problem.]

Regards, Chirayu

NEXT PROBLEM UPDATE-10/21/2010

The above problem was solved thanks to Splash and James(ans. below), but now after I have done as said in Refcardz, and the sayHello.mxml loads in browser, I enter text, and press sayHello button, upon which this error comes -

[RPC Fault faultString="Send failed" faultCode="Client.Error.MessageSend" faultDetail="Channel.Connect.Failed error NetConnection.Call.Failed: HTTP: Status 404: url: 'http://localhost:8080/flexsping/messagebroker/amf'"] at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::faultHandler()[E:\dev\4.x\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:345] at mx.rpc::Responder/fault()[E:\dev\4.x\frameworks\projects\rpc\src\mx\rpc\Responder.as:68] at mx.rpc::AsyncRequest/fault()[E:\dev\4.x\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:113] at mx.messaging::ChannelSet/faultPendingSends()[E:\dev\4.x\frameworks\projects\rpc\src\mx\messaging\ChannelSet.as:1614] at mx.messaging::ChannelSet/channelFaultHandler()[E:\dev\4.x\frameworks\projects\rpc\src\mx\messaging\ChannelSet.as:1206] at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at mx.messaging::Channel/connectFailed()[E:\dev\4.x\frameworks\projects\rpc\src\mx\messaging\Channel.as:1128] at mx.messaging.channels::PollingChannel/connectFailed()[E:\dev\4.x\frameworks\projects\rpc\src\mx\messaging\channels\PollingChannel.as:406] at mx.messaging.channels::AMFChannel/statusHandler()[E:\dev\4.x\frameworks\projects\rpc\src\mx\messaging\channels\AMFChannel.as:453]

I have no idea what this means...ave spent toooo much of time on this...kindly please help me through. I am trying, and have tried everything..but now do need help of somebody who knows this well. I'll be really thankful.

-Chirayu

+3  A: 

You need to deploy the jar for org.aopalliance.aop.Advice. I guess it is aopalliance-alpha1.jar (which is referenced in the refcard tutorial) which seems not to be in the classpath. This step is explained on page 2 of the Refcard tutorial:

Next, you need to add the dependencies to the flexspring web application. Copy all of the Spring Framework libraries / JAR files to the WebContent/WEB-INF/lib folder. [...] Do the same for aopalliance.jar, [...]

Please read the Refcard attentively. It's an in-depth walkthrough and should cover any needed step.

For more tutorials look at the Adobe Developer Connection:

splash
When you say I need to deploy the jar...can you explain it a bit more ?! Also, again, would you know some text which tells me how to go about doing all this the correct way ?
Chirayu
@Chirayu, sorry no more time at the moment. The second half of the football match Germany against Turkey has been started ... ;-)
splash
@splash..thankx a lot for the help...I'll see if this helps..will thank /trouble more accordingly ! enjoy the match..lol !
Chirayu
splash nailed it. If you get a NoClassDefFoundError then you are missing a jar file.
James Ward
@James, good tutorial anyway!
splash
A: 

Try using something other than bloated Spring garbage and especially "AOP" trash. Use pure-Java PicoContainer and ditch all that ridiculous XML dependency injection config (convention over configuration? ...yeah right) AND the outrageous number of jar hell dependencies (such as the aopappliance junk that is giving you trouble now).

Spring has had it's day, and won big championing a few good concepts like DI and TDD but the implementation of the concept sucks, at this point it's just an absurd number of sub-projects riding the Spring bandwagon. Now there are better alternatives out there which rely on actual Java programming rather than "XML programming".

If you're new you'll be spending time learning anyway, and I guarantee the learning curve for constructor-based Pico dependency injection is easier.

http://www.picocontainer.org/

Crusader
I appreciate your suggestion...but can you give me a path to follow to go about doing this ?! I really need some text based plan to do all this...I am doing stuff alone.
Chirayu