[Javassist user questions] - Inconsistent stack height 0 != 1
by bblfish
I am getting a weird exception when I add code to the toString method of the following class.
This is code I am working on https://sommer.dev.java.net project.
My javassist byte code rewritten classes otherwise work well (though I am only now starting to test them in more serious ways).
package net.java.dev.sommer.doap.ont;
|
| import java.io.File;
| import java.net.URL;
| import java.util.Collection;
| import net.java.rdf.annotations.rdf;
| import net.java.dev.sommer.doap.CheckoutHandler;
| import static net.java.dev.sommer.doap.ont.DoapProject.doap;
|
| /**
| *
| * @author hjs
| */
| @rdf(doap+"Repository")
| public class Repository {
|
| @rdf(doap+"location") private URL location;
| @rdf(doap+"browse") private Collection<URL> browse;
| @rdf(doap+"anon-root") private String anonRoot;
| @rdf(doap+"name") private String name;
|
| public CheckoutHandler checkout(File destination) {
| throw new UnsupportedOperationException("Not yet implemented");
| }
|
| public String getType() {
| return "unknown";
| }
|
| public URL getLocation() {
| return location;
| }
|
| public Collection<URL> getBrowse() {
| return browse;
| }
|
| public String getAnonRoot() {
| return anonRoot;
| }
|
| @Override
| public String toString() {
| if (name != null) return getType()+" type "+name;
| // if (location != null) return getType()+" type at "+location.getPath();
| return getType()+" type with no name";
| }
|
|
| }
The stack trace is the following
java.lang.VerifyError: (class: net/java/dev/sommer/doap/ont/Repository, method: toString signature: ()Ljava/lang/String;) Inconsistent stack height 0 != 1
| at java.lang.Class.getDeclaredConstructors0(Native Method)
| at java.lang.Class.privateGetDeclaredConstructors(Class.java:2328)
| at java.lang.Class.getConstructor0(Class.java:2640)
| at java.lang.Class.getConstructor(Class.java:1629)
| at net.java.rdf.sommer.SesameMapper.map(SesameMapper.java:989)
| at net.java.rdf.sommer.SesameMapper.getCollection(SesameMapper.java:1220)
| at net.java.rdf.sommer.util.RDFCollection.getCurrentCollection(RDFCollection.java:113)
| at net.java.rdf.sommer.util.RDFCollection.isEmpty(RDFCollection.java:121)
| at net.java.dev.sommer.doap.DoapDisplayForm.htmlForProject(DoapDisplayForm.java:222)
| at net.java.dev.sommer.doap.DoapDisplayForm.<init>(DoapDisplayForm.java:48)
| at net.java.dev.sommer.doap.DoapFetcher.useTheDoapFile(DoapFetcher.java:226)
| at net.java.dev.sommer.doap.DoapFetcher.run(DoapFetcher.java:214)
| at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
| at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
| [catch] at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269)
| at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
| at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)
| at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)
| at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
|
perhaps I can send the byte code too. I am not sure where I should look to resolve the problem. If I remove the
code from the toString() everything works fine.
I can dissasemble the byte code with jad, and javap seems to have to trouble with it either.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4089034#4089034
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4089034
18 years, 6 months
[JBoss Seam] - Re: Please decouple seam-gen from JBoss
by dan.j.allen
Given that we agree on the general principle, and I have had my chance to voice my rant, let's dig further into the underlying issue.
Is putting the JBoss Embedded runtime in Tomcat's classpath an unreasonable request? (this is a real question, not hypothetical)
In Seam 1.2.1, it was possible to use the embeddable EJB3 per application (it went in the WAR file). In Seam 2.0, a move was made to the JBoss Embedded runtime. In doing so, the Seam developers drew that conclusion that starting an JBoss Embedded runtime will work if a single WAR file is deployed, but would cause a problem if multiple WAR files tried to use it. It might be possible to get the JBoss Embedded runtime working from within the WAR again, but the limitation of multiple WAR files would remain (without additional work).
Let's answer the first question and then figure out where to go next. We should also give instructions for how to use Jetty if we are going to put forth more information/fixes for Tomcat. However, if the answer to the question above is "no", then we should move on to doing the same with Jetty.
By the way, a move from Tomcat to JBoss is pretty easy. At my business, we develop on Tomcat/Jetty and then go to production in JBoss (we aren't deploying any Seam apps yet).
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4089033#4089033
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4089033
18 years, 6 months
[JBoss Seam] - Re: Duplicate Factory method error from CVS head
by supernovasoftware.com
I didn't clean up the code much, but I will explain. If you need me to clean it up, I can as I appreciate greatly all the help that I have been giving on this forum.
First I list the generated class that I created with a custom code generation script.
Next I listed the extended version with higher precedence. In this case I need to add a simple filter to the entity list. So I overrode
| @Factory("contactList")
| public List<Contact> getEntityList()
|
Now Seam sees 2 factories for "contactList", but the original should not be deployed as a Seam component as it has lower precedence.
Generated Manager Class
| @Stateful
| @Name("contactManager")
| @Scope(ScopeType.CONVERSATION)
| public class ContactManagerBean extends CrudEjb3DAOBean<Contact, Long> implements Serializable, ContactManager
| {
| public ContactManagerBean() { super(Contact.class); }
|
| @In(create=true)
| private ContactDAO contactDAO;
|
| @DataModel(value="contactList")
| protected List<Contact> contactList;
|
| @Out(required = false)
| @DataModelSelection(value="contactList")
| private Contact contactEdit;
|
| @SuppressWarnings("unchecked")
| @Factory("contactList")
| public List<Contact> getEntityList()
| {
| log.info("@Factory(contactList)");
| return contactList = processList(contactDAO.getAll());
| }
|
| /* All Contact */
| @Out(required=false, scope=ScopeType.APPLICATION)
| private List<Contact> listContact;
|
| @Factory("listContact")
| public List<Contact> loadAll()
| {
| log.info("loadContact()");
| return listContact = contactDAO.getAll();
| }
|
| /* Active Contact */
| @Out(required=false, scope=ScopeType.APPLICATION)
| private List<Contact> listContactActive;
|
| @Factory("listContactActive")
| public List<Contact> loadActive()
| {
| log.info("loadContactActive()");
| return listContactActive = contactDAO.getActive();
| }
|
| public void clearList() { contactList = null; }
| public Contact getEntityEdit() { return this.contactEdit; }
| public void setEntityEdit(Contact entity) { contactEdit = entity; }
|
| @Destroy @Remove
| public void destroy() { }
|
| @Override
| public GenericDAO<Contact, Long> getGenericDAO() { return contactDAO; }
| }
|
Extended and set with higher presedence
| @Stateful
| @Name("contactManager")
| @Install(precedence=100)
| public class ContactManagerExtendsBean extends ContactManagerBean implements ContactSearch
| {
| @SuppressWarnings("unchecked")
| @Factory("contactList")
| public List<Contact> getEntityList()
| {
| log.info("@Factory(contactList)");
| if(strCompanyFilter==null)
| {
| return contactList = processList(((ContactDAO) getGenericDAO()).getAll());
| }
| else
| {
| return contactList = processList(((ContactDAO) getGenericDAO()).getFilterdContacts(strCompanyFilter));
| }
| }
|
| @In(required = false, create = true)
| @Out(scope = ScopeType.UNSPECIFIED, required = false)
| private String strCompanyFilter = "%";
| public String getStrCompanyFilter() { return strCompanyFilter; }
| public void setStrCompanyFilter(String strCompanyFilter) { this.strCompanyFilter = strCompanyFilter; }
|
| public void filter()
| {
| contactList = ((ContactDAO) getGenericDAO()).getFilterdContacts(strCompanyFilter);
| contactList.add(new Contact());
| }
|
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4089029#4089029
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4089029
18 years, 6 months