[jboss-user] [JBoss/Spring Integration] - Problem in spring integration

astonishingone do-not-reply at jboss.com
Thu Jun 21 08:56:20 EDT 2007


hi ,
 I am trying to intergrate spring to jboss but am getting error 

i am using jboss jboss-4.0.5.GA 

 i am using example to delpoy JBoss-Spring.ear 
also added jboss-spring-jdk5.jar  to deploy diretory of default of server and also added spring libraries in default lib directory 

when deploy in jboss, I get following error of JBoss-Spring not bound

15:26:54,096 INFO  [DefaultListableBeanFactory] Pre-instantiating singletons in
  | factory [org.springframework.beans.factory.support.DefaultListableBeanFactory de
  | fining beans [randomizer,horoscope]; root of BeanFactory hierarchy]
  | 15:26:54,159 INFO  [DefaultListableBeanFactory] Destroying singletons in factory
  |  {org.springframework.beans.factory.support.DefaultListableBeanFactory defining
  | beans [randomizer,horoscope]; root of BeanFactory hierarchy}
  | 15:26:54,159 ERROR [ContextLoader] Context initialization failed
  | org.springframework.beans.factory.BeanCreationException: Error creating bean wit
  | h name 'randomizer' defined in ServletContext resource [/WEB-INF/applicationCont
  | ext.xml]: Initialization of bean failed; nested exception is javax.naming.NameNo
  | tFoundException: JBoss-Spring not bound
  | javax.naming.NameNotFoundException: JBoss-Spring not bound
  |         at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
  |         at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
  |         at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
  |         at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
  |         at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
  |         at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
  |         at javax.naming.InitialContext.lookup(InitialContext.java:351)
  |         at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java
  | :124)


the structure of ear file is

 JBoss-Spring.ear/
  META-INF/
    application.xml

  business.ejb3
      packed ejbeans 

  spring-pojo.spring/
     org\
         jboss\
               tutorial\
                     spring -- all bean classes 
     META-INF\
           jboss-spring.xml

   web.war  
        WEB_INF\
                  applicationContext.xml
                  jboss-spring-servlet.xml
                  jboss-web.xml
                  web.xml

  application.xml
 
  |  <?xml version="1.0" encoding="UTF-8"?>
  | <application xmlns="http://java.sun.com/xml/ns/j2ee" version="1.4"
  |              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  |              xsi:schemaLocation="http://java.sun.com /xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/application_1_4.xsd">
  |     <display-name>JBoss Spring</display-name>
  |     <description>J2EE Made Easy - JBoss + Spring</description>
  | 
  |     <module>
  |         <ejb>JBoss-Spring.spring</ejb>
  |     </module>
  | 
  |     <module>
  |         <ejb>business.ejb3</ejb>
  |     </module>
  | 
  |     <module>
  |         <web>
  |             <web-uri>web.war</web-uri>
  |             <context-root>jboss-spring</context-root>
  |         </web>
  |     </module>
  | 
  | </application> 





jboss-spring.xml

<?xml version="1.0" encoding="UTF-8"?>
  | <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
  | 
  | <beans>
  | 
  |     <!-- File line readers -->
  | 
  |     <bean id="fileLineReader" class="org.jboss.tutorial.spring.FileLineReader" abstract="true"/>
  | 
  |     <bean id="randomFileLineReader"
  |           class="org.jboss.tutorial.spring.RandomFileWordsCreator"
  |           parent="fileLineReader"
  |           abstract="true">
  |         <property name="intCreator">
  |             <ref local="javaRandomIntCreator"/>
  |         </property>
  |     </bean>
  | 
  |     <!-- Randomizer beans -->
  | 
  |     <bean id="staticWordsCreator" class="org.jboss.tutorial.spring.StaticWordsCreator"/>
  | 
  |     <bean id="fileWordsCreator" parent="fileLineReader">
  |         <property name="resource">
  |             <value>classpath:words.properties</value>
  |         </property>
  |     </bean>
  | 
  |     <bean id="randomWordsCreator" parent="randomFileLineReader">
  |         <property name="resource">
  |             <value>classpath:words.properties</value>
  |         </property>
  |     </bean>
  | 
  |     <bean id="stateIntCreator" class="org.jboss.tutorial.spring.DummyStateIntCreator"/>
  | 
  |     <bean id="javaRandomIntCreator" class="org.jboss.tutorial.spring.JavaRandomIntCreator"/>
  | 
  |     <!-- Horoscope -->
  | 
  |     <bean id="horoscopeSentenceCreator" parent="fileLineReader">
  |         <property name="resource">
  |             <value>classpath:horoscope.properties</value>
  |         </property>
  |     </bean>
  | 
  | </beans>


applicationContext.xml

<?xml version="1.0" encoding="UTF-8" ?>
  | <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
  | 
  | <beans>
  | 
  |     <bean id="randomizer" class="org.springframework.jndi.JndiObjectFactoryBean">
  |         <property name="jndiName">
  |             <value>JBoss-Spring/RandomizerBean/local</value>
  |         </property>
  |     </bean>
  | 
  |     <bean id="horoscope" class="org.springframework.jndi.JndiObjectFactoryBean">
  |         <property name="cache">
  |             <value>false</value>
  |         </property>
  |         <property name="proxyInterface">
  |             <value>org.jboss.tutorial.ee.service.Horoscope</value>
  |         </property>
  |         <property name="jndiName">
  |             <value>JBoss-Spring/HoroscopeBean/local</value>
  |         </property>
  |     </bean>
  | 
  | </beans>


jboss-spring-servlet.xml

<?xml version="1.0" encoding="UTF-8" ?>
  | <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
  | 
  | <!--
  |   - DispatcherServlet application context for JBoss-Spring
  | 	-->
  | <beans>
  | 
  |     <bean id="viewResolver" class="org.springframework.web.servlet.view.ResourceBundleViewResolver">
  |         <property name="basename">
  |             <value>views</value>
  |         </property>
  |     </bean>
  | 
  |     <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
  |         <property name="mappings">
  |             <props>
  |                 <prop key="/number.htm">appController</prop>
  |                 <prop key="/word.htm">appController</prop>
  |                 <prop key="/horoscope.htm">appController</prop>
  |             </props>
  |         </property>
  |     </bean>
  | 
  |     <!-- ========================= CONTROLLER DEFINITIONS ========================= -->
  | 
  |     <bean id="appControllerResolver"
  |           class="org.springframework.web.servlet.mvc.multiaction.PropertiesMethodNameResolver">
  |         <property name="mappings">
  |             <props>
  |                 <prop key="/number.htm">numberHandler</prop>
  |                 <prop key="/word.htm">wordHandler</prop>
  |                 <prop key="/horoscope.htm">horoscopeHandler</prop>
  |             </props>
  |         </property>
  |     </bean>
  | 
  |     <bean id="appController" class="org.jboss.tutorial.web.AppController">
  |         <property name="methodNameResolver">
  |             <ref local="appControllerResolver"/>
  |         </property>
  |         <property name="randomizer">
  |             <ref bean="randomizer"/>
  |         </property>
  |         <property name="horoscope">
  |             <ref bean="horoscope"/>
  |         </property>
  |     </bean>
  | 
  | </beans>

jboss-web.xml 
<?xml version="1.0" encoding="UTF-8"?>
  | <!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 2.3V2//EN" "http://www.jboss.org/j2ee/dtd/jboss-web_3_2.dtd">
  | 
  | <jboss-web>
  | </jboss-web>

web.xml

<?xml version="1.0" encoding="UTF-8"?>
  | <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">
  | 
  | <web-app>
  | 
  |     <display-name>JBoss-Spring-Example</display-name>
  | 
  |     <listener>
  |         <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  |     </listener>
  | 
  |     <servlet>
  |         <servlet-name>jboss-spring</servlet-name>
  |         <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
  |         <load-on-startup>1</load-on-startup>
  |     </servlet>
  | 
  |     <servlet-mapping>
  |         <servlet-name>jboss-spring</servlet-name>
  |         <url-pattern>*.htm</url-pattern>
  |     </servlet-mapping>
  | 
  |     <welcome-file-list>
  |         <welcome-file>index.jsp</welcome-file>
  |     </welcome-file-list>
  | 
  | </web-app>

Thanks in advance for help

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4056462#4056462

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4056462



More information about the jboss-user mailing list