java - Dependencies does not inject during weblogic deployment -


i want deploy project on weblogic when deploy war, spring applicationcontext gets loaded , when starts hydrating caches crashes giving me null pointer exception. when debugged saw persistence entity class, used during method, instantiated out dependencies meaning did not injected.

my entity class marked @configurable , getter , setter methods dependencies marked @transient. also, when run tests inject dependencies in entity class , seems not inject when trying deploy weblogic. have no idea start looking problem have no idea code should supply with.

any tips on should google or appreciated. if want have @ code ask , add it.

thank , apologize lack of code have no idea bit , code useless.

edit:

adding code entity class

@configurable @javax.persistence.entity @table(name = "some_table") public class interactionimpl implements interaction, serializable {      private long interactionid;     private long initiatorentitynr;     private long agententitynr;      transient private builderb builderb;     transient private buildera buildera;      @id     @column(name = "justanotherid")     public long getinteractionid() {         return interactionid;     }      public void setinteractionid(long interactionid) {         this.interactionid = interactionid;     }      @column(name = "somecodeb")     private long getinitiatorentitynr() {         return initiatorentitynr;     }      private void setinitiatorentitynr(long initiatorentitynr) {         this.initiatorentitynr = initiatorentitynr;     }      @column(name = "somecodea")     private long getagententitynr() {         return agententitynr;     }      private void setagententitynr(long agententitynr) {          this.agententitynr = agententitynr;     }      @transient     public agent getagent() throws crmentitycreationexception {         if (getagententitynr() != null)             return buildera.buildshallowentity(getagententitynr());         else             throw new crmentitycreationexception("there no agent entity number entity not found"); }      @transient     public void setagent(agent agententity) {         setagententitynr(agententity.getentitynumber());     }      @transient     public customer getinitiator() throws crmentitycreationexception {         if (getinitiatorentitynr() != null) {             return builderb.buildshallowentity(getinitiatorentitynr());         } else {             throw new crmentitycreationexception("the interaction not contain initiator entity number");         }     }      @transient     public void setinitiator(customer initiatorentity) {         setinitiatorentitynr(initiatorentity.getentitynumber());     }      @transient     private builderb getcustomerbuilder() {         return builderb;     }      @inject     @transient     public void builderb(builderb builderb) {         this.builderb = builderb;     }      @transient     private buildera getbuildera() {         return buildera;     }      @inject     @transient     public void setbuildera(buildera buildera) {         this.buildera = buildera;     }    } 

application context

<?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans"        xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"        xmlns:context="http://www.springframework.org/schema/context"        xmlns:tx="http://www.springframework.org/schema/tx"        xmlns:jee="http://www.springframework.org/schema/jee"         xsi:schemalocation="        http://www.springframework.org/schema/jee        http://www.springframework.org/schema/jee/spring-jee.xsd        http://www.springframework.org/schema/beans        http://www.springframework.org/schema/beans/spring-beans-4.1.xsd        http://www.springframework.org/schema/context        http://www.springframework.org/schema/context/spring-context-4.1.xsd        http://www.springframework.org/schema/tx        http://www.springframework.org/schema/tx/spring-tx-4.1.xsd">      <context:load-time-weaver weaver-class="org.springframework.instrument.classloading.instrumentationloadtimeweaver"/>     <tx:annotation-driven transaction-manager="transactionmanager" mode="aspectj"/>     <context:component-scan base-package="crm.persistence"/>     <context:component-scan base-package="crm.services.impl"/>     <context:annotation-config/>     <context:spring-configured/>       <bean id="hazelcast" class="com.hazelcast.core.hazelcast" factory-method="newhazelcastinstance"/>      <bean id="httpcomponentmessagesender" class="org.springframework.ws.transport.http.httpcomponentsmessagesender"/>      <bean id="datasource" class="org.springframework.jdbc.datasource.drivermanagerdatasource">         <property name="driverclassname" value="oracle.jdbc.driver.oracledriver"/>         <property name="url" value="jdbc:oracle:thin:@someconnection:1521:xe"/>         <property name="username" value="someusername"/>         <property name="password" value="somepassword"/>     </bean>      <bean id="emf" class="org.springframework.orm.jpa.localcontainerentitymanagerfactorybean">         <property name="datasource" ref="datasource"/>         <property name="loadtimeweaver" ref="loadtimeweaver"></property>     </bean>      <bean id="transactionmanager" class="org.springframework.orm.jpa.jpatransactionmanager">         <property name="entitymanagerfactory" ref="emf"/>     </bean>      <bean class="org.springframework.transaction.aspectj.jtaannotationtransactionaspect" factory-method="aspectof">     </bean>      <bean id="interactioncache" class="crm.services.impl.caching.interactioncacheimpl">         <property name="ammountofinteractiontoreturn" value="10"/>     </bean>      <bean id="interactions" class="crm.persistence.entities.interactionimpl" scope="prototype"/>      <bean class="org.springframework.beans.factory.config.methodinvokingfactorybean">         <property name="targetobject" ref="interactioncache"/>         <property name="targetmethod" value="rehydrateallcaches"/>     </bean>      <bean id="agentcache" class="crm.services.impl.caching.agentcacheimpl"/>      <bean class="org.springframework.beans.factory.config.methodinvokingfactorybean">         <property name="targetobject" ref="agentcache"/>         <property name="targetmethod" value="rehydrateall"/>     </bean>      <bean class="org.springframework.beans.factory.config.methodinvokingfactorybean">         <property name="targetobject" ref="alertcache"/>         <property name="targetmethod" value="rehydrateall"/>     </bean>  </beans> 

then spring webservice servlet

    <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans"        xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"        xmlns:sws="http://www.springframework.org/schema/web-services"        xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/web-services http://www.springframework.org/schema/web-services/web-services.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">      <import resource="classpath:applicationcontext.xml"/>      <!--scans spring-ws annotation-->    <sws:annotation-driven/>  </beans> 

my web.xml

    <?xml version="1.0" encoding="utf-8"?> <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"          xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"          xsi:schemalocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"          version="3.1">      <servlet>         <servlet-name>spring-ws</servlet-name>         <servlet-class>org.springframework.ws.transport.http.messagedispatcherservlet</servlet-class>     </servlet>      <context-param>         <param-name>contextconfiglocation</param-name>         <param-value>classpath:applicationcontext.xml</param-value>     </context-param>      <listener>         <listener-class>             org.springframework.web.context.contextloaderlistener         </listener-class>     </listener>     <servlet-mapping>         <servlet-name>spring-ws</servlet-name>         <url-pattern>/*</url-pattern>     </servlet-mapping> </web-app> 

and weblogic.xml

    <?xml version="1.0" encoding="utf-8"?> <weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.0/weblogic-web-app.xsd">      <context-root>/crmservice</context-root>     <container-descriptor>         <prefer-application-packages>         <package-name>org.jboss.logging.*</package-name>         </prefer-application-packages>     </container-descriptor> </weblogic-web-app> 

as seen in application context have 2 caches rehydrate. hydrate method calls dao find list of relevant interactions (entity class) , calls getagent() , getinitiator() methods. since buildera , builderb not injected throws null pointer exception.

just remind injects these classes in integration tests not when try , deploy weblogic. don't use tomcat


Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -