Page 1 of 1

smartfox and hibernate

Posted: 05 Oct 2018, 02:52
by Ctrl_Shift_N
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

Re: smartfox and hibernate

Posted: 05 Oct 2018, 07:35
by Lapo
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.

Re: smartfox and hibernate

Posted: 11 Oct 2018, 14:01
by Ctrl_Shift_N
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

Re: smartfox and hibernate

Posted: 11 Oct 2018, 14:54
by Lapo
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?

Re: smartfox and hibernate

Posted: 13 Oct 2018, 09:10
by Ctrl_Shift_N
Lapo wrote:Maybe you've edited the sfs2x.sh?

No, I haven't
But thank you so much :D

Re: smartfox and hibernate

Posted: 13 Oct 2018, 13:50
by Lapo
Did you solve the issue?

Re: smartfox and hibernate

Posted: 15 Oct 2018, 15:29
by Ctrl_Shift_N
Yes, I did.
Run sfs2x.sh solved my problem :D