Required Files and Simple Flex Code!

59 views
Skip to first unread message

Nick

unread,
Jun 14, 2010, 6:46:07 PM6/14/10
to Merapi
Merapi,

First, I appreciate your help. I keep trying to start the newest
svn version of Merapi (06.14.10) in Eclipse(GALILEO) and I've run into
multiple errors, but mostly it's because I need to know all of the
files which are required to be placed in your projects (Flex&Java).
I'm currently placing the commons-logging.jar, flex-messaging-
commons.jar, flex-messaging-core.jar, log4j-1.2.15.jar, spring.jar,
and tools.jar files into a libs folder of my java project which I then
add to my java project build path. I'm also adding the "config"
folder from svn-trunk-java to my java project which contains the
applicationContext.xml & merapi-native-config.xml files (this fixed an
error involving "merapi-native-config"). I have also added the
log4j.xml file to my java project src folder (this fixed a log4j
error). All of these files together and the following lines of code
inside the main method seem to allow the java portion to work (it
prints 4 INFO lines and doesn't crash). Please let me know if I have
missed any files or If I need to alter any of these files. I'm
currently using Flex 4.0, Eclipse Galileo and JDK 1.6.017.
Bridge bridge = Bridge.getInstance();
Message note = new Message();
note.setData("Hello From Java! ");
bridge.sendMessage(note);

I'm receiving more errors from the Flex end of the code. I'm
using Flash Builder 4 built into Eclipse (Flex 4.0) and i'm including
merapi-core-0.1.8-beta.swc and merapi-core-flex.swc files in a libs
folder which I include in the Flex Build path. I seem to be the most
lost when it comes to what files are truly required for the Flex end,
what configurations they may need and what simple lines of code can be
used to receive and send a string such as "hello."

Most all tutorials and examples currently listed on the internet
use the Bridgeinstance where the new Merapi is using only the Bridge
and then message handlers, however, I need to know what beginning
lines of code it would take to send or receive a "hello" using the
Flex end of Merapi. Basically, I'm looking for the updated page of
(http://www.merapiproject.net/index.php?
option=com_content&view=article&id=47&Itemid=64&limitstart=3) which
gives similar examples, but it doesn't give them with the Bridge only
and the message handlers in Flex and Java. And I wanted to know what
files are required to run properly and if they need to be configured
in any special way. I truly appreciate your help as I have researched
all of this for quite a few days and it really seems like I just need
the first step or two to get me going. Thanks again and I look
forward to your response.

Nick

Lyndon Durham

unread,
Jun 14, 2010, 9:27:48 PM6/14/10
to merapi-...@googlegroups.com
Nick,
       I am using Merapi with Flex/Air and in the Flex project besides the Flex SDK swc files, I am using the merapi-core.swc. I believe you need either the core or the beta version of the merapi swc for the Flex side.


--
You received this message because you are subscribed to the Google Groups "Merapi" group.
To post to this group, send email to merapi-...@googlegroups.com.
To unsubscribe from this group, send email to merapi-projec...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/merapi-project?hl=en.


Nick

unread,
Jun 14, 2010, 11:03:15 PM6/14/10
to Merapi
Thank you for the quick reply. It will be nice to have this all
working. I currently have the merapi-core-0.1.8-beta.swc and merapi-
core-flex.swc files included in the Flex build path. Is there another
specific swc named merapi-core.swc I should have?

Lyndon Durham

unread,
Jun 15, 2010, 10:32:46 AM6/15/10
to merapi-...@googlegroups.com
When I expanded the merapi download there were two swcs and two jars. One swc is the merapi-core.swc and the other is the beta version of the core. It looks like you only need either the beta or the core in your flex or air project.


--

Nick

unread,
Jun 15, 2010, 2:05:36 PM6/15/10
to Merapi
I have both projects starting without error. I'm using the
helloworld projects from the svn, but an error is thrown because of
the "RemoteClass" line of code located at the top of the
HelloWorldMessage.as file as soon as I press the "say hello" button
from the Flex screen. I commented the line of code and ran the
projects (Java first), but now it just sits.

I wanted to see if there are a few lines of code on the Flex end
I could use for an even easier test (i'm trying to figure it out from
the helloworld code as of now). I wrote the few simply Java lines of
code I'm currently using for another test in my first post, but I
wanted to see if there are a few lines of code for the Flex end to
work with my already created Java side. And on a side note I did try
to run the projects by only using one or the other .swc files, but I
have both in the build path as of now. It seems to not cause an
error, as you said with one or the other or both. Thanks for your
help, i'm glad the projects are up and running without initial error.

Lyndon Durham

unread,
Jun 15, 2010, 2:22:34 PM6/15/10
to merapi-...@googlegroups.com
Have you ensured that your AS classed map correctly to the java class counterparts? Including the fully qualified name.

Nick

unread,
Jun 15, 2010, 3:10:44 PM6/15/10
to Merapi
I keep checking over all of the links, folder placement, naming and it
all seems to check out. Of course there is always the feeling
something wrong is right in front of you, but the error it keeps
sending me is
[RemoteClass
( alias="merapi.examples.helloworld.messages.HelloWorldMessage" )].

Lyndon Durham

unread,
Jun 15, 2010, 3:45:56 PM6/15/10
to merapi-...@googlegroups.com
Your java package structure matches the one you set in the Remore Class alias definition?


--

Nick

unread,
Jun 15, 2010, 4:01:57 PM6/15/10
to Merapi
The Flex package I have all of my files in is structured with the main
project then the src folder, then default package which includes the
MerapiHelloWorld.mxml (which i'm running) then below the default
package I have the "merapi.examples.helloworld.messages" package which
contains the HelloWorldMessage.as file with the RemoteClass line of
code.

The Java package is structured with my main project folder, then the
src folder, then within that I have the merapi folder, then examples,
then helloworld, then the "HelloWorldRunner.java" (which I run for the
java end) and under the helloworld folder is also the messages folder
which contains the HelloWorldMessage.java file. Do these structures
seem to be off?

ERROR - Cannot create class of type
'javaUSB.src.merapi.examples.helloworld.messages.HelloWorldMessage'.

Lyndon Durham

unread,
Jun 15, 2010, 4:10:11 PM6/15/10
to merapi-...@googlegroups.com
It looks like there is an problem with the way your Java project is structured. Your classpath should not append the javaUSB.src to the classname of the HelloWorldMessage. This would explain why you get the error. You should have a package directive at top of your class that reads package merapi.examples.helloworld.messages.HelloWorldMessage.

Nick

unread,
Jun 15, 2010, 4:20:45 PM6/15/10
to Merapi
I apologize, I put the error with the "javaUSB.src..." at the bottom
to show you my folder structure. When I run the remoteclass with only
"merapi.examples.helloworld.messages.HelloWorldMessage" I still
receive the error. I was searching the internet, is there suppose to
something before "merapi.examples..." which would help direct to my
separate Java project folder (javaUSB)? I have both my Flex project
and my Java project both under the same overall folder on my hard
drive, but of course they are separated from there.

Lyndon Durham

unread,
Jun 15, 2010, 4:39:35 PM6/15/10
to merapi-...@googlegroups.com
Nick,
      Can you look in the output directory for the java side of the project and verify that you have the folders merapi/examples/messages in your output folder?  The default output folder is usually bin.


--

Nick

unread,
Jun 15, 2010, 5:04:04 PM6/15/10
to Merapi
I want to make sure. When you open the build path and then the source
tab are you saying I should add the merapi folder which includes all
the way down to HelloWorldMessage.

Nick

unread,
Jun 15, 2010, 5:26:00 PM6/15/10
to Merapi
I suppose my next question. I appreciate all your help and I don't
want to drag your help for free if we can get this to work more
quickly. I'm working for a company where of course the current
project i'm working on relies on this merapi bridge. Because this
would be the last functionality stepping stone of the project and I
feel we're close to having this work. Would you be interested in
helping me to a point in which the merapi bridge works possibly by
sending me some fully functional merapi projects and helping me to get
them working. I'd be willing to pay by Paypal, check or basically
whatever is acceptable for you if your interested. If your interested
we can talk further by email (my email is ni...@mastermindsystems.com)
and of course what kind of price would you charge for this? Again, I
appreciate your time.

Lyndon Durham

unread,
Jun 15, 2010, 8:44:19 PM6/15/10
to merapi-...@googlegroups.com
Nick,
       Where are the binaries- output of your java source? For example my java binaries are being sent to a bin directory. Inside of my bin directory there is a folder for each package e.g com.netreality.messages.RegistrationDataMessage is compiled into folders com/netreality/messages/RegistrationDataMessage.class. Do you see the same for your HelloWorldMessage?


--

Nick

unread,
Jun 15, 2010, 9:09:19 PM6/15/10
to Merapi
When I have my Java Build Path-Default Output Folder set to the
"foldername/bin" I do not see the bin folder with the binaries. When
I set it to "foldername/src" and tell it not to delete the old folder
or its contents then I do see the binaries. I ran it both ways, but
it still produces the same thing. I also tried the registerClassAlias
lines of code before the RemoteClass, but it didn't seem to work
either. I added the lines below because its what I see from the start
of my Java end to when I press the say hello button on my Flex
HelloWorld program and it gives me the error.

INFO - Refreshing
org.springframework.context.support.FileSystemXmlApplicationContext@1f33675:
display name
[org.springframework.context.support.FileSystemXmlApplicationContext@1f33675];
startup date [Tue Jun 15 21:06:21 EDT 2010]; root of context hierarchy
INFO - Loading XML bean definitions from file [Z:\Nick\USB_JavaDMI
\HWJava_Test\.\config\applicationContext.xml]
INFO - Bean factory for application context
[org.springframework.context.support.FileSystemXmlApplicationContext@1f33675]:
org.springframework.beans.factory.support.DefaultListableBeanFactory@f1bb78
INFO - Pre-instantiating singletons in
org.springframework.beans.factory.support.DefaultListableBeanFactory@f1bb78:
defining beans
[AMF3Reader,AMF3Writer,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor];
root of factory hierarchy
INFO - Merapi started on port: 12345
ERROR - Cannot create class of type
'merapi.examples.helloworld.messages.HelloWorldMessage'.

Reply all
Reply to author
Forward
0 new messages