[EJB3] - JBOSS 5.1 / EJB3 Plugin 1.0.19 - CNFE for EJB in quartz job
by Scott Everts
Scott Everts [http://community.jboss.org/people/smeverts] created the discussion
"JBOSS 5.1 / EJB3 Plugin 1.0.19 - CNFE for EJB in quartz job"
To view the discussion, visit: http://community.jboss.org/message/572863#572863
--------------------------------------------------------------
I am migrating an application from JBOSS 4.2.3 to JBOSS 5.1 and I am having a problem with our Quartz stateful jobs, we are getting ClassNotFoundException when it tries to inject one of our SLSB. Here's what the class looks like:
@MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName = "cronTrigger", propertyValue = "0 0/15 * * * ?"), @ActivationConfigProperty(propertyName = "jobGroup", propertyValue = "MONITOR"), @ActivationConfigProperty(propertyName = "jobName", propertyValue = "MONITOR-JOB"), @ActivationConfigProperty(propertyName = "triggerGroup", propertyValue = "CUTOFF.MONITOR"), @ActivationConfigProperty(propertyName = "triggerName", propertyValue = "CUTOFF-TRIGGER")})@ResourceAdapter("quartz-ra.rar")public class CutoffMonitor implements StatefulJob { private static final Logger log = Logger.getLogger(DepositCutoffMonitor.class); @PersistenceContext (unitName="ATMEntityPU") private EntityManager em; @EJB private SystemStatus systemStatus;
public void execute(JobExecutionContext context) throws JobExecutionException {
String jobName = context.getJobDetail().getName(); String groupName = context.getJobDetail().getGroup(); log.debug("Executing job: " + jobName + " executing at " + new Date() + " -- " + hashCode());
}
}
The Quartz stateful job and the EJB live in the same JAR which is then packaged into an EAR.
When the Quartz job fires we get the following set of exceptions:
13:45:00,102 ERROR [ErrorLogger] Job (CUTOFF.MONITOR.CUTOFF-JOB threw an exception.org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: javax.ejb.EJBTransactionRolledbackException: Unable to inject jndi dependency: env/com.jobs.CutoffMonitor/systemStatus into property com.jobs.CutoffMonitor.systemStatus: com.workflow.SystemStatus from BaseClassLoader@149fb29{VFSClassLoaderPolicy@8447c{name=vfszip:/C:/Development/jboss-5.1.0.GA/server/default/deploy/quartz-ra.rar/ domain=ClassLoaderDomain@1428ffa{name=DefaultDomain parentPolicy=BEFORE parent=org.jboss.bootstrap.NoAnnotationURLClassLoader@12a3722} roots=[MemoryContextHandler@13118985[path= context=vfsmemory://3j001-xdtt8r-ggwhcagq-1-ggwhcp7u-23 real=vfsmemory://3j001-xdtt8r-ggwhcagq-1-ggwhcp7u-23], DelegatingHandler(a)4613052[path=quartz-ra.rar context=file:/C:/Development/jboss-5.1.0.GA/server/default/deploy/ real=file:/C:/Development/jboss-5.1.0.GA/server/default/deploy/quartz-ra.rar], DelegatingHandler(a)20837847[path=quartz-ra.rar/quartz-ra.jar context=file:/C:/Development/jboss-5.1.0.GA/server/default/deploy/ real=file:/C:/Development/jboss-5.1.0.GA/server/default/deploy/quartz-ra.rar/quartz-ra.jar]] delegates=null exported=[org.jboss.resource.adapter.quartz.inflow, META-INF] <IMPORT-ALL>NON_EMPTY}}] at org.quartz.core.JobRunShell.run(JobRunShell.java:214) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)* Nested Exception (Underlying Cause) ---------------javax.ejb.EJBTransactionRolledbackException: Unable to inject jndi dependency: env/com.jobs.CutoffMonitor/systemStatus into property com.jobs.CutoffMonitor.systemStatus: com.workflow.SystemStatus from BaseClassLoader@149fb29{VFSClassLoaderPolicy@8447c{name=vfszip:/C:/Development/jboss-5.1.0.GA/server/default/deploy/quartz-ra.rar/ domain=ClassLoaderDomain@1428ffa{name=DefaultDomain parentPolicy=BEFORE parent=org.jboss.bootstrap.NoAnnotationURLClassLoader@12a3722} roots=[MemoryContextHandler@13118985[path= context=vfsmemory://3j001-xdtt8r-ggwhcagq-1-ggwhcp7u-23 real=vfsmemory://3j001-xdtt8r-ggwhcagq-1-ggwhcp7u-23], DelegatingHandler(a)4613052[path=quartz-ra.rar context=file:/C:/Development/jboss-5.1.0.GA/server/default/deploy/ real=file:/C:/Development/jboss-5.1.0.GA/server/default/deploy/quartz-ra.rar], DelegatingHandler(a)20837847[path=quartz-ra.rar/quartz-ra.jar context=file:/C:/Development/jboss-5.1.0.GA/server/default/deploy/ real=file:/C:/Development/jboss-5.1.0.GA/server/default/deploy/quartz-ra.rar/quartz-ra.jar]] delegates=null exported=[org.jboss.resource.adapter.quartz.inflow, META-INF] <IMPORT-ALL>NON_EMPTY}} at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:115) at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130) at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:194) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:80) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.ejb3.mdb.MessagingContainer.localInvoke(MessagingContainer.java:282) at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.delivery(MessageInflowLocalProxy.java:299) at org.jboss.ejb3.mdb.inflow.MessageInflowLocalProxy.invoke(MessageInflowLocalProxy.java:152) at $Proxy366.execute(Unknown Source) at org.jboss.resource.adapter.quartz.inflow.QuartzJob.execute(QuartzJob.java:57) at org.quartz.core.JobRunShell.run(JobRunShell.java:203) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)Caused by: java.lang.RuntimeException: Unable to inject jndi dependency: env/com.jobs.CutoffMonitor/systemStatus into property com.jobs.CutoffMonitor.systemStatus: com.workflow.SystemStatus from BaseClassLoader@149fb29{VFSClassLoaderPolicy@8447c{name=vfszip:/C:/Development/jboss-5.1.0.GA/server/default/deploy/quartz-ra.rar/ domain=ClassLoaderDomain@1428ffa{name=DefaultDomain parentPolicy=BEFORE parent=org.jboss.bootstrap.NoAnnotationURLClassLoader@12a3722} roots=[MemoryContextHandler@13118985[path= context=vfsmemory://3j001-xdtt8r-ggwhcagq-1-ggwhcp7u-23 real=vfsmemory://3j001-xdtt8r-ggwhcagq-1-ggwhcp7u-23], DelegatingHandler(a)4613052[path=quartz-ra.rar context=file:/C:/Development/jboss-5.1.0.GA/server/default/deploy/ real=file:/C:/Development/jboss-5.1.0.GA/server/default/deploy/quartz-ra.rar], DelegatingHandler(a)20837847[path=quartz-ra.rar/quartz-ra.jar context=file:/C:/Development/jboss-5.1.0.GA/server/default/deploy/ real=file:/C:/Development/jboss-5.1.0.GA/server/default/deploy/quartz-ra.rar/quartz-ra.jar]] delegates=null exported=[org.jboss.resource.adapter.quartz.inflow, META-INF] <IMPORT-ALL>NON_EMPTY}} at org.jboss.injection.JndiPropertyInjector.lookup(JndiPropertyInjector.java:82) at org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:99) at org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:89) at org.jboss.injection.JndiPropertyInjector.inject(JndiPropertyInjector.java:61) at org.jboss.ejb3.injection.InjectionInvocation.invokeTarget(InjectionInvocation.java:89) at org.jboss.ejb3.injection.InjectionInvocation.invokeNext(InjectionInvocation.java:83) at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67) at org.jboss.ejb3.injection.InjectionInvocation.invokeNext(InjectionInvocation.java:74) at org.jboss.ejb3.EJBContainer.injectBeanContext(EJBContainer.java:1138) at org.jboss.ejb3.pool.AbstractPool.create(AbstractPool.java:83) at org.jboss.ejb3.pool.AbstractPool.create(AbstractPool.java:73) at org.jboss.ejb3.pool.StrictMaxPool.get(StrictMaxPool.java:146) at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:58) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126) ... 17 moreCaused by: javax.naming.NamingException: Could not dereference object [Root exception is javax.naming.NamingException: Could not dereference object [Root exception is java.lang.RuntimeException: Can not find interface declared by Proxy in our CL + BaseClassLoader@149fb29{vfszip:/C:/Development/jboss-5.1.0.GA/server/default/deploy/quartz-ra.rar/}]] at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1352) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:817) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686) at org.jboss.ejb3.JndiUtil.lookup(JndiUtil.java:44) at org.jboss.injection.JndiPropertyInjector.lookup(JndiPropertyInjector.java:75) ... 31 moreCaused by: javax.naming.NamingException: Could not dereference object [Root exception is java.lang.RuntimeException: Can not find interface declared by Proxy in our CL + BaseClassLoader@149fb29{vfszip:/C:/Development/jboss-5.1.0.GA/server/default/deploy/quartz-ra.rar/}] at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1504) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:822) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686) at javax.naming.InitialContext.lookup(InitialContext.java:392) at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1346) ... 35 moreCaused by: java.lang.RuntimeException: Can not find interface declared by Proxy in our CL + BaseClassLoader@149fb29{vfszip:/C:/Development/jboss-5.1.0.GA/server/default/deploy/quartz-ra.rar/} at org.jboss.ejb3.proxy.impl.objectfactory.ProxyObjectFactory.redefineProxyInTcl(ProxyObjectFactory.java:410) at org.jboss.ejb3.proxy.impl.objectfactory.session.SessionProxyObjectFactory.createProxy(SessionProxyObjectFactory.java:134) at org.jboss.ejb3.proxy.impl.objectfactory.session.stateless.StatelessSessionProxyObjectFactory.getProxy(StatelessSessionProxyObjectFactory.java:79) at org.jboss.ejb3.proxy.impl.objectfactory.ProxyObjectFactory.getObjectInstance(ProxyObjectFactory.java:161) at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304) at org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1479) at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1496) ... 39 moreCaused by: java.lang.ClassNotFoundException: com.workflow.SystemStatus from BaseClassLoader@149fb29{VFSClassLoaderPolicy@8447c{name=vfszip:/C:/Development/jboss-5.1.0.GA/server/default/deploy/quartz-ra.rar/ domain=ClassLoaderDomain@1428ffa{name=DefaultDomain parentPolicy=BEFORE parent=org.jboss.bootstrap.NoAnnotationURLClassLoader@12a3722} roots=[MemoryContextHandler@13118985[path= context=vfsmemory://3j001-xdtt8r-ggwhcagq-1-ggwhcp7u-23 real=vfsmemory://3j001-xdtt8r-ggwhcagq-1-ggwhcp7u-23], DelegatingHandler(a)4613052[path=quartz-ra.rar context=file:/C:/Development/jboss-5.1.0.GA/server/default/deploy/ real=file:/C:/Development/jboss-5.1.0.GA/server/default/deploy/quartz-ra.rar], DelegatingHandler(a)20837847[path=quartz-ra.rar/quartz-ra.jar context=file:/C:/Development/jboss-5.1.0.GA/server/default/deploy/ real=file:/C:/Development/jboss-5.1.0.GA/server/default/deploy/quartz-ra.rar/quartz-ra.jar]] delegates=null exported=[org.jboss.resource.adapter.quartz.inflow, META-INF] <IMPORT-ALL>NON_EMPTY}} at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:448) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:247) at org.jboss.ejb3.proxy.impl.objectfactory.ProxyObjectFactory.redefineProxyInTcl(ProxyObjectFactory.java:406) ... 45 more
We are using the "Default" configuration and therefore the the "isolated" flag is already set to false. Has anyone figured out how to work around this issue? I am stuck on this an have not figured out how to move past it.
Thanks,
Scott
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/572863#572863]
Start a new discussion in EJB3 at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 2 months
[JNDI and Naming] - jndi naming, @javax.annotation.Resource(mappedName versus name)
by Martin Vejmelka
Martin Vejmelka [http://community.jboss.org/people/wayman] created the discussion
"jndi naming, @javax.annotation.Resource(mappedName versus name)"
To view the discussion, visit: http://community.jboss.org/message/572824#572824
--------------------------------------------------------------
public class jg extends HttpServlet {
@Resource(name = "java:/comp/env/jdbc/sisds")
DataSource sistestds;
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
PrintWriter out = response.getWriter();
try {
response.setContentType("text/html;charset=UTF-8");
// obtaining connection
Connection conn = sistestds.getConnection();
// preparing and executing statement
PreparedStatement st = conn.prepareStatement("SELECT ip FROM jail");
st.execute();
// printing resultset
ResultSet rs = st.getResultSet();
while (rs.next()) {
out.println(rs.getString("ip"));
}
} catch (SQLException ex) {
Logger.getLogger(jg.class.getName()).log(Level.SEVERE, null, ex);
} finally {
out.close();
}
}
Dear JBoss community members,
I am really complete newbie to JBoss technologies. The very first thing a have tried was simple servlet with JDBC DataSource Resource injection... Something like...
public class jg extends HttpServlet {
@Resource(name = "java:/comp/env/jdbc/sisds")
DataSource sistestds;
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
PrintWriter out = response.getWriter();
try {
response.setContentType("text/html;charset=UTF-8");
// obtaining connection
Connection conn = sistestds.getConnection();
// preparing and executing statement
PreparedStatement st = conn.prepareStatement("SELECT ip FROM jail");
st.execute();
// printing resultset
ResultSet rs = st.getResultSet();
while (rs.next()) {
out.println(rs.getString("ip"));
}
} catch (SQLException ex) {
Logger.getLogger(jg.class.getName()).log(Level.SEVERE, null, ex);
} finally {
out.close();
}
}
... (the method gets called from appropriate get/post... etc. calls)...
I have simple table containing list of some virtual servers (jails) and want to list their IP addresses. This snippet of code would work in GlassFish, ... but JBoss reports that mappedName should be used... in the @Resource injection...
In fact... it functions with the mappedName... but I want my application to be as portable as possible and I'd like to avoid using platform specific things like mappedName....
Should mention that I am using JBoss AS 5.0.1 GA on Linux...
Any help is welcome...
Martin Vejmelka
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/572824#572824]
Start a new discussion in JNDI and Naming at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 2 months
[IronJacamar] - ResourceAdapter.start
by Stan Brown
Stan Brown [http://community.jboss.org/people/traffic] created the discussion
"ResourceAdapter.start"
To view the discussion, visit: http://community.jboss.org/message/572062#572062
--------------------------------------------------------------
I was doing some testing with ironjacamar-1.0.0.Beta3 and I noticed that ResourceAdapter.start is called after a ManagedConnectionFactory instance is configured and after the called to ManagedConnectionFactory.setResourceAdapter.
Shouldn't ResourceAdapter.start be called before an MCF is configured (at least before setResourceAdapter is called)? In the Connector Architecture specification it states that the start method should be called before any other object belonging to the resource adapter is used. This is from section 5.3.5
The application server must call the start method on the ResourceAdapter JavaBean (in order to create a functional resource adapter instance), before accessing other methods on the ResourceAdapter JavaBean instance or before using other objects that belong to the same resource adapter instance.
I was doing some testing with ironjacamar-1.0.0.Beta3 and I noticed that ResourceAdapter.start is called after a ManagedConnectionFactory instance is configured and after the called to ManagedConnectionFactory.setResourceAdapter.
Shouldn't ResourceAdapter.start be called before an MCF is configured (at least before setResourceAdapter is called)? In the connector architecture specification it states that the start method should be called before any other object belonging to the resource adapter is used. This is from section 5.3.5:
+The application server must call the start method on the ResourceAdapter JavaBean (in order to create a functional resource adapter instance), before accessing other methods on the ResourceAdapter JavaBean instance or before using other objects that belong to the same resource adapter instance.+
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/572062#572062]
Start a new discussion in IronJacamar at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 2 months
[EJB3] - Re: SLSB pool size is always one in jboss 6.0 CR1 using ejb 3.1
by jaikiran pai
jaikiran pai [http://community.jboss.org/people/jaikiran] created the discussion
"Re: SLSB pool size is always one in jboss 6.0 CR1 using ejb 3.1"
To view the discussion, visit: http://community.jboss.org/message/572626#572626
--------------------------------------------------------------
> aravind kopparthi wrote:
>
> MDB is the only option i have at this time with 6.0 CR1 release?
Based on what I have seen in this thread, I have no clue what exactly your usecase is. You've got a timer - which implies one kind of asynchronous invocation. Then you have got a singleton which invokes on a @Asynchronous method of a SLSB. And now you are talking about MDB :)
> aravind kopparthi wrote:
>
> or @Asynchronous will be roughly targeted for next month Final release at least ;) ?.
>
Yes, it will be available in 6.0 Final.
> aravind kopparthi wrote:
>
> i am still looking for a way to increase the Maxpool size for SLSBs.
Are you sure you are looking for a way to increase the Maxpool size? Or are you wondering why the number of instances created for the SLSB is just 1?
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/572626#572626]
Start a new discussion in EJB3 at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 2 months
[Beginner's Corner] - Configuration error
by Alfredo Lopez
Alfredo Lopez [http://community.jboss.org/people/moskorropio] created the discussion
"Configuration error"
To view the discussion, visit: http://community.jboss.org/message/572777#572777
--------------------------------------------------------------
Hello, I'm using JBossAS [6.0.0.20100911-M5 "Neo"] and JBoss Tools with Eclipse Helios SR1 in Ubuntu 10.10.
I've got a problem creating JBoss AS 6.0 server. When I do "New -> Server -> JBoss AS 6.0 -> Finish" no configuration for the server is created. I receive the following error:
!ENTRY org.eclipse.core.jobs 4 2 2010-11-24 13:16:27.842
!MESSAGE An internal error occurred during: "Add Server XPath Details".
!STACK 0
java.lang.NullPointerException
at org.jboss.ide.eclipse.as.core.server.internal.LocalJBossServerRuntime.getConfigLocationFullPath(LocalJBossServerRuntime.java:187)
at org.jboss.ide.eclipse.as.core.server.internal.LocalJBossServerRuntime.getConfigurationFullPath(LocalJBossServerRuntime.java:180)
at org.jboss.ide.eclipse.as.core.extensions.descriptors.XPathModel$1.run(XPathModel.java:84)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
If I try to start JBoss from console, it starts without problems:
13:08:24,238 INFO [org.jboss.bootstrap.impl.base.server.AbstractServer] JBossAS [6.0.0.20100911-M5 "Neo"] Started in 36s:289ms
alfredo@alfredo-laptop:/usr/lib/jvm$ echo $JAVA_HOME
/usr/lib/jvm/java-1.6.0-openjdk
alfredo@alfredo-laptop:/usr/lib/jvm$ echo $JBOSS_HOME
/home/alfredo/JBoss
alfredo@alfredo-laptop:/usr/lib/jvm$ echo $CLASSPATH
/usr/lib/jvm/jdk1.6.0_22/lib/tools.jar
Eclipse is installed in /home/alfredo/eclipse
¿Could anyone help me?
Thank you :)
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/572777#572777]
Start a new discussion in Beginner's Corner at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 2 months
[EJB3] - Konfiguratio of security domains in JBoss AS 6 with EJB 3.1
by Süleyman Vurucu
Süleyman Vurucu [http://community.jboss.org/people/suikast42] created the discussion
"Konfiguratio of security domains in JBoss AS 6 with EJB 3.1"
To view the discussion, visit: http://community.jboss.org/message/569827#569827
--------------------------------------------------------------
Hi @ all,
My Environment at first:
Aplication Sevrer : jboss-6.0.0.20100911-M5 (default configuration without any changes)
IDE: Eclipse 3.6
Jboss Tools V 3.2
Java Version: JDK 1.6 U 20
OS: Windows Vista 32 Bit
My Problem:
I Create a test Application. It Contains only one Stateless Bean with local and remote interfaces:
*package* beans.stateless;
*import* interfaces.stateless.FirstStatelessBeanLocal;
*import* interfaces.stateless.FirstStatelessBeanRemote;
*import* javax.annotation.*;
*import* javax.annotation.security.*;
*import* javax.ejb.*;
*import* org.apache.commons.logging.*;
*import* org.jboss.aop.*;
*import* org.jboss.beans.metadata.api.annotations.*;
*import* org.jboss.security.annotation.*;
/**
* Session Bean implementation class FirstStatelessBean
*/
@Stateless
@SecurityDomain("JBossWS")
@RolesAllowed("{friend}")
*public* *class* FirstStatelessBean *implements* FirstStatelessBeanRemote, FirstStatelessBeanLocal {
/**
* Default constructor.
*/
*private* int pCounterLocal = 0;
*private* int pCounterRemote = 0;
@Resource
*private* SessionContext myCtx ;
*public* FirstStatelessBean() {
}
@PreDestroy
*public* *void* destroy() {
LogFactory.getLog( getClass() ).warn( "Destroy" );
pCounterLocal=0;
pCounterRemote=0;
}
@PostConstruct
*public* *void* create(){
LogFactory.getLog( getClass() ).warn( "Create" );
}
@Override
*public* String sayHelloLocal( String pMesssage ) {
String lMessage = "Hello Local to " + pMesssage + " " + ( ++pCounterLocal ) + " Times";
LogFactory.getLog( getClass() ).info( lMessage );
*return* lMessage;
}
@Override
*public* String sayHelloRemote( String pMesssage ) {
String lMessage = "Hello Remote to " + pMesssage + " " + ( ++pCounterRemote ) + " Times";
LogFactory.getLog( getClass() ).info( lMessage );
// LogFactory.getLog( getClass() ).info( myCtx.getCallerPrincipal() );
*return* lMessage;
}
@Override
@PrePassivate
*public* *void* passviate() {
LogFactory.getLog( getClass() ).warn( "Passivate" );
}
}
On The Client side I get the JNDI Refrence on the following way:
Properties p = *new* Properties();
p.put( Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory" );
p.put( Context.PROVIDER_URL, "jnp://" + pServerAddr + ":" + pServerPort );
InitialContext jndiContext = *new* InitialContext( p );
So my excpected behavior (when I call sayHelloRemote) is an Exception. But this request still works with worong user information.
So what I'm doing wrong ?
I try the example from
http://community.jboss.org/wiki/Chapter15-SecurityandSchoolEJBAccess (http://community.jboss.org/docs/DOC-15571) as well. But the result i the same. I can call every method withaout an exception. And when I call getCallerPrincipal from SessionContext I get an Exception. This occurs while the bean don't in a security domain am I rigth ?
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/569827#569827]
Start a new discussion in EJB3 at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 2 months
[Beginner's Corner] - org.jboss.mq.server.jmx.QueueMBean replacement issue during jbossmq migration to jboss messaging
by Emre He
Emre He [http://community.jboss.org/people/emrehe] created the discussion
"org.jboss.mq.server.jmx.QueueMBean replacement issue during jbossmq migration to jboss messaging"
To view the discussion, visit: http://community.jboss.org/message/572761#572761
--------------------------------------------------------------
With the help from jboss community, i am working on jbossmq migration to jboss messaging, till now the myQueue on jboss messaging is online, but at the Queue client side, i need to update current old codes for Compatibility, below is the target code pieces:
QueueMBean queueMbean = (org.jboss.mq.server.jmx.QueueMBean) ServiceLocator.getInstance().MbeanLookup("jboss.messaging.destination:name=testQueue,service=Queue", org.jboss.mq.server.jmx.QueueMBean.class);
as you know, we have no jbossmq.jar, so i don't know what is corresponding to the org.jboss.mq.server.jmx.QueueMBean in jboss messaging.
i need to use the mehods:
QueueMbean.getMaxDepth()
QueueMbean.getAllMessageCount();
depths[0] = topicMbean.getMaxDepth();
depths[1] = topicMbean.getAllMessageCount();
i tried to use org.jboss.jms.server.destination.DestinationMBean, but it only has getMaxSize() for getMaxDepth(), i can not find the method has same function to getAllMessageCount().
if i use org.jboss.jms.server.destination.QueueMBean, it has getAllMessageCount(), but does not has getMaxSize().
so what could i do?
thanks,
Emre
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/572761#572761]
Start a new discussion in Beginner's Corner at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&cont...]
14 years, 2 months