Astrosoft icon indicating copy to clipboard operation
Astrosoft copied to clipboard

birthData is not accepting the arguments

Open JhaSneha opened this issue 6 years ago • 9 comments

It will be a great help if you can help me with the below error:

Exception in thread "main" java.lang.NoClassDefFoundError: swisseph/SweDate at app.astrosoft.beans.BirthData.(BirthData.java:62) at app.astrosoft.beans.BirthData.(BirthData.java:76) at app.astrosoft.beans.BirthData.(BirthData.java:80) at com.example.gradle.GradleExternalJar.TestG.sample(GradleExternalJarApplication.kt:66) at com.example.gradle.GradleExternalJar.GradleExternalJarApplicationKt.main(GradleExternalJarApplication.kt:17) Caused by: java.lang.ClassNotFoundException: swisseph.SweDate at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

my code is :
val place = Place("Bangalore","Karnataka","India", 25.51, 85.47, 5.30) val calendar:Calendar=GregorianCalendar(1995, 5, 18, 5, 12, 1) val birthData = BirthData("Ashwini",calendar,place)

        println("$place ")
        println("$calendar")
        println("$birthData")

JhaSneha avatar Jul 19 '18 10:07 JhaSneha

Which language are you coding and what build system you use? Make sure https://github.com/erajasekar/Astrosoft/blob/master/lib/swisseph.jar is in the classpath.

erajasekar avatar Jul 19 '18 17:07 erajasekar

I am using Kotlin and Gradle ...

JhaSneha avatar Jul 19 '18 17:07 JhaSneha

Since swisseph (also few other jars in libs dir) is not available in maven central. you will need to locally install that jar as dependency in gradle.

See https://medium.com/@petehouston/compile-local-jar-files-with-gradle-a078e5c7a520 https://stackoverflow.com/questions/20700053/how-to-add-local-jar-file-dependency-to-build-gradle-file

Hope that helps.

Raja.

erajasekar avatar Jul 19 '18 17:07 erajasekar

I want to use the calculateAll( ) under the horoscope.java class ,this time I have added all jars locally that were there under AstroSoft lib , below is the error that i am facing :

2018-07-20 16:46:15.526 ERROR 9358 --- [ main] app.astrosoft.pref.AstrosoftPref : Exception in flusing preferences java.util.prefs.BackingStoreException: /etc/.java/.systemPrefs/app/astrosoft/pref create failed. at java.util.prefs.FileSystemPreferences$7.run(FileSystemPreferences.java:619) ~[na:1.8.0_181] at java.util.prefs.FileSystemPreferences$7.run(FileSystemPreferences.java:615) ~[na:1.8.0_181] at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_181] at java.util.prefs.FileSystemPreferences.writeBackCache(FileSystemPreferences.java:614) ~[na:1.8.0_181] at java.util.prefs.FileSystemPreferences.syncSpiPrivileged(FileSystemPreferences.java:801) ~[na:1.8.0_181] at java.util.prefs.FileSystemPreferences.access$2300(FileSystemPreferences.java:50) ~[na:1.8.0_181] at java.util.prefs.FileSystemPreferences$12.run(FileSystemPreferences.java:771) ~[na:1.8.0_181] at java.util.prefs.FileSystemPreferences$12.run(FileSystemPreferences.java:769) ~[na:1.8.0_181] at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_181] at java.util.prefs.FileSystemPreferences.syncSpi(FileSystemPreferences.java:768) ~[na:1.8.0_181] at java.util.prefs.AbstractPreferences.sync2(AbstractPreferences.java:1338) ~[na:1.8.0_181] at java.util.prefs.AbstractPreferences.sync(AbstractPreferences.java:1329) ~[na:1.8.0_181] at java.util.prefs.FileSystemPreferences.sync(FileSystemPreferences.java:747) ~[na:1.8.0_181]

JhaSneha avatar Jul 20 '18 11:07 JhaSneha

No AstroSoft.jar doesn't contain all it's dependencies.

On Fri, Jul 20, 2018, 3:39 AM JhaSneha [email protected] wrote:

My doubt is if i am including your AstroSoft.jar into my project wouldn't it include the rest of external jars that you have internally added into your project

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/erajasekar/Astrosoft/issues/4#issuecomment-406562779, or mute the thread https://github.com/notifications/unsubscribe-auth/AAmaHLX0B5CMhhc38PteSxr9ojC3xfIOks5uIbNEgaJpZM4VWKnf .

erajasekar avatar Jul 20 '18 12:07 erajasekar

https://github.com/JhaSneha/Astrology

JhaSneha avatar Jul 20 '18 14:07 JhaSneha

I have shared my github repo link where my code is added above. This how I am trying to invoke your function (calculateAll) from Horoscope.java, the error I am facing is mentioned above, currently I am using Linux Os . It will be a great help if u can visit to my code once and help me out with the issue. Thank you

JhaSneha avatar Jul 20 '18 14:07 JhaSneha

When you launch your app, set the jvm argument -Djava.util.prefs.PreferencesFactory=app.astrosoft.pref.UserPreferencesFactory. For e.g refer to RunAstroSoft.sh

erajasekar avatar Jul 23 '18 22:07 erajasekar

I have added the jvm argument as you suggested above, still i am facing the issue. Is there anything else that i need to set manually ? Below are the errors 018-07-25 15:30:15.730 ERROR 22167 --- [ main] app.astrosoft.pref.AstrosoftPref : Exception in flusing preferences

java.util.prefs.BackingStoreException: Synchronization failed for node '/app/astrosoft/pref/' at java.util.prefs.MacOSXPreferences.flush(MacOSXPreferences.java:230) ~[na:1.8.0_161] at app.astrosoft.pref.AstrosoftPref.flush(Unknown Source) [AstroSoft.jar!/:na] at app.astrosoft.pref.AstrosoftPref.setAstrosoftFilesDir(Unknown Source) [AstroSoft.jar!/:na] at app.astrosoft.pref.AstrosoftPref.setDefaults(Unknown Source) [AstroSoft.jar!/:na] at app.astrosoft.pref.AstrosoftPref.(Unknown Source) [AstroSoft.jar!/:na] at app.astrosoft.ui.AstroSoft.(Unknown Source) [AstroSoft.jar!/:na] at app.astrosoft.util.SwissHelper.(Unknown Source) [AstroSoft.jar!/:na] at app.astrosoft.util.SwissHelper.(Unknown Source) [AstroSoft.jar!/:na] at app.astrosoft.core.Horoscope.(Unknown Source) [AstroSoft.jar!/:na] at com.example.gradle.GradleExternalJar.TestG.sample(GradleExternalJarApplication.kt:31) [classes!/:na] at com.example.gradle.GradleExternalJar.GradleExternalJarApplicationKt.main(GradleExternalJarApplication.kt:18) [classes!/:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_161] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_161] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_161] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_161] at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [GradleExternalJar-0.0.1-SNAPSHOT.jar:na] at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [GradleExternalJar-0.0.1-SNAPSHOT.jar:na] at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [GradleExternalJar-0.0.1-SNAPSHOT.jar:na] at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) [GradleExternalJar-0.0.1-SNAPSHOT.jar:na]

Exception in thread "main" java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) Caused by: java.lang.ExceptionInInitializerError at app.astrosoft.util.SwissHelper.(Unknown Source) at app.astrosoft.util.SwissHelper.(Unknown Source) at app.astrosoft.core.Horoscope.(Unknown Source) at com.example.gradle.GradleExternalJar.TestG.sample(GradleExternalJarApplication.kt:31) at com.example.gradle.GradleExternalJar.GradleExternalJarApplicationKt.main(GradleExternalJarApplication.kt:18) ... 8 more Caused by: java.awt.HeadlessException at sun.awt.HeadlessToolkit.getScreenSize(HeadlessToolkit.java:284) at app.astrosoft.ui.AstroSoft.getScreenSize(Unknown Source) at app.astrosoft.ui.AstroSoft.(Unknown Source) ... 13 more

JhaSneha avatar Jul 25 '18 10:07 JhaSneha