[EJB3] - Unable to catch RuntimeException in client EJB
by Bibhu Jena
Bibhu Jena [https://community.jboss.org/people/bibhu] created the discussion
"Unable to catch RuntimeException in client EJB"
To view the discussion, visit: https://community.jboss.org/message/760639#760639
--------------------------------------------------------------
Hi,
I want to throw a runtime exception from my dao layer ,and catch it in service layer to parse the exception and show a meaningful message to user.
But, when I do this , EJB wraps this exception with RolledBackException and the client EJB is not able to catch it as it expects a SecurityBreakException which extends RuntimeException.
I can't throw a checked exception from the class as it implements HibernateListenrs.
Adding sample code snippet for more clarity:
// after every save/update/delete the follwing class get triggered
public class DataChangeListener implements PostDeleteEventListener, PostUpdateEventListener, PostInsertEventListener, Initializable {
public void onPostInsert(final PostInsertEvent event) {
//check if the user is not allowed to do so ,throw a SecurityBreakException
// else do nothing and let the transaction commit.
}
public void onPostUpdate(PostUpdateEvent event) {
//same as onPostInsert
}
public void onPostDelete(PostDeleteEvent event) {
//same as onPostInsert
}
@Local public interface SaveUserDataService{
public void save(Person person);
}
//client EJB which expects a SecurityBreakException
@Stateful SaveUserDataServiceBean implements SaveUserDataService{
public void save(Person person){
try{ //code to call dao layer to save a person
} catch (SecurityBreakException e) {
// parse the exception and show a meaningful message to user
}
}
}
//The exception class
public class SecurityBreakException extends RuntimeException {
private static final long serialVersionUID = 1L;
String message;
public SecurityBreakException(String message) {
super(message); this.message = message;
}
}
Please guide.
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/760639#760639]
Start a new discussion in EJB3 at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years, 6 months
[jBPM] - Error while creating process by using Fluent API.
by snowstorm tech
snowstorm tech [https://community.jboss.org/people/snowstormuser] created the discussion
"Error while creating process by using Fluent API."
To view the discussion, visit: https://community.jboss.org/message/783821#783821
--------------------------------------------------------------
Hi!
By using Fluent API I want to create a Business Process as Shown below:-
https://community.jboss.org/servlet/JiveServlet/showImage/2-783821-20012/... https://community.jboss.org/servlet/JiveServlet/downloadImage/2-783821-20...
Now I'm using the following code given below to create such a kind of process:-
public class ProcessFactoryTest {
public void testProcessFactory() {
RuleFlowProcessFactory factory = RuleFlowProcessFactory.createProcess("org.jbpm.process");
factory
.name("My process").packageName("org.jbpm").imports("com.test.SendHTMLEmail","com.test.Name").variable("listName", new ListDataType())
.startNode(1).name("Start").done().joinNode(2).type(org.jbpm.workflow.core.node.Join.TYPE_XOR).done().connection( 1,2).humanTaskNode(3).actorId("shahid").done().connection(2, 3)
.splitNode(4).type(Split.TYPE_XOR).constraint(2, "Join node", "code", "java", "return (false;").constraint(5, "Usertask Node", "code", "java", "return (true;").done().connection(3, 4).endNode(5).name("End").done()
.connection(4, 5);
RuleFlowProcess process = factory.validate().getProcess();
}
public static void main(String args[])
{
new ProcessFactoryTest().testProcessFactory();
}
}
While executing the above specified code I'm having the following error (When I use fluent API) :-
"Process 'My process' [org.jbpm.process]: Join node 'null' [2] does not have more than one incoming connection: 1.
Process 'My process' [org.jbpm.process]: Split node 'null' [4] does not have more than one outgoing connection: 1.
Exception in thread "main" java.lang.RuntimeException: Process could not be validated !
at org.jbpm.ruleflow.core.RuleFlowProcessFactory.validate(RuleFlowProcessFactory.java:125)
at com.sample.ProcessFactoryTest.testProcessFactory(ProcessFactoryTest.java:43)
at com.sample.ProcessFactoryTest.main(ProcessFactoryTest.java:59)"
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/783821#783821]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years, 6 months
[EJB3] - Bytecode transformation of an EJB results in a java.lang.VerifyError
by simonboggild
simonboggild [https://community.jboss.org/people/simonboggild] created the discussion
"Bytecode transformation of an EJB results in a java.lang.VerifyError"
To view the discussion, visit: https://community.jboss.org/message/783819#783819
--------------------------------------------------------------
Hi,
I've previously posted on the Byteman forum in connection with not being able to use Byteman to transform an EJB. That post can be read here: https://community.jboss.org/thread/215034?tstart=0 https://community.jboss.org/thread/215034?tstart=0
The pull for using Byteman in our setup is to have the ability to inject code appropriately during integration tests, to simulate different error scenarios when interacting with external systems.
We run our integration tests using Arquillian and have then tried to introduce Byteman as well. Using Byteman works well in our setup on regular POJO's, however, when trying to use Byteman to transform an EJB, we see the following exception being thrown from the application server when running the integration test (error thrown right after Byteman transforms the EJB):
SEVERE: java.lang.VerifyError
at sun.instrument.InstrumentationImpl.retransformClasses0(Native Method)
at sun.instrument.InstrumentationImpl.retransformClasses(InstrumentationImpl.java:124)
at org.jboss.byteman.agent.Retransformer.installScript(Retransformer.java:136)
at org.jboss.byteman.agent.TransformListener.handleScripts(TransformListener.java:337)
at org.jboss.byteman.agent.TransformListener.loadScripts(TransformListener.java:260)
at org.jboss.byteman.agent.TransformListener.handleConnection(TransformListener.java:213)
at org.jboss.byteman.agent.TransformListener.run(TransformListener.java:146)
Now, the theory of what goes wrong is (see Andrew Dinns answer in the post mentioned above), that the changes Byteman makes during its transformation of the EJB invaldiate some assumptions about the layout of the bytecode that the EJB code depends upon.
To take this matter further it's necessary to get some more insight in the nature of an EJB and what could be the reason why it's not possible to use a tool such as Byteman to do a bytecode transformation of the EJB without leaving it in an incosistent state.
Any insights/comments/solutions highly appreciated.
Thanks.
Regards,
Simon
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/783819#783819]
Start a new discussion in EJB3 at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years, 6 months
[jBPM] - Not getting the first ftl form of the jbpm process
by vikas k
vikas k [https://community.jboss.org/people/vkn...] created the discussion
"Not getting the first ftl form of the jbpm process"
To view the discussion, visit: https://community.jboss.org/message/783582#783582
--------------------------------------------------------------
Hi,
I am a newbie in the world of jbpm5.
I have divided my understanding about jbpm process and issue in the following section.
Process creation:
I have created a process with two human task nodes with the help of jbpm 5 plugin in eclipse.
Also I got three .ftl files created one for process and other two for human tasks nodes with help of 'generate forms' option in eclipse.
Deployment:
I committed process files(bpmn file,ftl files and diagram of process) in guvnor repository and by building it from there deployed in the jbpm console.
Issue:
Now I am not getting the first form on the start of process from where I am taking inputs even though have ftl for that.
Please do let me know if I need to specify the form conntivity some where in the bpmn file or in any properties.
Also please correct my deployment process if any thing missing.
My Jbpm version is 5.3
Thanks in anticipation
vikas
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/783582#783582]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years, 6 months
[JBoss Cache] - How to use jboss pojocache? Configuration warning: cvc-elt.1: Cannot find the declaration of element 'server'.
by 森 贾
森 贾 [https://community.jboss.org/people/wmfxly] created the discussion
"How to use jboss pojocache? Configuration warning: cvc-elt.1: Cannot find the declaration of element 'server'."
To view the discussion, visit: https://community.jboss.org/message/783550#783550
--------------------------------------------------------------
Dear Sir/Madam
I am a beginner user of JbossCache. I met a problem while using it and I hope you can help solve it. Thank you
The following is a brief description of the question:
While I was using the 3.0.0.GA version of treecache and pojocache, I met an exception:
[aop-trace] org.jboss.util.xml.JBossEntityResolver resolveSystemID, systemId=urn:jboss:jbosscache-core:config:3.0
[aop-trace] org.jboss.util.xml.JBossEntityResolver Found entity systemId=urn:jboss:jbosscache-core:config:3.0 fileName=jbosscache-config-3.0.xsd
[aop-trace] org.jboss.util.xml.JBossEntityResolver schema/jbosscache-config-3.0.xsd maps to URL: jar:file:/E:/src_work/autoSysNew/WebRoot/WEB-INF/lib/jbosscache-core.jar!/schema/jbosscache-config-3.0.xsd
[aop-trace] org.jboss.util.xml.JBossEntityResolver resolveSystemID, systemId=urn:jboss:jbosscache-core:cache-repo:3.0
[aop-trace] org.jboss.util.xml.JBossEntityResolver Found entity systemId=urn:jboss:jbosscache-core:cache-repo:3.0 fileName=jbosscache-registry-3.0.xsd
[aop-trace] org.jboss.util.xml.JBossEntityResolver schema/jbosscache-registry-3.0.xsd maps to URL: jar:file:/E:/src_work/autoSysNew/WebRoot/WEB-INF/lib/jbosscache-core.jar!/schema/jbosscache-registry-3.0.xsd
2012-12-03 14:42:12,983 [main] org.jboss.cache.config.parsing.RootElementBuilder - Configuration warning: cvc-elt.1: Cannot find the declaration of element 'server'.
2012-12-03 14:42:12,987 [main] org.jboss.cache.config.parsing.RootElementBuilder - org.jboss.cache.config.ConfigurationException: Incorrect configuration file. Use '-Djbosscache.config.validate=false' to disable validation.
2012-12-03 14:42:13,604 [main] org.jboss.cache.transaction.GenericTransactionManagerLookup - Falling back to DummyTransactionManager from JBossCache
2012-12-03 14:42:14,230 [main] org.jboss.cache.pojo.impl.PojoCacheImpl - PojoCache version: JBossCache 'Naga' 3.0.0.GA
2012-12-03 14:42:14,247 [main] org.jboss.cache.pojo.impl.PojoCacheImpl - PojoCache version: JBossCache 'Naga' 3.0.0.GA
2012-12-03 14:42:14,414 [main] org.jboss.cache.jmx.PlatformMBeanServerRegistration - JBossCache MBeans were successfully registered to the platform mbean server.
2012-12-03 14:42:14,437 [main] org.jgroups.JChannel - JGroups version: 2.6.7.GA
-------------------------------------------------------
GMS: address is 172.17.109.178:58714
-------------------------------------------------------
2012-12-03 14:42:16,946 [main] org.jboss.cache.RPCManagerImpl - Received new cluster view: [172.17.109.178:58714|0] [172.17.109.178:58714]
2012-12-03 14:42:16,950 [main] org.jboss.cache.RPCManagerImpl - Cache local address is 172.17.109.178:58714
2012-12-03 14:42:16,951 [main] org.jboss.cache.factories.ComponentRegistry - JBoss Cache version: JBossCache 'Naga' 3.0.0.GA
2012-12-03 14:42:17,348 [main] org.jboss.cache.RPCManagerImpl - Disconnecting and closing the Channel
2012-12-03 14:42:17,370 [main] org.jboss.cache.RPCManagerImpl - Stopping the RpcDispatcher
org.jboss.cache.config.parsing.RootElementBuilder - Configuration warning: cvc-elt.1: Cannot find the declaration of element 'server'.,I see in the JbossCache community BBS reply,
https://community.jboss.org/thread/145857 https://community.jboss.org/thread/145857,
Mircea Markus
546 发帖自
2007-1-30
3. 2009-12-16 上午11:04 (回复 balachandra maddina)
Re: Configuration problems using Jboss Pojo Cache 3.0.0.GA
The purpose of the TransactionManagerLookup is to lookup an javax.transaction.TransactionManager within your runtimne and return it to the JBossCache. E.g. if you run in JBossAS then this TransactionManagerLookup implementation (the one you configured, take a look at javadoc) will return the TransactionManager that the AS is using, from JNDI. Read the javadoc for GenericTransactionManagerLookup, should make things more clear. To return to the original question, the warning is caused by the fact that no TransactionManager is found within your runtime, and a default one will be used - which is not so clever, as per the name -> DummyTransactionManager. I'd say you can live with this one if you a) don't have to use it for distributed transactions and b) you don't see any performance degradations for transactions.
configured file information of replSync-service.xml:
<?xml version="1.0" encoding="UTF-8"?>
<server>
<mbean code="org.jboss.cache.jmx.CacheJmxWrapper" name="jboss.cache:service=TreeCache"><!--
<depends>jboss:service=Naming</depends>
--><depends>jboss:service=TransactionManager</depends>
<!--Configure the TransactionManager-->
<attribute name="TransactionManagerLookupClass">org.jboss.cache.transaction.GenericTransactionManagerLookup
</attribute>
<!--
Isolation level : SERIALIZABLE
REPEATABLE_READ (default)
READ_COMMITTED
READ_UNCOMMITTED
NONE
-->
<attribute name="IsolationLevel">REPEATABLE_READ</attribute>
<!--
Valid modes are LOCAL
REPL_ASYNC
REPL_SYNC
INVALIDATION_ASYNC
INVALIDATION_SYNC
-->
<attribute name="CacheMode">REPL_SYNC</attribute>
<!-- Name of cluster. Needs to be the same for all TreeCache nodes in a
cluster in order to find each other.
-->
<attribute name="ClusterName">JBossCache-Cluster</attribute>
<!-- JGroups protocol stack properties.
ClusterConfig isn't used if the multiplexer is enabled and successfully initialized.
-->
<attribute name="ClusterConfig">
<config>
<UDP mcast_addr="228.10.10.10"
mcast_port="45588"
ip_ttl="2"
tos="8"
mcast_recv_buf_size="25000000"
ucast_recv_buf_size="20000000"
mcast_send_buf_size="640000"
ucast_send_buf_size="640000"
loopback="false"
discard_incompatible_packets="true"
max_bundle_size="64000"
max_bundle_timeout="30"
use_incoming_packet_handler="true"
enable_bundling="false"
enable_diagnostics="false"
use_concurrent_stack="true"
thread_naming_pattern="pl"
thread_pool.enabled="true"
thread_pool.min_threads="1"
thread_pool.max_threads="25"
thread_pool.keep_alive_time="30000"
thread_pool.queue_enabled="true"
thread_pool.queue_max_size="10"
thread_pool.rejection_policy="Run"
oob_thread_pool.enabled="true"
oob_thread_pool.min_threads="1"
oob_thread_pool.max_threads="4"
oob_thread_pool.keep_alive_time="10000"
oob_thread_pool.queue_enabled="true"
oob_thread_pool.queue_max_size="10"
oob_thread_pool.rejection_policy="Run"/>
<PING timeout="2000" num_initial_members="3"/>
<MERGE2 max_interval="30000" min_interval="10000"/>
<FD_SOCK/>
<FD timeout="10000" max_tries="5" shun="true"/>
<VERIFY_SUSPECT timeout="1500"/>
<pbcast.NAKACK use_mcast_xmit="false" gc_lag="0"
retransmit_timeout="300,600,1200,2400,4800"
discard_delivered_msgs="true"/>
<UNICAST timeout="300,600,1200,2400,3600"/>
<pbcast.STABLE stability_delay="1000" desired_avg_gossip="50000"
max_bytes="400000"/>
<pbcast.GMS print_local_addr="true" join_timeout="5000" shun="false"
view_bundling="true" view_ack_collection_timeout="5000"/>
<FRAG2 frag_size="60000"/>
<pbcast.STREAMING_STATE_TRANSFER />
<!-- <pbcast.STATE_TRANSFER/> -->
<pbcast.FLUSH timeout="0"/>
</config>
</attribute>
<!--
Just used for async repl: use a replication queue
-->
<attribute name="UseReplQueue">false</attribute>
<!--
Replication interval for replication queue (in ms)
-->
<attribute name="ReplQueueInterval">0</attribute>
<!--
Max number of elements which trigger replication
-->
<attribute name="ReplQueueMaxElements">0</attribute>
<!--
Whether or not to fetch state on joining a cluster
NOTE this used to be called FetchStateOnStartup and has been renamed to be more descriptive.
-->
<attribute name="FetchInMemoryState">true</attribute>
<!--
The max amount of time (in milliseconds) we wait until the
state (ie. the contents of the cache) are retrieved from
existing members in a clustered environment
-->
<attribute name="StateRetrievalTimeout">15000</attribute>
<!--
Number of milliseconds to wait until all responses for a
synchronous call have been received.
-->
<attribute name="SyncReplTimeout">15000</attribute>
</mbean>
</server>
The following are questions i need your help for:
1.Can pojocache be used in the tomcat container,I want to use POJO Cache without JBOSS container
2.If I use pojocache in tomcat, if there any other way to load the jboss-aop.jar,jboss-aop.xml file other than by using SET_OPT to add a vm parameter.
-javaagent:E:\src_work\autoSysNew\WebRoot\WEB-INF\lib\jboss-aop.jar
-Djboss.aop.path=E:\src_work\autoSysNew\src\pojocache-aop.xml
3.If i use it in tomcat, is jndi the only way? Is there any other way to initialize TransactionManager?
4.Will there be any performance problem in the distributed scenario, if i do not use the Jndi method?
I will appreciate it very much if you could offer me some help.
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/783550#783550]
Start a new discussion in JBoss Cache at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
11 years, 6 months