[Beginners Corner] - Reflection issue with jars in ear/lib directory in 4.2.0CR2
by mexcell
Using 4.2.0CR2.
I am using TestNG from within a Stateless Session Bean. The TestNG jar for jdk1.5 is in the ear/lib directory, and I can import the main TestNG class just fine, so I know it is actually on the classpath. TestNG uses reflection internally to load and instantiate some TestRunners, etc. I get:
java.lang.NoSuchMethodException: org.testng.internal.annotations.JDK15AnnotationFinder.<init>(org.testng.internal.annotations.IAnnotationTransformer)
| java.lang.Class.getConstructor0(Class.java:2647)
| java.lang.Class.getConstructor(Class.java:1629)
| org.testng.internal.ClassHelper.createJdkAnnotationFinder(ClassHelper.java:175)
| org.testng.TestNG.initializeAnnotationFinders(TestNG.java:692)
| org.testng.TestNG.run(TestNG.java:701)
|
The relevant section of ClassHelper.java is:
| try {
| Class clazz= forName(JDK5_ANNOTATIONFINDER_CLASS);
| Constructor ctor= clazz.getConstructor(new Class[] {IAnnotationTransformer.class});//Exception here
| return (IAnnotationFinder) ctor.newInstance(new Object[] {annoTransformer});
| }
| catch(Exception ex) {
| throw new TestNGException("Cannot create/initialize the JDK5 annotation finder " + JDK5_ANNOTATIONFINDER_CLASS, ex);
| }
|
Please note that I added the comment showing which line throws the exception (line 175)
It works fine when called from the web context if the jar is in WEB-INF/lib, but that doesn't meet our needs.
According to http://jira.jboss.com/jira/browse/JBAS-4037 the lib directory within an ear should work as defined in the EE5 spec - Does that not include reflection? (Or is this a bug?)
Thanks in advance for any help you can supply.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4041998#4041998
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4041998
17 years, 5 months
[JBoss Seam] - Problem with FacesMessages
by nstoddar
I'm having a problem with FacesMessages. I have a pageflow where on a transition I execute a validation method that adds a message to the FacesMessages object. The "to" for the transition is a decision node that calls a method that is trying to determine if there are FacesMessages present and transition based on that logic ... (sorry -- wordy explanation).
My problem is that the FacesMessage object is returning an empty list for getCurrentMessages() and getCurrentGlobalMessages() -- I can set a breadpoint and see my message sitting there in its member variable list, but I always get an empty list from FacesMessages when I invoke either of those two methods.
When I add the message directly to the FacesContext, FacesMessages correctly returns me a non-empty list, but the messages aren't visible after the redirect to the next page in my pageflow.
Am I doing something incorrect here? I was expecting FacesMessages to show me the message I just added to it....
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4041990#4041990
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4041990
17 years, 5 months
[EJB 3.0] - New to EJB3 -- Please help
by chensquare
Hi all,
I'm new to EJB. I'm writing a toy EJB, and having problem running the client (bean can be deployed successfully in Eclipse) When running the client, it generates javax.naming.NameNotFoundException: HelloBean not bound.
Please help. THANKS A LOT!!!
my config:
IDE: Eclipse
JBOSS: 4.0.5
//INTERFACE:
package examples.session.stateless;
import javax.ejb.*;
public interface Hello {
public String hello() ; //throws java.rmi.RemoteException;
}
//BEAN CLASS
package examples.session.stateless;
import javax.ejb.Remote;
import javax.ejb.Stateless;
import javax.ejb.*;
@Stateless
@Remote(Hello.class)
public class HelloBean implements Hello {
public String hello () {
System.out.println("in hello()...");
return "Hello, World!";
}
}
EJB-JAR.XML
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar id="ejb-jar_ID" version="2.1" xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd">
JBoss Hello World Application
<display-name>HelloBean</display-name>
<enterprise-beans>
<ejb-name>HelloBean</ejb-name>
</enterprise-beans>
</ejb-jar>
CLIENT
package examples.session.stateless;
import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
public class HelloEJBClient {
public static void main( String [] args )
{
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
env.put(Context.PROVIDER_URL, "localhost:1099");
env.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
try
{
InitialContext ctx = new InitialContext(env);
Hello hello = (Hello) ctx.lookup( "HelloBean" );
System.out.println(hello.hello());
}
catch ( Exception e )
{
e.printStackTrace();
System.out.println( "Chen - Exception: " + e.getMessage() );
}
}
}
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4041983#4041983
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4041983
17 years, 5 months
[EJB 3.0] - Is it *safe* ?
by johnmm1997
Currently I'm evaluating the ejb3 embedded for a standalone system that only need ORM, messaging and transactions- the javee5 features looks really nice (compare to 1.4)
I'm running into lots of different problems.
I don't know if their "my" problems, or in the ejb3, and there are no clear documents on how to make it work, so it's hard for me to break in..
I guess, the "beta" status is a little bit scary for me-
If i need to release the system in a month or so, is it safe to relay on the ejb3 embedded?
I just read in the forum that ejb3 embedded is actually coupled with jboss5, does it mean that the ejb3 will only be in production state when jboss5 will?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4041981#4041981
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4041981
17 years, 5 months