Done some pretty extensive research on this the last few days. Our
application doesn't work at all on our test and production servers, because
of the dreaded "invalid constant length" error.

We have the following setup:
- jre-6u16 for linux
- Suse Linux
- JBoss 5.0.1 with embedded tomcat
- Compiles using java 1.6, tried both 1.5 and 1.6 as target compatibility

I have verified that there is excactly ONE javassist.jar within my jboss
directory, and the version of that file is 3.9.0.GA.

I still get javassist crashes on several of my smaller components, like the
one below. I'm going crazy over this, especially because it indicates to
everyone else that our big investment in T5 may have been a really stupid
move.

Just reported this to let you know that this problem DOES occur when there
is only one javassist.jar, and it is causing major problems for us.

Example of crashing component:

@IncludeJavaScriptLibrary( { "context:/script/tiny_mce/tiny_mce.js" })
public class TinyMceEditor {

  public static final String MODE_EXACT = "exact";
  public static final String MODE_TEXTAREAS = "textareas";

  @Inject
  private UrlProvider urlProvider;

  @Environmental
  private RenderSupport renderSupport;

  @Parameter(defaultPrefix = BindingConstants.LITERAL, value =
MODE_TEXTAREAS)
  private String mode;

  /**
   * If mode=exact, attach editor to these elements
   */
  @Parameter
  private ClientElement[] elements;

  void initEditor(MarkupWriter writer) {

    // We can't use renderSupport to add script, tinyMCE refuses to accept
    // scripts added this way. It needs inline script. Script tag written
    // manually below.

    String jsonString = getJSON();
    writer.element("script", "type", "text/javascript");
    writer.writeRaw(String.format("tinyMCE.init(%s)", jsonString));
    writer.end();
  }

  /**
   * Make sure editor content is saved to form field before Tapestry AJAX
   * submits.
   */
  void patchZoneForms() {

renderSupport.addScript("document.forms[0].observe(Tapestry.FORM_PROCESS_SUBMIT_EVENT,
function() {tinyMCE.triggerSave()});");
  }

  /**
   * Get JSON config for tinyMCE object. Configured to view one simple
toolbar.
   *
   * @return
   */
  private String getJSON() {
    JSONObject json = new JSONObject();
    json.put("mode", mode);
    json.put("theme", "advanced");
    addElementList(json);
    json.put("theme_advanced_toolbar_location", "top");
    json.put("theme_advanced_toolbar_align", "left");
    json.put("theme_advanced_buttons1",
"bold,italic,underline,bullist,numlist,undo,redo,outdent,indent,fontsizeselect");
    json.put("theme_advanced_buttons2", "");
    json.put("theme_advanced_buttons3", "");
    json.put("content_css",
urlProvider.getContextAssetUrl("/css/tinymce.css"));
    return json.toString();
  }

  private void addElementList(JSONObject json) {
    if (MODE_EXACT.equals(mode)) {
      if (elements != null && elements.length > 0) {
        StringBuffer elementsString = new StringBuffer();
        for (int i = 0; i < elements.length; i++) {
          ClientElement currentElement = elements[i];
          FrontendTools.appendCommaSeparated(currentElement.getClientId(),
elementsString);
        }
        json.put("elements", elementsString);
      }
      else {
        throw new IllegalArgumentException("Exact mode specified, but no
elements");
      }
    }
  }

  void afterRender(MarkupWriter writer) {
    initEditor(writer);
    patchZoneForms();
  }

}


Regards
Inge


On Tue, Oct 27, 2009 at 9:57 AM, Fermin Da Costa Gomez <
dacostago...@dcgconsultancy.nl> wrote:

> For what it is worth .. i have not had *this* problem anymore since i
> straigthened out the use of the libs in the different projects being used.
> IF something like this happens again (hope not with my friday deadline .. )
> i'll post it as well.
>
>
> On Tue, Oct 27, 2009 at 8:37 AM, Inge Solvoll <inge.tapes...@gmail.com
> >wrote:
>
> > This problem has been gone for us for a while, today it came back when
> > deploying our app to a jboss server (5.0.1) with embedded tomcat. I
> > immediately started searching for javassist.jar duplicates. Found
> > javassist.jar in jboss/lib, jboss/client and <myapp>/WEB-INF/lib.
> >
> > Jboss wouldn't start up without the one in jboss/lib, so I removed all
> but
> > that one. Now it started, and my T5 app works, but the error in one
> > specific
> > component is still there: java.io.IOException: invalid constant type:
> 121.
> > It always happens with the same component. The component works in most
> > configurations, just not on our jboss server setup with embedded tomcat.
> >
> > I then replaced the javassist.jar in jboss/lib with a fresh 3.9.0, like
> > specified in this thread. Now Jboss won't start up, nothing happens in
> the
> > log when I try to start it
> >
> > We will continue working on this this week, as this is a major problem
> for
> > us. Hopefully, you're right about it being a javassist.jar duplicate
> issue.
> > But so far, I haven't found anything pointing in that direction.
> >
> > Inge
> >
> > On Wed, Oct 7, 2009 at 4:18 PM, Fermin Da Costa Gomez <
> > dacostago...@dcgconsultancy.nl> wrote:
> >
> > > This was actually it.
> > > A 'hidden' antiquated version of javassist somewhere on the classpath
> AND
> > > (as later turned out) a project that did not want to be placed on the
> > > classpath (via the classpath settings in the launcher of Eclipse
> > Galileo).
> > >
> > > Finally got the whole thing stopping on my breakpoint again ..
> > >
> > > I guess it all has to do with the infamous medal ansd its two sides.
> > Having
> > > all the libs available is a good thing but it might also be lurking
> > behind
> > > a
> > > tree with dubious intentions .. ;-)
> > >
> > > Thx to the list for getting me on my way again.
> > >
> > >
> > > On Wed, Oct 7, 2009 at 4:17 PM, Peter Stavrinides <
> > > p.stavrini...@albourne.com> wrote:
> > >
> > > >
> > > > Tapestry works perfectly with Java 6 now!!
> > > >
> > > > Lets not be ridiculous and claim that you need to shorten methods and
> > > > method names etc in order to get it working, it has been completely
> > > > compatible for some time now. This is a library issue, you must use
> > > > 3.9.0.GA, which is the version provided by Tapestry 5.1, beware of
> > > > Chenillekit it brings in an old version javassist 3.7, which in most
> > > causes
> > > > this problem.
> > > >
> > > > You must include this in your pom:
> > > >
> > > > <dependency>
> > > >    <groupId>org.chenillekit</groupId>
> > > >        <artifactId>chenillekit-tapestry</artifactId>
> > > >        <version>1.2.0</version>
> > > >        <exclusions>
> > > >                <exclusion>
> > > >                        <groupId>jboss</groupId>
> > > >                        <artifactId>javassist</artifactId>
> > > >                </exclusion>
> > > >        </exclusions>
> > > > </dependency>
> > > >
> > > >
> > > > Cheers,
> > > > Peter
> > > >
> > > > --
> > > > If you are not an intended recipient of this e-mail, please notify
> the
> > > > sender, delete it and do not read, act upon, print, disclose, copy,
> > > retain
> > > > or redistribute it. Please visit
> http://www.albourne.com/email.htmlfor
> > > > important additional terms relating to this e-mail.
> > > >
> > > > ----- Original Message -----
> > > > From: "Cameron Newham" <cameron.new...@bl.uk>
> > > > To: "Tapestry users" <users@tapestry.apache.org>
> > > > Sent: Wednesday, 7 October, 2009 11:40:27 GMT +02:00 Athens, Beirut,
> > > > Bucharest, Istanbul
> > > > Subject: RE: [t5] upgrade to java 6 and javassist
> > > >
> > > > When I had trouble with javassist a few months ago it was because
> there
> > > > were multiple versions on the classpath.
> > > >
> > > > I'm using Java 1.6 and have had no problems since sorting out what
> jars
> > > > were being included.
> > > >
> > > > I see I'm currently using 3.8.0.GA.
> > > >
> > > >
> > > > -----Original Message-----
> > > > From: Ville Virtanen [mailto:ville.virta...@cerion.fi]
> > > > Sent: 07 October 2009 05:11
> > > > To: users@tapestry.apache.org
> > > > Subject: Re: [t5] upgrade to java 6 and javassist
> > > >
> > > >
> > > > Hi,
> > > >
> > > > Also make 100% sure that there aren't multiple javassists (different
> > > > versions in classpath) AND that the included javassist version is the
> > > > right
> > > > one. Check this from the produced war, do NOT trust what the ide is
> > > > saying
> > > > ;)
> > > >
> > > > Sometimes we have had problems like this, but those were because
> maven
> > > > dependencies affected to the included javassist version.
> > > >
> > > > We use java 6, and our compile targets are 1.6 in about ten projects,
> > we
> > > > have multiple developers compiling with different versions of java
> and
> > > > haven't had any problems besides those javaassist version related.
> > > >
> > > > The version of javassist that gets included for us is 3.9.0.GA
> > > >
> > > >  - Ville
> > > >
> > > > Ps. Below is the mvn configuration we're using w/ netbeans
> > > >
> > > > <plugin>
> > > >        <groupId>org.apache.maven.plugins</groupId>
> > > >        <artifactId>maven-compiler-plugin</artifactId>
> > > >        <configuration>
> > > >                <source>1.6</source>
> > > >                <target>1.6</target>
> > > >                <optimize>true</optimize>
> > > >                <encoding>UTF-8</encoding>
> > > >                <showDeprecation>true</showDeprecation>
> > > >                <showWarnings>true</showWarnings>
> > > >        </configuration>
> > > > </plugin>
> > > >
> > > >
> > > > Thiago H. de Paula Figueiredo wrote:
> > > > >
> > > > > Em Tue, 06 Oct 2009 17:39:17 -0300, Fermin Da Costa Gomez
> > > > > <dacostago...@dcgconsultancy.nl> escreveu:
> > > > >
> > > > >> Using Eclipse, my Compiler compliance level is set at 1.5 already
> > and
> > > >
> > > > >> still. What OS are you using?
> > > > >
> > > > > Ubuntu. But I guess it's not operating-system related.
> > > > >
> > > > >> The @OnEvent i understand but i can't find a 'ready made' entry
> for
> > > > the
> > > > >> EventConstants.
> > > > >
> > > > > What do you mean by ready-made? EventConstants is just a class that
> > > > > declares String constants. You can use the event name directly if
> you
> > > > want
> > > > > or need.
> > > > >
> > > > >> Do i make my own enum for that?
> > > > >
> > > > > No, event names are Strings.
> > > > >
> > > > >> And if so, how does that
> > > > >> hook into the autocompleter mixin without additional coding?
> > > > >
> > > > > I'm not following you here. All events are hooked by name and,
> > > > optionally,
> > > > > component id, just that.
> > > > >
> > > > > --
> > > > > Thiago H. de Paula Figueiredo
> > > > > Independent Java consultant, developer, and instructor
> > > > > http://www.arsmachina.com.br/thiago
> > > > >
> > > > >
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> > > > > For additional commands, e-mail: users-h...@tapestry.apache.org
> > > > >
> > > > >
> > > > >
> > > >
> > > > --
> > > > View this message in context:
> > > >
> > http://www.nabble.com/-t5--upgrade-to-java-6-and-javassist-tp25295834p25
> > > > 780245.html<
> > >
> >
> http://www.nabble.com/-t5--upgrade-to-java-6-and-javassist-tp25295834p25%0A780245.html
> > > >
> > > > Sent from the Tapestry - User mailing list archive at Nabble.com.
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> > > > For additional commands, e-mail: users-h...@tapestry.apache.org
> > > >
> > > >
> > > >
> > >
> >
> **************************************************************************
> > > >
> > > > Experience the British Library online at http://www.bl.uk/
> > > >
> > > > The British Library’s new interactive Annual Report and Accounts
> > 2007/08
> > > :
> > > > http://www.bl.uk/knowledge
> > > >
> > > > Help the British Library conserve the world's knowledge. Adopt a
> Book.
> > > > http://www.bl.uk/adoptabook
> > > >
> > > > The Library's St Pancras site is WiFi - enabled
> > > >
> > > >
> > *************************************************************************
> > > >
> > > > The information contained in this e-mail is confidential and may be
> > > legally
> > > > privileged. It is intended for the addressee(s) only. If you are not
> > the
> > > > intended recipient, please delete this e-mail and notify the mailto:
> > > > postmas...@bl.uk : The contents of this e-mail must not be disclosed
> > or
> > > > copied without the sender's consent.
> > > >
> > > > The statements and opinions expressed in this message are those of
> the
> > > > author and do not necessarily reflect those of the British Library.
> The
> > > > British Library does not take any responsibility for the views of the
> > > > author.
> > > >
> > > >
> > *************************************************************************
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> > > > For additional commands, e-mail: users-h...@tapestry.apache.org
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> > > > For additional commands, e-mail: users-h...@tapestry.apache.org
> > > >
> > > >
> > >
> > >
> > > --
> > > “The reasonable man adapts himself to the world; the unreasonable one
> > > persists in trying to adapt the world to himself. Therefore all
> progress
> > > depends on the unreasonable man.”
> > > - George Bernard Shaw (1856 - 1950)
> > >
> >
>
>
>
> --
> “The reasonable man adapts himself to the world; the unreasonable one
> persists in trying to adapt the world to himself. Therefore all progress
> depends on the unreasonable man.”
> - George Bernard Shaw (1856 - 1950)
>

Reply via email to