I have a test case using tomee-embedded and have some jaxrs services
configured to have basic authentication in web.xml. When i try to logon in
my test case, I get the following exception...
java.lang.ClassCastException:
org.apache.openejb.core.security.SecurityServiceImpl cannot be cast to
org.apache.tomee.catalina.TomcatSecurityService
org.apache.tomee.catalina.TomEERealm.logInTomEE(TomEERealm.java:96)
org.apache.tomee.catalina.TomEERealm.authenticate(TomEERealm.java:43)
org.apache.catalina.authenticator.BasicAuthenticator.authenticate(BasicAuthenticator.java:158)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:544)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
java.lang.Thread.run(Thread.java:662)
If i deploy the war file into my stand alone tomee server it works fine.
My pom.xml is below...
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.thc.lc</groupId>
<artifactId>lemonade-cloud-parent</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>lemonade-cloud-app</artifactId>
<packaging>war</packaging>
<name>lemonade-cloud-app</name>
<description>The actual web application. This project would contain all
the
html, jsp and javascript. This would be deployed by the application
container (tomee, glassfish, weblogic etc) and make use of the servlets and
jax-rs classes in the lemonade-cloud-web layer.</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<openejb.version>4.5.1</openejb.version>
<tomee.version>1.5.1</tomee.version>
<arquillian.version>1.0.3.Final</arquillian.version>
<tomee.classifier>jaxrs</tomee.classifier>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>1.0.3.Final</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.thc.lc</groupId>
<artifactId>lemonade-cloud-web</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-impl-maven</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>ziplock</artifactId>
<version>${tomee.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>arquillian-tomee-embedded</artifactId>
<version>${tomee.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>openejb-core</artifactId>
<version>${openejb.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>tomee-jaxrs</artifactId>
<version>${tomee.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.openejb</groupId>
<artifactId>tomee-jaxrs-webapp</artifactId>
<version>${tomee.version}</version>
<type>war</type>
</dependency>
</dependencies>
<build>
<finalName>LemonadeCloud</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
<executions>
<execution>
<id>surefire-it</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<skip>false</skip>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
and my web.xml is....
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<welcome-file-list>
<welcome-file>Forms/login.jsp</welcome-file>
</welcome-file-list>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<security-constraint>
<web-resource-collection>
<web-resource-name>groupList</web-resource-name>
<url-pattern>/service/group/list</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>USER_READ</role-name>
</auth-constraint>
</security-constraint>
<login-config>
<auth-method>BASIC</auth-method>
<realm-name>default</realm-name>
</login-config>
<security-role>
<role-name>USER_READ</role-name>
</security-role>
<resource-ref>
<res-ref-name>MySQL Database</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>
and context.xml...
<?xml version="1.0" encoding="UTF-8"?>
<Context>
<Realm className="org.apache.catalina.realm.DataSourceRealm"
dataSourceName="MySQL Database"
debug="99"
localDataSource="true"
roleNameCol="ROLE_NAME"
userCredCol="PASSWORD"
userNameCol="USER_NAME"
userRoleTable="SEC_USER_ROLES_VW"
userTable="SEC_USER"/>
</Context>
--
View this message in context:
http://openejb.979440.n4.nabble.com/Security-issue-using-arquillian-tomee-embedded-tp4661417.html
Sent from the OpenEJB User mailing list archive at Nabble.com.