简体   繁体   中英

Wrong class path while deploying JASIG CAS in JBOSS 7

I'm trying to deploy a CAS web application on JBOSS 7. The package name is cas-server-webapp-3.4.11.war .

I'm facing the following error during install:

09:37:06,951 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/cas-server-webapp-3.4.11]] (MSC service thread 1-5) Exception sending context initialized event to listener instance of class org.springframework.web.util.Log4jConfigListener: java.lang.IllegalArgumentException: Invalid 'log4jConfigLocation' parameter: class path resource [log4j.xml] cannot be resolved to absolute file path because it does not reside in the file system: vfs:/D:/Programming/jboss7/bin/content/cas-server-webapp-3.4.11.war/WEB-INF/classes/log4j.xml

Deployment package is located in D:\\Programming\\jboss7\\standalone\\deployments\\cas-server-webapp-3.4.11.war , but obviously JBOSS tries to resolve paths to D:/Programming/jboss7/bin/content/cas-server-webapp-3.4.11.war .

How I can change this path?

For CAS 1.5 log4j configuration is defined in WEB-INF/cas.properties file where you define the location.

I used this configuration:

log4j.config.location=${jboss.server.base.dir}/deployments/cas-server-webapp.war/WEB-INF/classes/log4j.xml

However, when application server doesn't unpack war during deployment it doesn't work anyway because this file is not on filesystem. So the easiest way is to disable initialization of this bean at all by deleting src/main/webapp/WEB-INF/spring-configuration/log4jConfiguration.xml file.

Also this issue is relevant to this topic .

Solution is the following:

In persistence.xml put the following content:

<persistence xmlns="http://java.sun.com/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
    version="2.0">

<persistence-unit name="CasPersistence" transaction-type="RESOURCE_LOCAL">
    <class>org.jasig.cas.services.RegisteredServiceImpl</class>
    <class>org.jasig.cas.ticket.TicketGrantingTicketImpl</class>
    <class>org.jasig.cas.ticket.ServiceTicketImpl</class>
    <class>org.jasig.cas.ticket.registry.support.JpaLockingStrategy$Lock</class>
    <properties>
        <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
    </properties>
</persistence-unit>

In web.xml instead of:

<context-param>
    <param-name>log4jConfigLocation</param-name>
    <param-value>classpath:log4j.xml</param-value>
</context-param>

put

<context-param>
    <param-name>log4jConfigLocation</param-name>
    <param-value>WEB-INF\classes\log4j.xml</param-value>
</context-param>

Hope this will help & save time to others.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM