5 Replies Latest reply on Oct 25, 2004 11:48 AM by rcbeuker

    JBoss EMB docs/examples

    andrzejros

      Hi!

      I'm intrested in use of EMB - my problem is to store/load images dynamicaly to/from given location, ie server directory - /tmp/graphics.

      so any dtd/xsd files describes media dd or any usage tips are available? in JBoss source package there are not so many informations - only example plugins, could someone point me to any other resource than jsr86 final release :P ?

      after compiling jboss source I've found this clues:
      1. put jboss-media-entity-ejb.jar in deploy/ dir
      2. create and put ie jboss-media.sar using resources/META-INF/jboss-service.xml example into deploy/
      3. watch logs for complete or failed deployment - didn't try yet but i suppose to place media.jar in sar file

      is this correct?

        • 1. EMB - done?
          andrzejros

          Hey all,
          Started looking into JSR-86/Enterprise Media Beans. Is this project still active, and if it is not, where is/was the source located in CVS to take a look?
          Thanks,
          -D

          • 2. Re: JBoss EMB docs/examples
            andrzejros

            ok, i've found IBM reference implementation and got some questions:
            media is added using:

             MediaEntityLocal imgSamp = mediaEntityHome.create();
             imgSamp.setName("image"+System.currentTimeMillis()); imgSamp.setContent(getServletContext().getResourceAsStream("/samples/image1.jpg"));
             imgSamp.setDescription("kocio");
             imgSamp.setMimeType("image/jpeg");
            


            in database record is filled in, image content exists but when:

             MediaEntityLocal media = mediaEntityHome.findByPrimaryKey(imgId);
             resp.setContentType(media.getMimeType());
             resp.setContentLength((int) media.getSize());
            
             byte[] buffer = new byte[0x10000];
             long position = 0;
             int bytesRead = 0;
             while ((bytesRead = media.readContent(position, buffer)) != -1)
             {
             log("bytes read: " + bytesRead);
             resp.getOutputStream().write(buffer, 0, bytesRead);
             position += bytesRead;
             }
            


            copied from emb spec, serwer throws this:
            javax.ejb.EJBException: RuntimeException; CausedByException is:
            null
            org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:357)
            org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:195)
            org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
            org.jboss.ejb.EntityContainer.internalInvoke(EntityContainer.java:514)
            org.jboss.ejb.Container.invoke(Container.java:854)
            org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:413)
            org.jboss.ejb.plugins.local.EntityProxy.invoke(EntityProxy.java:44)
            $Proxy102.readContent(Unknown Source)
            net.homeunix.andrzejr.web.MediaLoadServlet.doGet(MediaLoadServlet.java:85)
            javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
            javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
            org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75)

            no content? my database is postgresql 7.4.3 (i've changed DefaultDS to other)

            root cause:
            java.lang.ArrayIndexOutOfBoundsException
            at java.lang.System.arraycopy(Native Method)
            at org.jboss.media.entity.MediaEntity.readContent(MediaEntity.java:542)
            at org.jboss.media.entity.MediaEntity.readContent(MediaEntity.java:526)
            at sun.reflect.GeneratedMethodAccessor111.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:324)

            any ideas?

            • 3. Re: JBoss EMB docs/examples
              andrzejros

              changing db back to hypersonic also causes problem

              • 4. Re: JBoss EMB docs/examples
                dhartford

                Hi andrzejros,
                I'm glad you are tackling your problem with EMB! Unfortunately, I have only been working on some other parts (sporadically and rarely) with EMB and do not have anything in production yet.

                Your code does look correct. Only thing might be related to the 'arrayindexoutofbounds' problem could be either the bytearray (if the image is small, maybe set the bytearray size smaller), or there really is a problem in the EMB implementation.

                Haven't seen anyone respond back to you, so at least letting you know one person is watching, so don't get discouraged! :-)

                -D

                • 5. Re: JBoss EMB docs/examples
                  rcbeuker

                  I want to use/extend the Media Module to stream Mpeg-4 video to Java clients. Do you know which steps I have to take? How do I get a project (source, paths, libraries etc.)? Are you working on this project at this moment?

                  Greetings,

                  Roland Beuker