8 Replies Latest reply on Mar 18, 2011 3:16 AM by wdfink

    Backups and migrations

    fortxun

      Hi,

      I have absolutely no experience of JBoss, I would like to know if it has any built in functionality for exporting a java webapp with database configuration and everything with a view to import later into another server. Along the lines of backup but to make the migration from one hosting provider to another.

      Can anybody help on this, the app in question is some java webapp that uses hibernate to connect to an Oracle database - since the only element I have any understanding of is the Oracle database I figure the easiest way to migrate would lay in the application server level.

      Cheers,

      Ewen

        • 1. Re: Backups and migrations
          peterj

          The type of web app and database config you are describing could be packaged in several ways, only some of which I will mention.

          You could have a WAR file for the app itself and a *-ds.xml file for the data source. Moving the app to another JBOss AS instance involves simply copying the WAR and *-ds.xml files.

          You could package the WAR and *-ds.xml within an EAR file. Then there is only one file to copy. This also works well of you have EJBs.

          • 2. Backups and migrations
            charly.hurtado

            Hi.. actually we have a projects run on jboss 4.0.5 GA, we want to migrate to jboss 6, we tried to do it, but we got some errors for example

            "org.postgresql.util.PSQLException: Bad value for type int:".

             

            we are using ejb3-pojos..

             

            some body can help us ??

            • 3. Backups and migrations
              wdfink

              Do you change the database type?

              If not I suppose that this will be an issue with your EJB3 (JPA) POJO's.

              I might that the container work different and you must declare (annotate) the entity attribute to store it.

               

              Please provide a bit more information about the error, the entity and the related DB table.

              • 4. Backups and migrations
                charly.hurtado

                we did not make change about database type..

                 

                 

                i detect the problem is on field tipe @Lob.

                 

                 

                our EJB3 Version running actually is  "EJB 3.0 Preview RC9 Patch 1- FD."

                 

                my annotation on Bean

                @Stateless

                @LocalBinding(jndiBinding="x/BlogPostedBean")

                public class BlogPostedBean implements BlogPostedLocal

                 

                 

                 

                example tables-entities  with this error...

                 

                 

                 

                 

                blog_posts

                 

                 

                       Column        |            Type             |                  Modifiers                 

                ---------------------+-----------------------------+---------------------------------------------

                post_abstract       | text                        | not null

                 

                 

                 

                 

                Field 

                 

                 

                @Lob @Column(name = "post_abstract", nullable = false)

                   private String postAbstract;

                   public String getPostAbstract() {

                       return postAbstract;

                   }

                 

                 

                 

                 

                 

                 

                logs about error :

                 

                 

                 

                 

                16:14:25,840 WARN  [JDBCExceptionReporter] SQL Error: 0, SQLState: 22003

                16:14:25,840 ERROR [JDBCExceptionReporter] Bad value for type int : Best known for her series of 54 oil paintings re-creating the images and symbols of the classic Mexican Loteria from a US Latino perspective, Cristina Noriega is also an accomplished portrait painter. Her portraits have a vividness, depth and intensity that makes them exceptional. She is a veteran of more than a dozen group shows, a one-woman show at Ortiz Contemporary Gallery and recently joined her father Lionel and John Dyer for the Witte Museum exhibition of ?Vaqueros, the Original American Cowboy,?. She spends her time between San Antonio, Marfa and Alpine, Texas.

                16:14:25,842 INFO  [DefaultLoadEventListener] Error performing load command: org.hibernate.exception.DataException: could not load an entity: [RoleEJB#96]

                        at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:102) [:3.6.0.Final]

                        at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) [:3.6.0.Final]

                        at org.hibernate.loader.Loader.loadEntity(Loader.java:2041) [:3.6.0.Final]

                        at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:86) [:3.6.0.Final]

                        at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:76) [:3.6.0.Final]

                        at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3268) [:3.6.0.Final]

                        at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:496) [:3.6.0.Final]

                        at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:477) [:3.6.0.Final]

                        at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:227) [:3.6.0.Final]

                        at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:285) [:3.6.0.Final]

                        at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:152) [:3.6.0.Final]

                        at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:1090) [:3.6.0.Final]

                        at org.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1038) [:3.6.0.Final]

                        at org.hibernate.type.EntityType.resolveIdentifier(EntityType.java:630) [:3.6.0.Final]

                        at org.hibernate.type.EntityType.resolve(EntityType.java:438) [:3.6.0.Final]

                        at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:139) [:3.6.0.Final]

                        at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:982) [:3.6.0.Final]

                        at org.hibernate.loader.Loader.doQuery(Loader.java:857) [:3.6.0.Final]

                        at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274) [:3.6.0.Final]

                        at org.hibernate.loader.Loader.doList(Loader.java:2533) [:3.6.0.Final]

                        at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2276) [:3.6.0.Final]

                        at org.hibernate.loader.Loader.list(Loader.java:2271) [:3.6.0.Final]

                        at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:452) [:3.6.0.Final]

                        at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:363) [:3.6.0.Final]

                        at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196) [:3.6.0.Final]

                        at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1268) [:3.6.0.Final]

                        at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102) [:3.6.0.Final]

                        at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:246) [:3.6.0.Final]

                        at org.matt.site.ejb.stateless.blog.BlogPostedBean.getUserOnBlogPost(Unknown Source) [:]

                        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_23]

                        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_23]

                        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_23]

                        at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_23]

                        at org.jboss.aop.joinpoint.MethodInvocation.invokeTarget(MethodInvocation.java:122) [jboss-aop.jar:2.2.1.GA]

                        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:111) [jboss-aop.jar:2.2.1.GA]

                        at org.jboss.ejb3.interceptors.container.ContainerMethodInvocationWrapper.invokeNext(ContainerMethodInvocationWrapper.java:72) [:1.1.3]

                        at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.invoke(InterceptorSequencer.java:76) [:1.1.3]

                        at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.aroundInvoke(InterceptorSequencer.java:62) [:1.1.3]

                        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_23]

                        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_23]

                        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_23]

                        at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_23]

                        at org.jboss.aop.advice.PerJoinpointAdvice.invoke(PerJoinpointAdvice.java:174) [jboss-aop.jar:2.2.1.GA]

                        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]

                        at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.fillMethod(InvocationContextInterceptor.java:74) [:1.1.3]

                        at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_fillMethod_2078818709.invoke(InvocationContextInterceptor_z_fillMethod_2078818709.java) [:]

                        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]

                        at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.setup(InvocationContextInterceptor.java:90) [:1.1.3]

                        at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_setup_2078818709.invoke(InvocationContextInterceptor_z_setup_2078818709.java) [:]

                        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]

                        at org.jboss.ejb3.async.impl.interceptor.AsynchronousServerInterceptor.invoke(AsynchronousServerInterceptor.java:128) [:1.7.17]

                        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]

                        at org.jboss.ejb3.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:62) [:1.7.17]

                        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]

                        at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:56) [:1.7.17]

                        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]

                        at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47) [:1.7.17]

                        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]

                        at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42) [:1.0.3]

                        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]

                        at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:68) [:1.7.17]

                        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]

                        at org.jboss.ejb3.core.context.SessionInvocationContextAdapter.proceed(SessionInvocationContextAdapter.java:95) [:1.7.17]

                        at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:247) [:0.0.1]

                        at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.required(CMTTxInterceptor.java:349) [:0.0.1]

                        at org.jboss.ejb3.tx2.impl.CMTTxInterceptor.invoke(CMTTxInterceptor.java:209) [:0.0.1]

                        at org.jboss.ejb3.tx2.aop.CMTTxInterceptorWrapper.invoke(CMTTxInterceptorWrapper.java:52) [:0.0.1]

                        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]

                        at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76) [:1.0.0.GA]

                        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]

                        at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42) [:1.0.3]

                        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]

                        at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:182) [:1.7.17]

                        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]

                        at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41) [:1.7.17]

                        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]

                        at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67) [:1.7.17]

                        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]

                        at org.jboss.ejb3.core.context.CurrentInvocationContextInterceptor.invoke(CurrentInvocationContextInterceptor.java:47) [:1.7.17]

                        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]

                        at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67) [:1.0.1]

                        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]

                        at org.jboss.ejb3.interceptor.EJB3TCCLInterceptor.invoke(EJB3TCCLInterceptor.java:86) [:1.7.17]

                        at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) [jboss-aop.jar:2.2.1.GA]

                        at org.jboss.ejb3.session.SessionSpecContainer.invoke(SessionSpecContainer.java:323) [:1.7.17]

                        at org.jboss.ejb3.session.SessionSpecContainer.invoke(SessionSpecContainer.java:380) [:1.7.17]

                        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_23]

                        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_23]

                        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_23]

                        at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_23]

                • 5. Backups and migrations
                  wdfink

                  The EntityManager try to map your text to int,

                  do you set the persistence.xml correct?

                       <property name="hibernate.dialect" value="org.hibernate.dialect.<your dialect>"/>

                  also this might help to analyze:

                        <property name="hibernate.show_sql" value="true" />

                        <property name="hibernate.format_sql" value="true" />

                   

                  Also you should set the 'org.hibernate' to logging level 'TRACE' to find out what happen.

                   

                  I suppose that the handling of @Lob will be different, does it work if you remove @Lob?

                  • 6. Re: Backups and migrations
                    charly.hurtado

                    with show_sql on

                     

                    2011-03-17 12:55:13,348 INFO  [STDOUT] (Thread-25) Hibernate:

                    2011-03-17 12:55:13,348 INFO  [STDOUT] (Thread-25)     select

                    2011-03-17 12:55:13,348 INFO  [STDOUT] (Thread-25)         blogpostej0_.post_id as post1_181_,

                    2011-03-17 12:55:13,348 INFO  [STDOUT] (Thread-25)         blogpostej0_.cat_id as cat2_181_,

                    2011-03-17 12:55:13,348 INFO  [STDOUT] (Thread-25)         blogpostej0_.post_hasimage as post3_181_,

                    2011-03-17 12:55:13,348 INFO  [STDOUT] (Thread-25)         blogpostej0_.post_abstract as post4_181_,

                    2011-03-17 12:55:13,348 INFO  [STDOUT] (Thread-25)         blogpostej0_.post_body as post5_181_,

                    2011-03-17 12:55:13,348 INFO  [STDOUT] (Thread-25)         blogpostej0_.post_date as post6_181_,

                    2011-03-17 12:55:13,348 INFO  [STDOUT] (Thread-25)         blogpostej0_.post_language as post7_181_,

                    2011-03-17 12:55:13,348 INFO  [STDOUT] (Thread-25)         blogpostej0_.post_title as post8_181_,

                    2011-03-17 12:55:13,348 INFO  [STDOUT] (Thread-25)         blogpostej0_.post_total_comments as post9_181_,

                    2011-03-17 12:55:13,348 INFO  [STDOUT] (Thread-25)         blogpostej0_.post_url as post10_181_,

                    2011-03-17 12:55:13,349 INFO  [STDOUT] (Thread-25)         blogpostej0_.usr_id as usr11_181_

                    2011-03-17 12:55:13,349 INFO  [STDOUT] (Thread-25)     from

                    2011-03-17 12:55:13,349 INFO  [STDOUT] (Thread-25)         blog_posts blogpostej0_

                    2011-03-17 12:55:13,349 INFO  [STDOUT] (Thread-25)     where

                    2011-03-17 12:55:13,349 INFO  [STDOUT] (Thread-25)         blogpostej0_.cat_id<>?

                    2011-03-17 12:55:13,349 INFO  [STDOUT] (Thread-25)         and (

                    2011-03-17 12:55:13,349 INFO  [STDOUT] (Thread-25)             blogpostej0_.post_date between ? and ?

                    2011-03-17 12:55:13,349 INFO  [STDOUT] (Thread-25)         )

                    2011-03-17 12:55:13,349 INFO  [STDOUT] (Thread-25)     order by

                    2011-03-17 12:55:13,349 INFO  [STDOUT] (Thread-25)         blogpostej0_.post_id DESC

                    2011-03-17 12:55:13,358 DEBUG [org.hibernate.jdbc.AbstractBatcher] (Thread-25) about to open ResultSet (open ResultSets: 0, globally: 0)

                    2011-03-17 12:55:13,358 DEBUG [org.hibernate.loader.Loader] (Thread-25) result row: EntityKey[BlogPostEJB#2886]

                    2011-03-17 12:55:13,359 DEBUG [org.hibernate.jdbc.AbstractBatcher] (Thread-25) about to close ResultSet (open ResultSets: 1, globally: 1)

                    2011-03-17 12:55:13,359 DEBUG [org.hibernate.jdbc.AbstractBatcher] (Thread-25) about to close PreparedStatement (open PreparedStatements: 1, globally: 1)

                    2011-03-17 12:55:13,359 DEBUG [org.hibernate.jdbc.ConnectionManager] (Thread-25) aggressively releasing JDBC connection

                    2011-03-17 12:55:13,359 DEBUG [org.hibernate.jdbc.ConnectionManager] (Thread-25) releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]

                     

                     

                    2011-03-17 12:55:13,359 DEBUG [org.hibernate.util.JDBCExceptionReporter] (Thread-25) could not execute query [select blogpostej0_.post_id as post1_181_, blogpostej0_.cat_id as cat2_181_, blogpostej0_.post_hasimage as post3_181_, blogpostej0_.post_abstract as post4_181_, blogpostej0_.post_body as post5_181_, blogpostej0_.post_date as post6_181_, blogpostej0_.post_language as post7_181_, blogpostej0_.post_title as post8_181_, blogpostej0_.post_total_comments as post9_181_, blogpostej0_.post_url as post10_181_, blogpostej0_.usr_id as usr11_181_ from blog_posts blogpostej0_ where blogpostej0_.cat_id<>? and (blogpostej0_.post_date between ? and ?) order by blogpostej0_.post_id DESC]: org.postgresql.util.PSQLException: Bad value for type int :

                    • 7. Re: Backups and migrations
                      charly.hurtado

                      the problem was @Lob.. i remove from entities and everything works..!!!

                      • 8. Backups and migrations
                        wdfink

                        That reinforce my assumption that the @Lob annotation will be handle different in the newer version of hibernate.

                        I suppose there is no drawback to use it like this, but test it for your app maybe the lenght will be a problem (but I don't think so)