Are you sure you build tool is setting up your class path correctly? -Brian
> On Nov 8, 2014, at 4:32 PM, Konrad Zuse <[email protected]> wrote: > > Hello all, > > From this link http://shiro.apache.org/configuration.html > > > > Creating a SecurityManager from INI > > Here are two examples of how to build a SecurityManager based on INI > configuration. > > SecurityManager from an INI resource > > We can create the SecurityManager instance from an INI resource path. > Resources can be acquired from the file system, classpath, or URLs when > prefixed with file:, classpath:, or url: respectively. This example uses a > Factory to ingest a shiro.ini file from the root of the classpath and return > the SecurityManager instance: > > import org.apache.shiro.SecurityUtils; > import org.apache.shiro.util.Factory; > import org.apache.shiro.mgt.SecurityManager; > import org.apache.shiro.config.IniSecurityManagerFactory; > > ... > > Factory<SecurityManager> factory = new > IniSecurityManagerFactory("classpath:shiro.ini"); > SecurityManager securityManager = factory.getInstance(); > SecurityUtils.setSecurityManager(securityManager); > When I try to set it like this I get this error > > Exception in Application constructor > 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:483) > at > com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:367) > at > com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:305) > 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:483) > at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767) > Caused by: java.lang.RuntimeException: Unable to construct Application > instance: class uploader.Uploader > at > com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:884) > at > com.sun.javafx.application.LauncherImpl.access$000(LauncherImpl.java:56) > at com.sun.javafx.application.LauncherImpl$1.run(LauncherImpl.java:158) > at java.lang.Thread.run(Thread.java:744) > Caused by: java.lang.reflect.InvocationTargetException > at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) > at > sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) > at > sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) > at java.lang.reflect.Constructor.newInstance(Constructor.java:408) > at com.sun.javafx.application.LauncherImpl$7.run(LauncherImpl.java:791) > at com.sun.javafx.application.PlatformImpl$7.run(PlatformImpl.java:335) > at > com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:301) > at > com.sun.javafx.application.PlatformImpl$6$1.run(PlatformImpl.java:298) > at java.security.AccessController.doPrivileged(Native Method) > at com.sun.javafx.application.PlatformImpl$6.run(PlatformImpl.java:298) > at > com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95) > at com.sun.glass.ui.win.WinApplication._runLoop(Native Method) > at > com.sun.glass.ui.win.WinApplication.access$300(WinApplication.java:39) > at com.sun.glass.ui.win.WinApplication$4$1.run(WinApplication.java:112) > ... 1 more > Caused by: org.apache.shiro.config.ConfigurationException: > java.io.IOException: Resource [classpath:shiro.ini] could not be found. > at org.apache.shiro.config.Ini.loadFromPath(Ini.java:242) > at org.apache.shiro.config.Ini.fromResourcePath(Ini.java:225) > at > org.apache.shiro.config.IniSecurityManagerFactory.<init>(IniSecurityManagerFactory.java:69) > at uploader.Uploader.<init>(Uploader.java:44) > ... 15 more > Caused by: java.io.IOException: Resource [classpath:shiro.ini] could not be > found. > at > org.apache.shiro.io.ResourceUtils.getInputStreamForPath(ResourceUtils.java:139) > at org.apache.shiro.config.Ini.loadFromPath(Ini.java:240) > ... 18 more > Exception running application uploader.Uploader > Java Result: 1 > BUILD SUCCESSFUL (total time: 4 seconds) > > > I have tried to do classpath:pkgname.shiro.ini, > > I have tried moving shiro.ini to the default package, > > and I have tried creating a WEB-INF folder as well with no luck (do I need a > web folder first then Web-INF)? > > > Either way I am getting annoyed. > > I checked my classpath and it goes to build/classes so I figured that was the > best place to work from but nothing is working which is :(. > > Thanks all for any help
