I recently started to program a JSF application. I use ecplise neon with maven3 and jetty webserver for fast test deployment. Everything is fine so far, but now I wanted to try apache shiro, since it seems to be a pretty cool and good security framework.
Now since I user ms sql server i use the jtds db driver. But unfortunately I am not able to get shiro working, because of the following error:
[WARNING] Failed startup of context o.e.j.m.p.JettyWebAppContext@6ea04618{/,[file:///E:/Dev/JSF/Lister/Lister/src/main/webapp/, jar:file:///C:/Users/Dethrall/.m2/repository/com/sun/faces/jsf-impl/2.2.2/jsf-impl-2.2.2.jar!/META-INF/resources],UNAVAILABLE}{file:///E:/Dev/JSF/Lister/Lister/src/main/webapp/} org.apache.shiro.config.ConfigurationException: Property 'database' does not exist for object of type net.sourceforge.jtds.jdbcx.JtdsDataSource.
Especially interesting is the portion "Property 'database' does not exist..." So i looked in the according javadoc and there is indeed no property database.
This brings us down to my question. How am I supposed to configure a jtds datasource in the shiro.ini. If anyone has any suggestions it would be greatly appreciated!
Sorry btw cause I am a little overwhelmed with all this new stuff like maven, jsf, shiro, jetty and so on...
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
<param-value>resources.application</param-value>
</context-param>
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<listener>
<listener-class>org.apache.shiro.web.env.EnvironmentLoaderListener</listener-class>
</listener>
<filter>
<filter-name>ShiroFilter</filter-name>
<filter-class>org.apache.shiro.web.servlet.ShiroFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>ShiroFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
<dispatcher>ERROR</dispatcher>
</filter-mapping>
</web-app>
pom.xml
...
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-core</artifactId>
<version>${shiro.version}</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-web</artifactId>
<version>${shiro.version}</version>
</dependency>
...
shiro.ini
[main]
#authc = org.apache.shiro.web.filter.authc.PassThruAuthenticationFilter
authc.loginUrl = /faces/login.xhtml
authc.successUrl = /faces/users.xhtml
logout.redirectUrl = /faces/users.xhtml
ds = net.sourceforge.jtds.jdbcx.JtdsDataSource
ds.serverName = localhost
ds.portNumber = 1434
ds.user = lister
ds.password = 1234
ds.database = Lister
sha256Matcher = org.apache.shiro.authc.credential.Sha256CredentialsMatcher
jdbcRealm = org.apache.shiro.realm.jdbc.JdbcRealm
jdbcRealm.authenticationQuery = SELECT password FROM trs_sec_t_users WHERE username = ?
jdbcRealm.userRolesQuery = SELECT role FROM trs_sec_t_roles WHERE username = ?
#jdbcRealm.credentialsMatcher = $sha256Matcher
[users]
#admin = admin, ROLE_ADMIN
#root = 1234, ROLE_ADMIN
[roles]
#ROLE_ADMIN = *
[urls]
/faces/users.xhtml = authc
In your shiro.ini, try: 'ds.databaseName = Lister'