Announcement Announcement Module
Collapse
No announcement yet.
Deployment on JBoss and/or Tomcat Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Deployment on JBoss and/or Tomcat

    Hi folks,

    i'm currenly working on a spring application using hibernate for o/r mapping and spring mvc for the web tier. Until now i've always deployed the system to a jboss server (which is installed because i have to do a lot of university stuff on jboss).

    Everything is fine so far. The current system is actually to be deployed on a simple tomcat. But, although im not using jboss specific libs/configurations i get NoClassDefFound Exceptions over and over and have to add libs manually, although I'm have the needed spring libs included in my project (MyEclipse Spring Libraries)

    I had to add jta.jar manually, as i had to cglib-2.1_3.jar - right now I'm trying to find out in which jar "org/objectweb/asm/Type" could be found.

    To abstract this a little - why the hell do i have to import third party libraries if i only use springs "core" features (it's not really the spring core only, of course)

    here is my config xmls to see (as i think, this one raises the problems - transaction manager a.s.o.):
    Code:
    <?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="DataSource" class="org.apache.commons.dbcp.BasicDataSource">
    		<property name="driverClassName">
    			<value>com.mysql.jdbc.Driver</value>
    		</property>
    		<property name="url">
    			<value>jdbc:mysql://localhost:3306/bitupdater</value>
    		</property>
    		<property name="username">
    			<value>root</value>
    		</property>
    		<property name="password">
    			<value>Seedless</value>
    		</property>
    	</bean>
    
    	<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    		<property name="dataSource">
    			<ref bean="DataSource" />
    		</property>
    		<property name="configLocation">
    			<value>WEB-INF/hibernate.cfg.xml</value>
    		</property>
    	</bean>
    	
    	<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
    		<property name="sessionFactory">
    			<ref bean="sessionFactory"/>
    		</property>
    	</bean>
    	
    	<bean id="DAO" class="de.bitExpert.j2ee.bitUpdater.dao.impl.DAOImpl" abstract="true">
    		<property name="hibernateTemplate">
    			<ref bean="hibernateTemplate" />
    		</property>
    	</bean>
    	
    	<bean id="SystemFamilyDAO" class="de.bitExpert.j2ee.bitUpdater.dao.impl.SystemFamilyDAOImpl" parent="DAO">
    		<property name="BOClass">
    			<value type="java.lang.Class">de.bitExpert.j2ee.bitUpdater.business.SystemFamily</value>
    		</property>
    	</bean>
    	
    	<bean id="CustomerDAO" class="de.bitExpert.j2ee.bitUpdater.dao.impl.CustomerDAOImpl" parent="DAO" />
    	
    	<bean id="UserDAO" class="de.bitExpert.j2ee.bitUpdater.dao.impl.UserDAOImpl" parent="DAO" />
    	
    	<bean id="UpdateJobDAO" class="de.bitExpert.j2ee.bitUpdater.dao.impl.UpdateJobDAOImpl" parent="DAO" />
    	
    </beans>
    Regards,
    Ollie

  • #2
    JBoss and Tomcat have different classloaders, so the latter's CL probably does not load by default what the former's does. Best to just put all your needed JAR files in mywebapp/WEB-INF/lib directory instead of container-specific locations so your WAR will work everywhere.

    You can google the library path to find out who owns "org/objectweb/asm/Type". It appears to be a tool called ASM: http://asm.objectweb.org/, so, worst case, just download the JAR to find out its name.

    Glen

    Comment


    • #3
      To abstract this a little - why the hell do i have to import third party libraries if i only use springs "core" features (it's not really the spring core only, of course)
      Interesting abstraction. Spring is about IoC and integration (among other things) - by using the hibernate package, one has to have the hibernate libraries in place. Spring by default (the core that is, i.e. the IoC) uses only commons-logging and, if you want to use AOP - CGLIB for class proxying - otherwise JDK proxies will be used.
      A simple approach to your problem (which will also solve any incompatibilities with future ASM versions) is to use cglib_nodep which already includes the required asm classes.

      Comment

      Working...
      X