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
Related
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.
I am trying to setup a spring project with neo4j. However, when I run the application it does not start up and give the following exception:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'videoRepository': Cannot resolve reference to bean 'neo4jTemplate' while setting bean property 'neo4jTemplate'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.data.neo4j.config.Neo4jConfiguration#0': Cannot resolve reference to bean 'graphDatabaseService' while setting bean property 'graphDatabaseService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'graphDatabaseService' defined in class path resource [spring/neo4j.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.neo4j.kernel.EmbeddedGraphDatabase]: Constructor threw exception; nested exception is java.lang.RuntimeException: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.kernel.impl.transaction.XaDataSourceManager#147e32a' was successfully initialized, but failed to start. Please see attached cause exception.
org.neo4j.kernel.impl.storemigration.StoreUpgrader$UnableToUpgradeException: Not all store files match the version required for successful upgrade
Here is my neo4j.xml
<neo4j:repositories base-package="neo4j.repository"/>
<neo4j:config graphDatabaseService="graphDatabaseService"/>
<bean id="graphDatabaseService" class="org.neo4j.kernel.EmbeddedGraphDatabase" destroy-method="shutdown">
<constructor-arg value="C:/Users/mario/Documents/Neo4j/default.graphdb"/>
<constructor-arg>
<map>
<entry key="allow_store_upgrade" value="true"/>
</map>
</constructor-arg>
</bean>
I am assuming that this problem is caused by allow_store_upgrade. If I remove or set this property to false a exception is thrown suggesting to me to set it to true. What is really causing this problem and how can I fix it?
I have a spring XML config file called appConfig.xml which contains a datasource bean and another JDBCtemplate to which datasource is passed as an argument:
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"></property>
<property name="url" value="jdbc:mysql://localhost:3306/test"/>
</bean>
<bean id="JDBCTemplate" class="com.myprojects.JDBCTemplate">
<property name="dataSource" ref="dataSource"/>
</bean>
I get an error :
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'JDBCTemplate' defined in file [appConfig.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'dataSource' threw exception; nested exception is java.lang.IllegalArgumentException: Property 'dataSource' is required
From what I see from this error, it is not able to pass dataSource to JDBCTemplate. The logs also says:
Loaded JDBC driver: com.mysql.jdbc.Driver
I have all dependencies mentioned in pom.xml and I verified that necessary jars for spring are loaded and mysql jdbc connector is also loaded. Any clues on what the issue may be?
I tried a different project where I manually added all spring dependencies and mysql jdbc connector as part of library. It worked fine there. But while trying to include dependencies via pom.xml, I'm facing this issue. So I'm assuming this is to do with some dependency not being pulled in or something. But unable to figure out which one from the error.
It thinks your class JDBCTemplate does not have a property named dataSource
Perhaps you don't have a public method setDataSource() that has a single argument of the right type.
Perhaps it is private.
Perhaps it is spelled wrong.
I try to using spring integration in different jars.
In the A.jar si-context.xml:
<context:annotation-config />
<int:annotation-config />
<int:channel id="upperServiceChannel">
<int:priority-queue />
</int:channel>
<int:gateway id="upperGateway" default-request-timeout="5000"
default-reply-timeout="5000" default-request-channel="upperServiceChannel"
service-interface="com.company.proj.gw.IUpperStringConversation">
<int:method name="toUpperCase" />
</int:gateway>
<bean id="toUpperCaseService" class="com.company.proj.service.ToUpperCaseService" />
<int:service-activator id="serviceActivatorToUpperCase"
input-channel="upperServiceChannel" method="toUpperCase" ref="toUpperCaseService" />
<int:poller id="poller" default="true" fixed-delay="1000" />
<context:component-scan base-package="com.company"/>
In a bean I'm using this gateway:
#Component(value = "upper")
public class UpperAdapter extends AAdapter<Message<String>> {
#Autowired
IUpperStringConversation gw;
It's working. The problem is, if I try to using my UpperAdapter from an other project (B.jar).
b-context.xml:
<import resource="classpath*:/*si-context.xml" />
<context:annotation-config />
<int:annotation-config />
#Component(value="router")
public class Router {
#Autowired
private Map<String, AAdapter<?>> adapters;
And here I get:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'upper': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.company.proj.gw.IUpperStringConversation com.company.proj.adapter.UpperAdapter.gw; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [com.company.proj.gw.IUpperStringConversation] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {#org.springframework.beans.factory.annotation.Autowired(required=true)}
After I set the spring log level to debug, get this information:
DEBUG o.s.c.a.ClassPathBeanDefinitionScanner - Ignored because not a concrete top-level class: URL [jar:file:/home/tomto/Documents/workspace-sts/integration-fw/src/main/resources/META-INF/lib/integration-fw-module-string-0.0.1-SNAPSHOT.jar!/com/company/proj/gw/IUpperStringConversation.class]
Of course, it's true, becouse (maybe I'm wrong ;)) it would be at runtime generated gateway by spring.
The IUpperStringConversation:
public interface IUpperStringConversation {
public String toUpperCase(String text);
}
What I missed?
Thx!
We had a similar issue, our gateways were not getting injected into our service object:
Project structure:
----------------
-parent/
-common/
--gateways defined here
-module-a/
-module-b/
The exception message received in module-b was:
org.springframework.beans.factory.BeanCreationException: ... Injection of autowired dependencies failed
...
IllegalArgumentException: Class must not be null
Apparently the issue was being caused by conflicting dependencies we had on the module-b classpath. After we cleaned up the Spring dependencies in pom.xml it worked!
I have been working on my first Spring project, and I've come across an annoying problem.
I have a class called 'UsernameService' which is configured as a bean in the dispatcher-servlet.xml:
<bean id="usernameService" class="service.UsernameService" scope="session" >
<aop:scoped-proxy />
</bean>
and when this bean is created in one of my classes (bean definition:)
<bean id="testController" class="controller.TestController" />
as such:
#Autowired
UsernameService uns;
it works absolutely fine. However, when I try and do the same in another class, LogController:
<bean id="logController" class="controller.LogController" />
then it does not work, and I get the following error:
SEVERE: Servlet.service() for servlet [dispatcher] in context with path [/flexitime] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause
java.lang.NullPointerException
I've managed to (I believe) ascribe this error to the fact that uns is never actually set/created and remains as null inside LogController.
I have Googled this extensively and have found many 'solutions', however as yet none of them have worked.
Thanks!
James
Add the auto-wire attribute to your bean:
<bean id="usernameService" class="service.UsernameService" scope="session" autowire="byName">
<aop:scoped-proxy />
</bean>