facebook

Problem starting Application deployed to JBoss 5.1 GA

  1. MyEclipse IDE
  2.  > 
  3. Spring Development
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #306843 Reply

    Jamie Daniel
    Member

    I have deployed an application with the following:

    Scaffolding for Security
    Scaffolding for CRUD

    I deployed this to JBoss 5.1 GA and the deployments fail:
    Here is the error:

    09:59:29,958 INFO  [PersistenceUnitDeployment] Starting persistence unit persistence.unit:unitName=#ORACLE11SRV
    09:59:29,989 ERROR [AbstractKernelController] Error installing to Start: name=persistence.unit:unitName=#ORACLE11SRV state=Create
    java.lang.RuntimeException: Specification violation [EJB3 JPA 6.2.1.2] - You have not defined a jta-data-source for a JTA enabled persistence context named: ORACLE11SRV
        at org.jboss.jpa.deployment.PersistenceUnitInfoImpl.<init>(PersistenceUnitInfoImpl.java:115)
        ...
    09:59:30,052 INFO  [TomcatDeployment] deploy, ctxPath=/ProjectOne
    09:59:30,942 ERROR [JBossContextConfig] XML error parsing: context.xml
    org.jboss.xb.binding.JBossXBRuntimeException: Failed to create a new SAX parser
        ...
    Caused by: org.jboss.xb.binding.JBossXBException: Failed to create a new SAX parser
        at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.<init>(SaxJBossXBParser.java:97)
        at org.jboss.xb.binding.UnmarshallerImpl.<init>(UnmarshallerImpl.java:56)
        at org.jboss.xb.binding.UnmarshallerFactory$UnmarshallerFactoryImpl.newUnmarshaller(UnmarshallerFactory.java:96)
        ... 73 more
    Caused by: java.lang.ClassCastException: org.apache.xerces.parsers.XIncludeAwareParserConfiguration cannot be cast to org.apache.xerces.xni.parser.XMLParserConfiguration
        at org.apache.xerces.parsers.SAXParser.<init>(Unknown Source)
        at org.apache.xerces.parsers.SAXParser.<init>(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.<init>(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl.<init>(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserFactoryImpl.newSAXParser(Unknown Source)
        at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.<init>(SaxJBossXBParser.java:92)
        ... 75 more
    09:59:30,942 ERROR [JBossContextConfig] XML error parsing: jboss.web/localhost/context.xml.default
    org.jboss.xb.binding.JBossXBRuntimeException: Failed to create a new SAX parser
        ...
    Caused by: org.jboss.xb.binding.JBossXBException: Failed to create a new SAX parser
        at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.<init>(SaxJBossXBParser.java:97)
        at org.jboss.xb.binding.UnmarshallerImpl.<init>(UnmarshallerImpl.java:56)
        at org.jboss.xb.binding.UnmarshallerFactory$UnmarshallerFactoryImpl.newUnmarshaller(UnmarshallerFactory.java:96)
        ... 73 more
    Caused by: java.lang.ClassCastException: org.apache.xerces.parsers.XIncludeAwareParserConfiguration cannot be cast to org.apache.xerces.xni.parser.XMLParserConfiguration
        at org.apache.xerces.parsers.SAXParser.<init>(Unknown Source)
        at org.apache.xerces.parsers.SAXParser.<init>(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.<init>(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl.<init>(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserFactoryImpl.newSAXParser(Unknown Source)
        at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.<init>(SaxJBossXBParser.java:92)
        ... 75 more
    09:59:30,958 ERROR [JBossContextConfig] XML error parsing: WEB-INF/context.xml
    org.jboss.xb.binding.JBossXBRuntimeException: Failed to create a new SAX parser
        ...
    Caused by: org.jboss.xb.binding.JBossXBException: Failed to create a new SAX parser
        at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.<init>(SaxJBossXBParser.java:97)
        at org.jboss.xb.binding.UnmarshallerImpl.<init>(UnmarshallerImpl.java:56)
        at org.jboss.xb.binding.UnmarshallerFactory$UnmarshallerFactoryImpl.newUnmarshaller(UnmarshallerFactory.java:96)
        ... 73 more
    Caused by: java.lang.ClassCastException: org.apache.xerces.parsers.XIncludeAwareParserConfiguration cannot be cast to org.apache.xerces.xni.parser.XMLParserConfiguration
        at org.apache.xerces.parsers.SAXParser.<init>(Unknown Source)
        at org.apache.xerces.parsers.SAXParser.<init>(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.<init>(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl.<init>(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserFactoryImpl.newSAXParser(Unknown Source)
        at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.<init>(SaxJBossXBParser.java:92)
        ... 75 more
    09:59:31,192 ERROR [ContextConfig] Marking this application unavailable due to previous error(s)
    09:59:31,224 ERROR [StandardContext] Context [/ProjectOne] startup failed due to previous errors
    09:59:31,239 ERROR [AbstractKernelController] Error installing to Start: name=jboss.web.deployment:war=/ProjectOne state=Create mode=Manual requiredState=Installed
    org.jboss.deployers.spi.DeploymentException: URL file:/C:/jboss-5.1.0.GA/server/default/deploy/ProjectOne.war/ deployment failed
        ..
    09:59:31,255 ERROR [AbstractKernelController] Error installing to Real: name=vfsfile:/C:/jboss-5.1.0.GA/server/default/deploy/ProjectOne.war/ state=PreReal mode=Manual requiredState=Real
    org.jboss.deployers.spi.DeploymentException: URL file:/C:/jboss-5.1.0.GA/server/default/deploy/ProjectOne.war/ deployment failed
        ...
    09:59:31,302 INFO  [TomcatDeployment] deploy, ctxPath=/
    09:59:31,411 INFO  [TomcatDeployment] deploy, ctxPath=/jmx-console
    09:59:31,521 ERROR [ProfileServiceBootstrap] Failed to load profile: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):
    
    #306892 Reply

    davemeurer
    Member

    Hi Jamie,

    The great thing about Spring is it is very portable. With that said, in our experience we have found some items to consider within a MyEclipse for Spring CRUD Scaffolded project to get it working properly on JBoss 5.1

    Overall, what we found to work best is to use the Spring JndiObjectFactoryBean for the persistent manager, and the JtaTransactionManager for transaction manager instead of the default Hibernate and Atomikos. There are also a couple other configurations in the config files and in the JBoss server needed, detailed here. Be sure to turn off generation for these following artifacts to save your manual changes. This example uses the MyEclipse Derby Integrated Sandbox DB.

    [WebProject]\resources\META-INF\persistence.xml

    <persistence-unit name="MyEclipse_Derby" transaction-type="JTA" >
        <jta-data-source>java:/MyEclipse_DerbyDS</jta-data-source>
        <class>com.crud.domain.MyDomainObject</class>
        <exclude-unlisted-classes>true</exclude-unlisted-classes>
        <properties>
            <property name="jboss.entity.manager.factory.jndi.name" value="persistence/MyEclipse_Derby" />
        </properties>
    </persistence-unit>

    [WebProject]\resources\[WebProject]-generated-dao-context.xml (after the PropertyConfigurer)

    
            <!-- Using JBoss Transaction Manager -->
    
        <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
            <property name="transactionManagerName" value="java:/TransactionManager" />
        </bean>
            
         <!-- ******************************************************************** -->
        <!-- Setup each data source -->
        <!-- ******************************************************************** -->
        <!-- Using JBoss Data Sources -->
    
            <bean name="MyEclipse_DerbyDS" class="org.springframework.jndi.JndiObjectFactoryBean">
                <property name="jndiName" value="java:/MyEclipse_DerbyDS" />
                <property name="lookupOnStartup" value="false" />
                <property name="proxyInterface" value="javax.sql.DataSource" />
            </bean>
        
        <!-- ******************************************************************** -->
        <!-- Setup each persistence unit -->
        <!-- ******************************************************************** -->
        <!-- Using JBoss Persistence Units -->
    
            <bean id="MyEclipse_Derby" class="org.springframework.jndi.JndiObjectFactoryBean">
                <property name="jndiName" value="persistence/MyEclipse_Derby" />
                <property name="lookupOnStartup" value="false" />
                <property name="proxyInterface" value="javax.persistence.EntityManagerFactory" />
            </bean>
    

    [WebProject]\resources\[WebProject]-generated-web-context.xml
    These changes are recommended because there is a defect in JBoss that prevents Spring component scanning: http://jira.springframework.org/browse/SPR-5120 (fixed in Spring 3.0)

    
        <!-- ******************************************************************** -->
        <!-- Scan for all annotated beans -->
        <!-- ******************************************************************** -->
        <!-- Controllers -->
        <bean id="MyController" class="com.crud.web.MyController" scope="singleton" ></bean>
        
        <!-- DAOs -->
        <bean id="MyDAO" class="com.crud.dao.MyDAOImpl" scope="singleton" ></bean>
                
        <!-- Services -->
        <bean id="MyService" class="com.crud.service.MyServiceImpl" scope="session" >
            <aop:scoped-proxy />
        </bean>
                
        <context:annotation-config />
        <tx:annotation-driven transaction-manager="transactionManager" />
    

    Add the following resources:
    \resources\container\jboss-app.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <jboss-app>
        <module>
            <service>data-sources-ds.xml</service>
        </module>
    </jboss-app>

    \resources\container\datasources\data-sources-ds.xml

    <?xml version="1.0" encoding="UTF-8" ?> 
    <datasources>
        <attribute name="SecurityDomainJndiName">[WebProject]SQLDbRealm</attribute>
        
                    <local-tx-datasource>
                        <jndi-name>MyEclipse_DerbyDS</jndi-name>
                        <connection-url>[jdbc connection url]</connection-url>
                        <driver-class>[driver class]</driver-class>
                        <user-name>[db user]</user-name>
                        <password>[db password]</password>
                        <min-pool-size>1</min-pool-size>
                        <max-pool-size>10</max-pool-size>
                    </local-tx-datasource>
                    
            <mbean code="org.jboss.naming.NamingAlias" name="[WebProject]SQLDbRealm:service=NamingAlias,fromName=MyEclipse_DerbyDS">
                <attribute name="ToName">java:/MyEclipse_DerbyDS</attribute>
                <attribute name="FromName">MyEclipse_DerbyDS</attribute>
            </mbean>
    </datasources>

    Once these changes are done, follow these guidelines:
    1. Remove the following classpath entries in the Java Build Path
    – Hibernate[/list]
    – Atomikos[/list]
    – CXF (do not remove this library if you are using Web Services)[/list]
    – (the database driver that you are using if the entry exists)[/list]
    2. Copy data-sources-ds.xml into the <JBoss home>/server/default/deploy directory[/list]
    3. Put the database driver into the <JBoss home>/server/default/lib directory[/list]

    Let us know if this helps.
    Kind regards,
    Dave

    #316202 Reply

    Smitht19
    Member

    I am having this same problem using oracle. While the example is good. I could use more detail like how to turn off generation for the artifactsso I can save the manual changes

    #316234 Reply

    jkennedy
    Member

    Hello,
    I’m sorry, which problem are you having with Oracle? An issue deploying to JBoss?

    Regarding the ability to turn off the generation, are you using the DSL or just running the scaffolding wizard?

    You can run the scaffolding wizard without turning on the DSL which will generate out the Crud scaffolding. This code will not be regenerated unless you rerun the scaffolding wizard. When you rerun the scaffolding wizard, you can choose which layers to regenerate.

    Generally, our scaffolding generation will not remove methods that you add etc.

    Let me know if this answers your question.

    Thanks,
    Jack

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: Problem starting Application deployed to JBoss 5.1 GA

You must be logged in to post in the forum log in