Jboss 7.1 ejb 2.1 custom transaction timeout configuration - jboss7.x

I'm currently trying to upgrade my web application from jboss 5.1 to jboss 7.1.1.Final
In my jboss.xml I have configured some custom ejb timeouts like the following:
<session>
<ejb-name>MSServiceEJB</ejb-name>
<jndi-name>ejb/MSServiceEJB</jndi-name>
<local-jndi-name>ejb/LocalMSServiceEJB</local-jndi-name>
<method-attributes>
<method>
<method-name>*</method-name>
<transaction-timeout>3600</transaction-timeout>
</method>
</method-attributes>
</session>
jboss 7 ignores jboss.xml, where can I specify my ejb 2.1 transaction timeouts?

Per
Source
Replace the jboss.xml deployment descriptor file
The jboss-ejb3.xml deployment descriptor replaces the jboss.xml deployment descriptor to
override and add to the features provided by the Java Enterprise
Edition (EE) defined ejb3-jar.xml deployment descriptor. The new file
is incompatible with jboss.xml, and the jboss.xml is now ignored in
deployments.
You need to create a jboss-ejb3.xml and put the configuration inside it.
It would look something like this:
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>EJBName</ejb-name>
<method-name>methodName</method-name>
<method-intf>Local</method-intf>
</method>
<tx:trans-timeout>
<tx:timeout>500</tx:timeout>
<tx:unit>Seconds</tx:unit>
</tx:trans-timeout>
</container-transaction>
</assembly-descriptor>
You are using EJB2.x , so it would be better and wise to configure it in ejb-jar.xml
It should be created in META-INF of the EJB jar.

You can specify on the Bean method with #TransactionTimeOut annotation.
#TransactionTimeout(value = 10, unit = TimeUnit.SECONDS)
For detailed description of how to set, please refer here
Maddy

Related

how to disable Jersey from weblogic 12.2.1

Weblogic 12.2.1 has Jersey 2.21.1 inside as implementation of JAX-RS 2.0,but we would like to use Jersey 2.5.1 or Jersey of the latest version.
General way to solve the conflict is to define classes in configuration file to load classes from application.
But when you upgrade weblogic or Jersey, you have to look into the class conflict and make changes to configuration, is there a convenient way to disable Jersey from weblogic?
You need to include the jersey files in the web-inf lib of your project (you can get jersey and dependencies zip file from jersey's website), also add these lines to your weblogic.xml file (as indicated in this post Using Jersey 2.x web service on Weblogic 12.1.1):
<container-descriptor>
<prefer-application-packages>
<!-- jsr311 -->
<package-name>javax.ws.rs.*</package-name>
<!-- javassist -->
<package-name>javassist.*</package-name>
<!-- aop repackaged -->
<package-name>org.aopalliance.*</package-name>
<!-- jersey 2 -->
<package-name>jersey.repackaged.*</package-name>
<package-name>org.glassfish.jersey.*</package-name>
<package-name>com.sun.research.ws.wadl.*</package-name>
<!-- hk2 -->
<package-name>org.glassfish.hk2.*</package-name>
<package-name>org.jvnet.hk2.*</package-name>
<package-name>org.jvnet.tiger_types.*</package-name>
</prefer-application-packages>
<prefer-application-resources>
<resource-name>META-INF/services/javax.servlet.ServletContainerInitializer</resource-name>
<resource-name>META-INF/services/javax.ws.rs.ext.RuntimeDelegate</resource-name>
<!-- jersey -->
<resource-name>META-INF/services/org.glassfish.jersey.*</resource-name>
<resource-name>org.glassfish.jersey.*</resource-name>
<resource-name>jersey.repackaged.*</resource-name>
<!-- hk2 -->
<resource-name>META-INF/services/org.glassfish.hk2.*</resource-name>
</prefer-application-resources>
</container-descriptor>
Doing this will override the jersey version used by weblogic 12.2.1.
If you're using Json you will also require to get these jars as indicated in this post POST to Jersey REST service getting error 415 Unsupported Media Type:
jersey-media-json-jackson
jackson-jaxrs-json-provider
jackson-core
jackson-databind
jackson-annotations
jackson-jaxrs-base
jackson-module-jaxb-annotations
jersey-entity-filtering
and add these lines to the <prefer-application-packages> section in weblogic.xml:
<package-name>org.codehaus.jackson.*</package-name>
<package-name>com.fasterxml.jackson.*</package-name>
UDPATE- Also worth mentioning that weblogic 12 default JSON binder is MOXy and not Jersey, this has caused me some issues and I eventually replaced the provider with Jersey which makes my above changes unnecessary.

CXF 3.0.2 throwing " java.lang.AssertionError: UNIMPLEMENTED " exception in weblogic10.3

We are trying to make a webservice call using CXF framework involving CXF - ws security and the application being deployed in weblogic 10.3 , but receiving the below exception and seems like the weblogic specific jars are picked up , though the xercesimpl jar is present in the application in /WEB-INF/lib .
Options tried , but did not help:
Setting the weblogic container descriptor with
web-inf preferences
true .
Setting the JVM arguments or system property as -
-Djavax.xml.soap.MessageFactory=com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl
-Djavax.xml.soap.SOAPFactory=com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl
-Djavax.xml.soap.SOAPConnectionFactory=weblogic.wsee.saaj.SOAPConnectionFactoryImpl
Adding xercesimpl jar to maven pom.
Exception
]] Root cause of ServletException.
java.lang.AssertionError: UNIMPLEMENTED
at weblogic.xml.domimpl.NodeImpl.setTextContent(NodeImpl.java:216)
at org.apache.jcp.xml.dsig.internal.dom.XmlWriterToTree.writeAttribute(XmlWriterToTree.java:137)
at org.apache.jcp.xml.dsig.internal.dom.XmlWriterToTree.writeNamespace(XmlWriterToTree.java:114)
at org.apache.jcp.xml.dsig.internal.dom.DOMXMLSignature.marshal(DOMXMLSignature.java:211)
at org.apache.jcp.xml.dsig.internal.dom.DOMXMLSignature.sign(DOMXMLSignature.java:329)
at org.apache.wss4j.dom.message.WSSecSignature.computeSignature(WSSecSignature.java:578)
at org.apache.wss4j.dom.action.SignatureAction.execute(SignatureAction.java:151)
at org.apache.wss4j.dom.handler.WSHandler.doSenderAction(WSHandler.java:226)
at org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor.access$100(WSS4JOutInterceptor.java:54)
at org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor$WSS4JOutInterceptorInternal.handleMessageInternal(WSS4JOutInterceptor.java:282)
at org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor$WSS4JOutInterceptorInternal.handleMessage(WSS4JOutInterceptor.java:154)
at org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor$WSS4JOutInterceptorInternal.handleMessage(WSS4JOutInterceptor.java:141)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)enter code here
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:514)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:423)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:326)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:279)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:98)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:138)
Thanks,
Soumya
I finally found the answer without modifying any weblogic startup script (tested on CXF 2.7.0 and weblogic 10.3.6
The reason for this issue is that CXF is not compatible with weblogic implementation of SAAJ. http://cxf.apache.org/docs/application-server-specific-configuration-guide.html
1.
Q: I have this error: javax.xml.ws.WebServiceException: Cannot create SAAJ factory instance.
A: Please make sure you have the saaj-impl-1.3.jar in the classpath and make sure your app picks up this one instead of weblogic one.
The same issue is also causing the UNIMPLEMENTED error in the question
So my solution is
1) put saaj-impl in classpath. If you are using maven, put the dependency on pom.xml
2) in weblogic.xml (in your resources folder) put
<wls:container-descriptor>
<wls:prefer-application-packages>
<wls:package-name>com.sun.xml.messaging.saaj.*</wls:package-name>
</wls:prefer-application-packages>
</wls:container-descriptor>
3) Restart your server through Node Manager and by right the CXF WS-Security should be working
Hope it helps!

Failed Glassfish deploy - "Referencing error: this bundle has no bean of name [ClientBean]"

I'm trying to run the example from this page : GlassFish-to-GlassFish Remote EJB Invocation
But I get this error when I try to deploy the client on glassfish ("asadmin> deploy client-ejb.jar"):
"Exception while deploying the app [client-ejb] : Referencing error: This bundle has no bean of name [ClientBean]"
I need help, thanks.
I encountered a a similar problem when trying to deploy my application (Exception while deploying the app [my-app] : Referencing error : This bundle has no bean of name [myBeanFacade] ) .Rather weird but all that was needed to solve this was to go to the properties of [my-app] under the build category tree, choose compile and tick the compile on save option. Redeployed my application and viola !!
NB [my-app] contains 2 ejb jars and a web application, one of the ejbs is a library in the web app.
This problem occurred because the guy forgot to add the ServiceIF.class reference in client-ejb.jar.
Execute the command:
jar cvf client-ejb.jar test/ServiceIF.class test/ClientIF.class test/ClientBean.class META-INF/glassfish-ejb-jar.xml
get the new .jar and it will work.
In case you are using a deployment descriptor, then the EJB name should be the same in both the descriptor file.
<ejb-jar>
<enterprise-beans>
<session>
<ejb-name>Hello</ejb-name>
<home>com.ejb.test.HelloHome</home>
<remote>com.ejb.test.HelloObject</remote>
<ejb-class>com.ejb.test.HelloBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
**<ejb-name>Hello</ejb-name>**
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
<glassfish-ejb-jar>
<enterprise-beans>
<ejb>
**<ejb-name>Hello</ejb-name>**
<jndi-name>jndi/Hello</jndi-name>
</ejb>
</enterprise-beans>
</glassfish-ejb-jar>

cannot find EJB reference while deploying ADF Fusion Webapp into oracle weblogic server

I created a Fusion Webapplication project with Oracle jdeveloper 11g (11.1.5 but the same problem occours with the 11.2.1 version). Then I created a jsf page and I deployed the project to an external weblogic server (WL 10.3) with the ADF runtime support and evrithing where working.
Then I created the POJOs object (to the model project, because I have 2 proj: Model and ViewController for the web pages and backing beans) from the DB tables and a session bean who provides queries methods. After that (and so far everything it's ok) I added an ADF Data Control bound to the session bean and then I bound (via editor) one of these methods into the jsf page using an ADF table.
If I run the project using the run button everything work, but if I deploy it into both the external deployment WL server and in the internal one I get the following error
[05:30:04 PM] [Deployer:149193]Operation 'deploy' on application 'Prova_application1' has failed on 'AdminServer'
[05:30:04 PM] [Deployer:149034]An exception occurred for task [Deployer:149026]deploy application Prova_application1 on AdminServer.: Could not setup environment.
[05:30:04 PM] Weblogic Server Exception: weblogic.application.ModuleException: Could not setup environment
[05:30:04 PM] Caused by: weblogic.deployment.EnvironmentException: [J2EE:160167]The module Prova-ViewController-context-root in application Prova_application1 uses ejb-links but no EJB modules were found for this application.
[05:30:04 PM] See server logs or server console for more details.
[05:30:04 PM] weblogic.application.ModuleException: Could not setup environment
[05:30:04 PM] #### Deployment incomplete. ####
[05:30:04 PM] Remote deployment failed
but there is such refernce into the web.xml and I bound the Model project into the deployment descriptor. I red every post in the web but I still can't face the problem.
The web.xml in the ViewController project contains the EJB reference (automatically created from jdeveloper) and I bound everithing the Model project but it still doesn't work.
In JDeveloper IDE
you need to set ejb-jar.xml path.
- Right click on your project
- Choose Project Properties
- Go to EJB Module
- Set EJB Version (For example: "2.1")
- Set ejb-jar.xml path (For example: "..\src\META-INF\ejb-jar.xml")
I hope it works..

Migrating from jboss 4.2 to jboss 6.0

we are planned to migrate the server file which are working in jboss 4.2 to jboss 6.0,
application.xml
http://java.sun.com/xml/ns/j2ee/application_1_4.xsd">
ModuleMenuEar
<ejb>ModuleMenuBean.jar</ejb>
<web>
<web-uri>ModuleMenuWeb.war</web-uri>
<context-root>/ModuleMenuWeb</context-root>
</web>
In jboss 4.2, if is not available it takes as context-root, but if we deploy the same file in jboss 6.0 its throwing error like required context-root, is the any xml confoguration which make jboss 6.0 work like jboss 4.0
IN ejb-jar.xml
<session>
<display-name>ModuleRightsSB</display-name>
<ejb-name>ModuleRightsBean</ejb-name>
<local-home>lrp.settings.modulerights.shared.ModuleRightsLocalHome</local-home>
<local>lrp.settings.modulerights.shared.ModuleRightsLocal</local>
<ejb-class>lrp.settings.modulerights.bean.ModuleRightsBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<resource-ref>
<res-ref-name>jdbc/ReportDB</res-ref-name>
<jndi-name>java:/REPORTDS</jndi-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<resource-ref>
<res-ref-name>jdbc/ClientDB</res-ref-name>
<jndi-name>java:/MSSQLDS</jndi-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</session>
</enterprise-beans>
in some ejb-jar.xml file, we used in ejb -jar.xml file itself , which is working properly in jboss 4.2, if we deploy the same file in jboss 6.0, its throwing error like required res-type, but its already available in ejb-jar.xml file,
Is there any xml configuration can be removed, so that it works without throeing any error,
kindly refer the attachment for more details
kindly help me to resolve this,
thanks in advance,
Vairam S
<jndi-name>java:/MSSQLDS</jndi-name> is not a valid tag for <resource-ref>. Try removing that, then make sure the sub-tags are in the following order:
<res-ref-name>jdbc/ClientDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
If that doesn't work, providing your stack trace might be helpful.