5 Replies Latest reply on Sep 19, 2007 1:32 PM by

    FDS 2.5 with Hibernate


      I'm working on my first FDS app connecting to MySQL with Hibernate. I've managed to create all the necessary mapping files and deploy my app to JBOSS 4.0 server. I get no errors or warnings (with DEBUG enabled) from JBOSS when deploying the app and I get no compile errors when I build the app. I can see all the Hibernate files are being read by JBOSS successfully. It seems promising that the app should work. My hibernate.cfg.xml and hbm.xml's also are being read. MySQL connector is found.

      When I run this simple app (it's just a 2 column datagrid using a data service I've configured in data-management-config.xml), I get the following:

      [MessagingError message='Destination 'hibernateStates' has no channels defined and the application does not define any default channels.']
      at mx.messaging.config::ServerConfig$/::internalGetChannelSet()
      at mx.messaging.config::ServerConfig$/getChannelSet()
      at mx.messaging::MessageAgent/mx.messaging:MessageAgent::initChannelSet()
      at mx.messaging::MessageAgent/mx.messaging:MessageAgent::internalSend()
      at mx.messaging::Producer/mx.messaging:Producer::internalSend()
      at mx.messaging::AbstractProducer/connect()
      at mx.data::DataStore/ http://www.adobe.com/2006/flex/mx/internal::initialize()
      at mx.data::ConcreteDataService/fill()
      at mx.data.mxml::DataService/fill()
      at TFAppMain/___Button1_click()

      What does this mean?

      Here is my data-management-config.xml:

      <?xml version="1.0" encoding="UTF-8"?>
      <service id="data-service" class="flex.data.DataService">

      <adapter-definition id="actionscript" class="flex.data.adapters.ASObjectAdapter" default="true"/>
      <adapter-definition id="java-dao" class="flex.data.adapters.JavaAdapter"/>

      <channel ref="my-rtmp" />

      <destination id="hibernateStates" channels="my-rtmp">
      <adapter ref="java-dao" />
      <!--This is the unique identifier from the hibernate-entity bean -->
      <identity property="id" />
      <paging enabled="false" pageSize="10" />
      <throttle-inbound policy="ERROR" max-frequency="500" />
      <throttle-outbound policy="REPLACE" max-frequency="500" />


      I'm not sure what else I can check, seems like there are no errors until runtime. Any suggestions would be really helpful! :-)
        • 1. Re: FDS 2.5 with Hibernate
          Mete Atamel Level 1
          Somehow FDS/LCDS thinks that hibernateStates does not define a channel (i.e. my-rtmp). Do you happen to use runtime configuration? In other words, are you creating hibernateStates with a bootstrap service or a remote object?

          If not, could you try this for me? Before you call DataService.fill, try to set your DataService's channelSet manually. Something like this:

          var myDataService:DataService = new DataService("hibernateStates");
          var myChannelSet:ChannelSet = new ChannelSet();
          myChannelSet.addChannel(new RTMPChannel("my-rtmp", "[put url of my-rtmp here]"));
          myDataService.channelSet = myChannelSet;

          And let me know if this works.
          1 person found this helpful
          • 2. Re: FDS 2.5 with Hibernate

            Thank you so much for your quick reply. I'm so close to getting connectivity with my database after a lengthy period of troubleshooting security issues, building mapping files, configuring data services, etc. I am not using runtime configuration.
            However, I am not sure how to incorporate the code you suggested into my 'first simple app'. I tried adding the code but was getting errors.

            Here is what the code looks like now. Maybe there is something obvious I am doing wrong:

            <?xml version="1.0" encoding="utf-8"?>
            <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute">

            <mx:ArrayCollection id="myArray" />

            <mx:DataService id="ds" destination="hibernateStates" autoCommit="true" />

            <mx:DataGrid x="135" y="94" dataProvider="{myArray}">
            <mx:DataGridColumn headerText="State" dataField="statename"/>
            <mx:DataGridColumn headerText="Abbrev" dataField="stateabbrev"/>
            <mx:Button label="Get Data" click="ds.fill(myArray,'states.all',[])" x="135" y="10" width="202"/>

            • 3. Re: FDS 2.5 with Hibernate
              Mete Atamel Level 1
              Ok, this is what you need to do:

              <mx:Application ... creationComplete="creationCompleteHandler()">

              import mx.messaging.ChannelSet;
              import mx.messaging.channels.RTMPChannel;

              private function creationCompleteHandler():void
              var myChannelSet:ChannelSet = new ChannelSet();
              myChannelSet.addChannel(new RTMPChannel("my-rtmp", "[put url of my-rtmp here]"));
              ds.channelSet = myChannelSet;
              1 person found this helpful
              • 4. Re: FDS 2.5 with Hibernate

                Yes, I added the script into my code, get no errors and again same message comes up.

                I also verified in my console log that rtmp is successfully created. So, it seems that either way this error is generated.

                Here are the last few lines of the log:

                17:16:57,296 INFO [SettingsFactory] Deleted entity synthetic identifier rollback: disabled
                17:16:57,296 INFO [SettingsFactory] Default entity-mode: pojo
                17:16:57,296 INFO [SessionFactoryImpl] building session factory
                17:16:57,406 INFO [SessionFactoryObjectFactory] Factory name: TFSessionFactory
                17:16:57,406 INFO [NamingHelper] JNDI InitialContext properties:{}
                17:16:57,406 INFO [SessionFactoryObjectFactory] Bound factory to JNDI name: TFSessionFactory
                17:16:57,406 WARN [SessionFactoryObjectFactory] InitialContext did not implement EventContext
                17:16:57,500 INFO [STDOUT] [Flex] Initializing the NIO RTMP Server.
                17:16:57,546 INFO [STDOUT] [Flex] RTMP-Server listening on port:2038
                17:16:57,609 INFO [EARDeployer] Started J2EE application: file:/C:/jboss-4.0.5.GA/server/default/deploy/TFAppEAR.ear

                • 5. Re: FDS 2.5 with Hibernate

                  I was setting my -services argument wrong.

                  In Project Properties, I went into Flex Compiler options and changed Additional Compiler Arguments from my incorrect folder to:

                  -services "C:\EclipseWorkspace\TFApp\WebContent\WEB-INF\flex\services-config.xml"

                  Since I was deploying my app (TFApp) as an .EAR, it was confusing to me as to what the argument should be, but changing it to my workspace services-config.xml path, not the Server deployment path resolved the problem.