springframework/remoting class not found - java

I am trying to setup JAX-WS client using spring. I have the below bean definition. Getting the error below.
<bean id="someClient" class="org.springframework.remoting.jaxws.JaxWsPortProxyFactoryBean">
<property name="serviceInterface" value="somePortType" />
<property name="wsdlDocumentUrl" value="file:///someWSDL.wsdl"/>
<property name="namespaceUri" value="soemNS" />
<property name="serviceName" value="Services201006" />
</bean>
Caused by: org.springframework.beans.factory.CannotLoadBeanClassException: Error loading class [org.springframework.remoting.jaxws.JaxWsPortProxyFactoryBean] for bean with name ‘someClient' defined in ServletContext resource [/WEB-INF/jax-ws.xml]: problem with class file or dependent class; nested exception is java.lang.NoClassDefFoundError: Failed to link org/springframework/remoting/jaxws/JaxWsPortProxyFactoryBean (Module "deployment.JbossEAP_WS_WebServiceEAR.ear.JBossEap_WS_SpringService.war:main" from Service Module Loader): Failed to link org/springframework/remoting/jaxws/JaxWsPortClientInterceptor (Module "deployment.JbossEAP_WS_WebServiceEAR.ear.JBossEap_WS_SpringService.war:main" from Service Module Loader): org/aopalliance/intercept/MethodInterceptor

which version of spring are you using? It seems like a dependency is missing in the war file. The JaxWsPortClientInterceptor is part of spring-web.jar

Related

Hibernate LocalSessionFactoryBean, setMappingDirectoryLocations doesn't seem to be working

I'm using Spring 5 and Hibernate 5 together, and I'm configuring Hibernate mapping files in:
org.springframework.orm.hibernate5.LocalSessionFactoryBean like this in my applicationContext.xml file:
<bean id="sessionFactory"
class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
<property name="mappingDirectoryLocations" value="com/myorg/division/myapp/model" />
But I'm getting this error run-time error when I deploy the WAR file to my local Weblogic server:
Deployment Message : weblogic.application.ModuleException: java.io.FileNotFoundException: ServletContext resource [/com/
myorg/division/myapp/model] cannot be resolved to absolute file path - web application archive not expanded?
This should do the work
<property name="packagesToScan" value="com.myorg.division.myapp.model" />

Caused by: com.amazonaws.services.sqs.model.QueueDoesNotExistException: The specified queue does not exist for this wsdl version

I am trying to implement the SimpleQueueService of AWS. I have created the Queue in US-east-2 region by the name: "tradein-tire-promotionsOrders-Alpha-USAmazon". I have mentioned in the xml also , to consider region us-east-2 like this:
<bean id="sqsEndPoint_USAmazon" class="java.lang.String">
<constructor-arg value="https://sqs.us-east-2.amazonaws.com" />
</bean>
The beans which I have created is:
<bean name="promotionsOrdersQueuePoller"
class="com.amazon.tradein.datarelocationengine.sqs.PromotionsOrdersQueuePoller"
init-method="init">
<constructor-arg ref="resourceProvider" />
<constructor-arg ref="promotionsOrdersQueueMessageHandler" />
<constructor-arg ref="promotionsOrdersQueueMessageFailureHandler" />
</bean>
<bean name="promotionsOrdersQueueMessageHandler"
class="com.amazon.tradein.datarelocationengine.sqs.PromotionsOrdersQueueMessageHandler" />
<bean name="promotionsOrdersQueueMessageFailureHandler"
class="com.amazon.tradein.datarelocationengine.sqs.PromotionsOrdersQueueMessageFailureHandler" />
Now I am still getting the error :
Error creating bean with name 'promotionsOrdersQueuePoller' defined in URL [file:/local/home/mshikher/TradeInDataRelocationService/src/TradeInDataRelocationEngine/configuration/spring-configuration/application/sqs.xml]: Invocation of init method failed; nested exception is com.amazon.tradein.datarelocationengine.exception.TerminalException: SQS message consumer start failed
Caused by: com.amazonaws.services.sqs.model.QueueDoesNotExistException: The specified queue does not exist for this wsdl version. (Service: AmazonSQS; Status Code: 400; Error Code: AWS.SimpleQueueService.NonExistentQueue;
I have read many solutions, but there was one solution only that we need to create the queue in us-east-2 region. I have created that already so please provide me with some other solution.

WebLogic NameNotFoundException on JMS ConnectionFactory

I am using WebLogic Server: 12.1.1.0, Spring 3.2.11.RELEASE and Camel 2.13.4.
I have a ConnectionFactory on my WebLogic. The JNDI name is: jms/ConnectionFactory. I used a servlet to print all JNDI names in the server and found it inside the jms subcontext.
The Spring configuration is:
<bean id="jndiFactoryBean" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="jms/ConnectionFactory"/>
<property name="jndiTemplate" ref="jndiTemplate"/>
<property name="lookupOnStartup" value="false"/>
<property name="proxyInterface" value="javax.jms.ConnectionFactory"/>
</bean>
I get the error:
GRAVE: Could not refresh JMS Connection for destination 'CamelTest' -
retrying in 5000 ms. Cause: JndiObjectTargetSource failed to obtain
new target object; nested exception is
javax.naming.NameNotFoundException: While trying to look up
jms/ConnectionFactory in
/app/webapp/camelweblogic.war/1720653836.; remaining name
'jms/ConnectionFactory'
The full trace is:
Caused by: javax.naming.NameNotFoundException: While trying to lookup 'jms.ConnectionFactory' didn't find subcontext 'jms'. Resolved '' [Root exception is javax.naming.NameNotFoundException: While trying to lookup 'jms.ConnectionFactory' didn't find subcontext 'jms'. Resolved '']; remaining name 'jms/ConnectionFactory'
at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:237)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:464)
at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:272)
at weblogic.jndi.internal.ServerNamingNode_1211_WLStub.lookup(Unknown Source)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:418)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:406)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:154)
at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:87)
at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152)
at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178)
at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95)
at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:105)
at org.springframework.jndi.JndiObjectFactoryBean.lookupWithFallback(JndiObjectFactoryBean.java:231)
at org.springframework.jndi.JndiObjectFactoryBean.afterPropertiesSet(JndiObjectFactoryBean.java:217)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1573)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1511)
... 86 more
I have also already tried using the following JNDI names:
java:jms/ConnectionFactory,
java:ConnectionFactory,
ConnectionFactory,
java:comp/env/jms/ConnectionFactory
When you create the domain using WLST, what do you set the JNDI name of the connection factory to? Typically you will see something like this in your domain setup script (.py):
cf = create('ConnectionFactoryName', "ConnectionFactory")
cf.setName('ConnectionFactoryName')
cf.setJNDIName('ConnectionFactoryJNDIName')
In this case you would simply use
<bean id="jndiFactoryBean" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="ConnectionFactoryJNDIName"/>
<property name="jndiTemplate" ref="jndiTemplate"/>
<property name="lookupOnStartup" value="false"/>
<property name="proxyInterface" value="javax.jms.ConnectionFactory"/>
</bean>
in your Spring bean. If you don't have a custom name it may be of value to add one.

CXF JAXWS Client Creation error - No Such Method

I am trying to create a simple cxf client using the flowing snippet in my spring context:
<jaxws:client id="cxf_client" serviceClass="com.my.service" address="http://my.service.com/">
<jaxws:inInterceptors>
<bean class="org.apache.cxf.interceptor.LoggingInInterceptor" />
</jaxws:inInterceptors>
<jaxws:outInterceptors>
<bean class="org.apache.cxf.interceptor.LoggingOutInterceptor" />
</jaxws:outInterceptors>
</jaxws:client>
However when my server starts I am getting the following exception:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cxf_client': FactoryBean threw exception on object creation; nested exception is java.lang.NoSuchMethodError: org.apache.cxf.common.util.ReflectionUtil.getDeclaredMethod(Ljava/lang/Class;Ljava/lang/String; [Ljava/lang/Class;)Ljava/lang/reflect/Method;
Does anyone have any idea what is causing my issue, I am using spring 4.0.5 and CXF 3.0.2.
Cheers

java.lang.NoClassDefFoundError for my DAO

i am using spring.xml for my controller and dao configuration. my spring-config.xml is as below:
<bean id="courseDao" class="com.platysgroup.lmex.adapter.moodle.dao.CourseDao"
init-method="setMoodleDataSource" depends-on="moodleAuthenticationDetails">
<property name="adapterDataSource" ref="adapterDataSource"></property>
<property name="userDao" ref="userDao"></property>
<property name="announcementDao" ref="announcementDao"></property>
<property name="roleDao" ref="roleDao"></property>
<property name="logDao" ref="logDao"></property>
</bean>
i have a coursedao class in my project in the package com.platysgroup.lmex.adapter.moodle.dao in the project name lmex-impl. but my spring config is not getting the class from a lmex-impl.jar. the spring-config.xml is on lmex-web project. and other thing is that he is showing me a wrong path in exception. the wrong name is Lcom/platysgroup/lmex/adapter/moodle/dao/CourseDao; instead of com/platysgroup/lmex/adapter/moodle/dao/CourseDao; the exception full stacktrace is as below:
javax.servlet.ServletException: Servlet.init() for servlet Spring MVC Dispatcher Servlet threw exception
org.tuckey.web.filters.urlrewrite.NormalRewrittenUrl.doRewrite(NormalRewrittenUrl.java:195)
org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:159)
org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:141)
org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:90)
org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:417)
root cause
java.lang.NoClassDefFoundError: Lcom/platysgroup/lmex/adapter/moodle/dao/CourseDao;
java.lang.Class.getDeclaredFields0(Native Method)
java.lang.Class.privateGetDeclaredFields(Class.java:2291)
java.lang.Class.getDeclaredFields(Class.java:1743)
org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.findResourceMetadata(CommonAnnotationBeanPostProcessor.java:315)
org.springframework.context.annotation.CommonAnnotation.........
java.lang.ClassNotFoundException: com.platysgroup.lmex.adapter.moodle.dao.CourseDao
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
please help me to resolve this.
Thank you
A NoClassDefFoundError is thrown when the JRE can't find a class. In your case, it can't find the class Lcom/platysgroup/lmex/adapter/moodle/dao/CourseDao, which you most probably did not add to your classpath.
The prefix 'L' indicates the instance of class. Please see Field Descriptors. You should focus on finding issue with configuration of bean courseDao and check that its all dependencies are there in same application context.

Categories

Resources