Could someone take a look at the following to see if they see any issues? I'm going to ask on the Spring forums as well, but they have a new requirement that you now must have created fifteen new threads in order to post anything with URLs or the @ sign. Urgh.

So, using the panel below, the following is thrown...

WicketMessage: Method onLinkClicked of interface org.apache.wicket.markup.html.link.ILinkListener targeted at component [MarkupContainer [Component id = link, page = com.foo.FilterRequest.pages.HomePage, path = 2:tabs:tabs:panel:tabs:tabs-container:tabs:1:link.TabbedPanel$5, isVisible = true, isVersioned = true]] threw an exception

Root cause:

java.lang.IllegalStateException: bean of type [com.foo.ProtocolDAO] not found



I believe I have everything in place, config-wise.


/* begin ShowProtocolsPanel.java */
public class ShowProtocolsPanel extends Panel {
    @SpringBean
    private ProtocolDAO dao;

    public ShowProtocolsPanel(String id) {
        super(id);

        IModel protocolModel = new LoadableDetachableModel() {
            protected Object load() {
                return dao.findAll();
            }
        };

        add(new ListView("eachItem", protocolModel) {
            @Override protected void populateItem(ListItem item) {
final Protocol protocol = (Protocol) item.getModelObject();

                item.add(new Label("keyword", protocol.getKeyword()));
item.add(new Label("description", protocol.getDescription()));
            }
        });
    }
}
/* end ShowProtocolsPanel.java */


<!-- begin web.xml -->
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" 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_2_5.xsd "> <description>This application provides a web frontend to the ACL tool.</description>
    <display-name>Filter Request Tool</display-name>
    <!-- Additional Spring config -->
    <context-param>
<description>Load the application context file for bean definitions, etc.</description>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/applicationContext.xml</param-value>
    </context-param>
    <filter>
<description>Servlet 2.3 Filter that binds a JPA EntityManager to the thread for the entire processing of the request. Intended for the "Open EntityManager in View" pattern, i.e. to allow for lazy loading in web views despite the original transactions already being
            completed. </description>
        <filter-name>lazyLoadingFilter</filter-name>
<filter- class >org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter</ filter-class>
    </filter>
    <!-- acegi filter-->
    <filter>
<description>Delegates Filter requests to a Spring-managed bean.</description>
        <filter-name>Acegi HTTP Request Security Filter</filter-name>
<filter-class>org.acegisecurity.util.FilterToBeanProxy</ filter-class>
        <init-param>
<description>Delegates Filter requests to a list of Spring-managed beans.</description>
            <param-name>targetClass</param-name>
<param-value>org.acegisecurity.util.FilterChainProxy</ param-value>
        </init-param>
    </filter>
    <!-- Spring Wicket app-->
    <filter>
<description>Filter for initiating handling of Wicket requests.</description>
        <filter-name>wicket-spring</filter-name>
<filter-class>org.apache.wicket.protocol.http.WicketFilter</ filter-class>
        <init-param>
<description>Implementation of IWebApplicationFactory that pulls the WebApplication
                object out of spring application context</description>
            <param-name>applicationFactoryClassName</param-name>
<param- value>org.apache.wicket.spring.SpringWebApplicationFactory</param-value>
        </init-param>
    </filter>
    <!-- Acegi filter first, only for /acegi urls -->
    <filter-mapping>
        <filter-name>Acegi HTTP Request Security Filter</filter-name>
        <url-pattern>/frtool/*</url-pattern>
    </filter-mapping>
    <!-- regular mapping for spring wicket app -->
    <filter-mapping>
        <filter-name>wicket-spring</filter-name>
        <url-pattern>/frtool/*</url-pattern>
    </filter-mapping>
    <filter-mapping>
        <filter-name>lazyLoadingFilter</filter-name>
        <url-pattern>/frtool/*</url-pattern>
    </filter-mapping>
    <!-- Listener for Spring -->
    <listener>
<description>Bootstrap listener to start up Spring's root WebApplicationContext. Simply
            delegates to ContextLoader. </description>
<listener-class>org.springframework.web.context.ContextLoaderListener </listener-class>
    </listener>
    <session-config>
        <session-timeout> 30 </session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file/>
    </welcome-file-list>
</web-app>
<!-- end web.xml -->

<!-- begin application.xml -->
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans";
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xmlns:tx="http://www.springframework.org/schema/tx";
    xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
          http://www.springframework.org/schema/tx
          http://www.springframework.org/schema/tx/spring-tx-2.0.xsd";>

<!-- A simple transaction manager for our (single) EntityManagerFactory. --> <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"> <property name="entityManagerFactory" ref="entityManagerFactory"/>
        <!--<property name="dataSource" ref="dataSource"/>-->
    </bean>

    <!-- Exception translation bean post processor -->
<bean class = "org .springframework .dao.annotation.PersistenceExceptionTranslationPostProcessor"/>

    <!--
Instruct Spring to perform declarative transaction management automatically on annotated classes (we want to use Spring's declarative @Transaction management)
-->
    <tx:annotation-driven/>

<!-- This makes Spring perform the magic @PersistenceContext/ @PersitenceUnit injection --> <bean class = "org .springframework .orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/>

<!-- the persistence unit manager reads all the persistence units -->
    <bean id="persistenceUnitManager"
class = "org .springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager">
        <property name="persistenceXmlLocations">
            <list>
                <value>classpath:META-INF/persistence.xml</value>
            </list>
        </property>
        <property name="loadTimeWeaver">
<bean class ="org.springframework.instrument.classloading.SimpleLoadTimeWeaver"/>
        </property>
    </bean>

    <!-- setup wicket application -->
    <bean id="filterRequestApplication"
class="com.foo.FilterRequest.application.FilterRequestApplication"> <property name="authenticationManager" ref="authenticationManager"/>
    </bean>

    <!-- acegi config -->
<!-- Proxy to a set of filters that enforce authentication and authorization. --> <bean id="filterChainProxy" class="org.acegisecurity.util.FilterChainProxy">
        <property name="filterInvocationDefinitionSource">
            <value>
                CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON
                PATTERN_TYPE_APACHE_ANT
                /**=httpSessionContextIntegrationFilter
            </value>
        </property>
    </bean>

<!-- Maintains security context between requests (using the session). -->
    <bean id="httpSessionContextIntegrationFilter"
class="org.acegisecurity.context.HttpSessionContextIntegrationFilter">
        <property name="forceEagerSessionCreation" value="true"/>
    </bean>

    <!-- Users cache for Acegi (Ehcache). -->
<bean id="userCache" class="org.acegisecurity.providers.dao.cache.EhCacheBasedUserCache">
        <property name="cache">
<bean class="org.springframework.cache.ehcache.EhCacheFactoryBean">
                <property name="cacheManager" ref="cacheManager"/>
                <property name="cacheName"
                    value="com.foo.FilterRequest.USER_CACHE"/>
            </bean>
        </property>
    </bean>
<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"/>

<!-- Authentication manager, configured with one provider that retrieves authentication information
        from test data. -->
<bean id="authenticationManager" class="org.acegisecurity.providers.ProviderManager">
        <property name="providers">
            <list>
                <ref local="testAuthenticationProvider"/>
            </list>
        </property>
    </bean>

    <!-- Our NetConf EntityManager -->
    <!-- the entity manager factory for NetConf database -->
    <bean id="entityManagerFactory"
class ="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"> <property name="persistenceUnitManager" ref="persistenceUnitManager"/>
        <property name="persistenceUnitName" value="NetConfPU"/>
    </bean>
    <!-- Authentication provider for test authentication. -->
    <bean id="testAuthenticationProvider"
class="org.acegisecurity.providers.TestingAuthenticationProvider"/>
    <!-- NetConf database bridge beans -->
    <bean id="ProtocolDAO" class="com.foo.ProtocolDAO">
<property name="entityManagerFactory" ref="entityManagerFactory" />
    </bean>
</beans>
<!-- end application.xml -->

<!-- begin persistence.xml -->
<?xml version="1.0" encoding="UTF-8"?>
<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_1_0.xsd"; version="1.0">
    <persistence-unit name="NetConfPU"
                transaction-type="RESOURCE_LOCAL">
        <provider>
            oracle.toplink.essentials.PersistenceProvider
        </provider>
        <class>com.foo.Protocol</class>
        <properties>
            <property name="toplink.jdbc.driver"
                                value="com.mysql.jdbc.Driver" />
            <property name="toplink.jdbc.url"
                                value="jdbc:mysql://localhost/foostuff_dev" />
            <property name="toplink.jdbc.user" value="foostuff" />
            <property name="toplink.jdbc.password" value="foostuff" />
            <property name="toplink.ddl-generation"
                                value="create-tables" />
        </properties>
    </persistence-unit>
</persistence>

<!-- end persistence.xml -->


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to