Friday, September 26, 2014

Still not using Maven ? Then here is some dependancy tips

AXIS2 CLIENT

    axis2-xmlbeans-1.6.2
    axis2-transport-http-1.6.2
    axis2-transport-local-1.6.2
    axis2-adb-1.6.2
    axis2-kernel-1.6.2
    axiom-api-1.2.13
    axiom-impl-1.2.13
    neethi-3.0.2
    XmlSchema-1.4.7
    httpcore-4.0
    mail-1.4
    commons-httpclient-3.1
    commons-codec-1.3
    commons-logging-1.1.1
    wsdl4j-1.6.2

JAX-WS
    jaxb-impl.jar
    jaxws-api.jar
    jaxws-rt.jar
    gmbal-api-only.jar
    management-api.jar
    stax-ex.jar
    streambuffer.jar
    policy.jar
    ha-api.jar
    jaxb-core.jar
    
JERSEY
    asm-3.1.jar
    jackson-core-asl-1.9.2.jar
    jackson-jaxrs-1.9.2.jar
    jackson-mapper-asl-1.9.2.jar
    jackson-xc-1.9.2.jar
    jersey-client-1.17.1.jar
    jersey-core-1.17.1.jar
    jersey-json-1.17.1.jar
    jersey-server-1.17.1.jar
    jersey-servlet-1.17.1.jar
    jettison-1.1.jar
    jsr311-api-1.1.1.jar
    
LOG4J
    log4j-1.2.17.jar
    
STRUTS 2
    commons-fileupload-x.y.z.jar
    commons-io-x.y.z.jar
    commons-lang-x.y.jar
    commons-logging-x.y.z.jar
    commons-logging-api-x.y.jar
    freemarker-x.y.z.jar
    javassist-.xy.z.GA
    ognl-x.y.z.jar
    struts2-core-x.y.z.jar
    xwork-core.x.y.z.jar
    commons-lang3-3.1.jar
    
OPEN SAML 2.6
    serializer-2.10.0
    xalan-2.7.1
    xercesImpl-2.10.0
    xml-apis-2.10.0
    xmltooling-1.4.1
    xmlsec-1.5.6
    slf4j-api-1.7.5
    openws-1.5.1
    opensaml-2.6.1
    joda-time-2.2
    esapi-2.0.1
    commons-lang-2.6
    
HIBERNATE 4.1
    commons-collections-3.2.1.jar
    antlr-2.7.7.jar
    commons-lang3-3.1.jar
    commons-logging-1.1.3.jar
    dom4j-1.6.1.jar
    hibernate-commons-annotations-4.0.1.Final.jar
    hibernate-core-4.2.0.Final.jar
    hibernate-jpa-2.0-api-1.0.1.Final.jar
    javassist-3.15.0-GA.jar
    jboss-logging-3.1.0.GA.jar
    jboss-transaction-api_1.1_spec-1.0.0.Final.jar

Tuesday, September 23, 2014

JBOSS - java.lang.NoSuchMethodError: org.jboss.logmanager.LogContext.getAttachment

I came through below error while i was trying to use newer version of hibernate with jboss 5.1.2 EAP. The reason for this is with the classloader. Even though we created a jboss-classloading.xml file and instruct jboss to give priority to our classloader, it still try to pick jboss logging from server class loader than the jar inside war file.


Caused by: java.lang.NoSuchMethodError: org.jboss.logmanager.LogContext.getAttachment(Ljava/lang/String;Lorg/jboss/logmanager/Logger$AttachmentKey;)Ljava/lang/Object;

  at org.jboss.logging.JBossLogManagerProvider.doGetLogger(JBossLogManagerProvider.java:52)

  at org.jboss.logging.JBossLogManagerProvider.getLogger(JBossLogManagerProvider.java:47)

  at org.jboss.logging.Logger.getLogger(Logger.java:2164)

  at org.jboss.logging.Logger.getMessageLogger(Logger.java:2263)

  at org.jboss.logging.Logger.getMessageLogger(Logger.java:2215)

So how to over come this is as follow.


1. Download the zip from here.


2. Unzip it and run ant in the project’s root folder.


3. Copy the resulting .jar in the dist directory to $JBOSS_HOME/server/$PROFILE/deployers.


4. Create a file named jboss-classloading.xml and place it in your deployment’s WEB-INF or META-INF folders with the following contents:


 

<classloading xmlns="urn:jboss:classloading:1.0"

              domain="MyDeploymentDomain"

              parent-domain="NoHibernateNoJBLoggingDomain"

              parent-first="false"

              export-all="NON_EMPTY"

              import-all="true">

</classloading>


5.


The set of packages filtered from your deployment is defined in NoHibernateNoJBLoggingDomain.jar at META-INF/jboss-beans.xml. See below for the default contents of this file:


 

<?xml version="1.0" encoding="UTF-8"?>

<deployment xmlns="urn:jboss:bean-deployer:2.0">

   <bean name="NoHibernateNoJBLoggingDomain" class="com.jboss.examples.classloader.FilteredDefaultDomain">

       <property name="domainName">NoHibernateNoJBLoggingDomain</property>

       <property name="filterPackages">org.hibernate,org.jboss.logmanager</property>

   </bean>

</deployment>

Now You are good to go!!!