smartfox and hibernate

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

Ctrl_Shift_N
Posts: 11
Joined: 11 Apr 2017, 17:13

smartfox and hibernate

Postby Ctrl_Shift_N » 05 Oct 2018, 02:52

Hello,
I just code my server extension with hibernate without using maven. I copy hiberante, mysql connector... jars file to my libs folder and put hibernate.cfg.xml like this below picture
Image
https://imgur.com/a/TBZYFeO
then i configure jar file like
Image
https://imgur.com/a/srPhAdD
Then I built artifact in Window OS. My extension have run without any error, it was successfully done
But when I copy whole my project to Mac. Opened it and rebuilt artifact, run smartfox and it trace that "Cant not found hibernate.cfg.xml".

Code: Select all

private static final SessionFactory SESSION_FACTORY =
            new Configuration().configure("/resources/hibernate.cfg.xml").buildSessionFactory();

I tried to replace "/resources/hibernate.cfg.xml" with relative path but it still false
What did I wrong?
Sorry, I dont know how to upload images :(
Thank you

p/s: I use IntelliJ to code and build artifact
User avatar
Lapo
Site Admin
Posts: 20277
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: smartfox and hibernate

Postby Lapo » 05 Oct 2018, 07:35

Hi,
there should be no difference in running your project on Mac or Windows, provided you make sure to copy all necessary files in the target locations as the source.

I'd would suggest to double check that you have migrated your working configuration (from Windows) correctly. The error that you're getting suggests that the hibernate.cfg.xml file is not in the same position as in the Windows project.

I tried to replace "/resources/hibernate.cfg.xml" with relative path but it still false

The starting "/" indicates an absolute path from the root, but usually it's not a good idea to use absolute paths.
Did the Windows deployment work with the absolute path?
If so do you have a /resources folder at the root of your HD?

As regards uploading images there's a tab called Attachments below the text area where you type your posts.

Cheers
p.s. = you have posted under the SFS 1.x section, but I think you're using SmartFoxServer 2X? Correct? If so I will move the thread.
Lapo
--
gotoAndPlay()
...addicted to flash games
Ctrl_Shift_N
Posts: 11
Joined: 11 Apr 2017, 17:13

Re: smartfox and hibernate

Postby Ctrl_Shift_N » 11 Oct 2018, 14:01

Sorry, its my fault. I did run sfs2x-standalone instead of running sfs2x.sh :(
Its successfully if I run sfs2x.sh :D
Can you tell me what is different between sfs2x-standalone and sfs2x.sh
User avatar
Lapo
Site Admin
Posts: 20277
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: smartfox and hibernate

Postby Lapo » 11 Oct 2018, 14:54

Hi,
not much really, the both use the same classpath.

The sfs2x-service and sfs2x-standalone use an additional .vmoptions file to add extra JVM settings but they are not used out of the box (meaning that we ship them with no additional VM settings)

I don't think you should see classpath differences between the two scripts, from a fresh installation. Maybe you've edited the sfs2x.sh?
Lapo

--

gotoAndPlay()

...addicted to flash games
Ctrl_Shift_N
Posts: 11
Joined: 11 Apr 2017, 17:13

Re: smartfox and hibernate

Postby Ctrl_Shift_N » 13 Oct 2018, 09:10

Lapo wrote:Maybe you've edited the sfs2x.sh?

No, I haven't
But thank you so much :D
User avatar
Lapo
Site Admin
Posts: 20277
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: smartfox and hibernate

Postby Lapo » 13 Oct 2018, 13:50

Did you solve the issue?
Lapo

--

gotoAndPlay()

...addicted to flash games
Ctrl_Shift_N
Posts: 11
Joined: 11 Apr 2017, 17:13

Re: smartfox and hibernate

Postby Ctrl_Shift_N » 15 Oct 2018, 15:29

Yes, I did.
Run sfs2x.sh solved my problem :D

Return to “Server Side Extension Development”

Who is online

Users browsing this forum: No registered users and 7 guests