I don't know if this is a problem with STS/Eclipse or my project setup but STS is complaining about my Spring schemas.
Multiple annotations found at this line:
- cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'jee:jndi-lookup'.
- schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/jee/spring-jee.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root
element of the document is not <xsd:schema>.
Multiple annotations found at this line:
- schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/tx/spring-tx.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root
element of the document is not <xsd:schema>.
- cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'tx:advice'.
Multiple annotations found at this line:
- cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'aop:config'.
- schema_reference.4: Failed to read schema document 'http://www.springframework.org/schema/aop/spring-aop.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root
element of the document is not <xsd:schema>.
Here is my application config:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
<jee:jndi-lookup expected-type="java.lang.String" id="myId" jndi-name="myJndiName"/>
<!-- Other stuff with no problems ommitted -->
<tx:advice id="transactionAdvice" transaction-manager="transactionManager">
<tx:attributes>
<!-- all methods starting with 'get' are read-only -->
<tx:method name="get*" read-only="true"/>
<!-- other methods use the default transaction settings (see below) -->
<tx:method name="*"/>
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut expression="execution(* com.example.service.*.*(..) )" id="servicesPointcut"/>
<aop:advisor advice-ref="transactionAdvice" pointcut-ref="servicesPointcut"/>
</aop:config>
</beans>
Here are the spring JARs on my classpath:
spring-aop-3.1.4.RELEASE.jar
spring-asm-3.1.4.RELEASE.jar
spring-batch-core-2.1.9.RELEASE.jar
spring-batch-infrastructure-2.1.9.RELEASE.jar
spring-batch-test-2.1.9.RELEASE.jar
spring-beans-3.1.4.RELEASE.jar
spring-context-3.1.4.RELEASE.jar
spring-context-support-3.1.4.RELEASE.jar
spring-core-3.1.4.RELEASE.jar
spring-data-commons-1.5.1.RELEASE.jar
spring-data-jpa-1.3.1.RELEASE.jar
spring-expression-3.1.4.RELEASE.jar
spring-jdbc-3.1.4.RELEASE.jar
spring-orm-3.1.4.RELEASE.jar
spring-oxm-3.1.4.RELEASE.jar
spring-test-3.1.4.RELEASE.jar
spring-tx-3.1.4.RELEASE.jar
Looking in my project classpath, I can find spring-context-3.1.4.RELEASE.jar/META-INF/spring.schemas which contains the line http\://www.springframework.org/schema/jee/spring-jee.xsd=org/springframework/ejb/config/spring-jee-3.1.xsd. A similar file is in spring-aop-3.1.4.RELEASE.jar on my classpath for the AOP tags.
Anyone have any suggestions on how to get rid of this error?
You have added in your classpath spring-tx-3.1.4.RELEASE.jar and in the spring.xm you are refering to http://www.springframework.org/schema/tx/spring-tx.xsd . Perhaps the xsd declarations you are using are old? (ie use: http://www.springframework.org/schema/tx/spring-tx-3.1.xsd)
Related
Jaxb / xjc won't create java classes from xsd schema file (Eclipse and command line)
Using jre1.8.0_191 and JAXB both Eclipse and xjc command line (and switches) give errors when trying to convert imsqti_v2p1.xsd (learning object quizzes) to POJOs (plain old java objects). Most errors said "Property X is already defined. Use to resolve this conflict" and I was able to annotate imsqti_v2p1.xsd until (in both Eclipse and command line xjc) only one error remains:
parsing a schema...
[ERROR] Property "MiOrMoOrMn" is already defined. Use to
resolve this conflict. line 132 of
http://www.w3.org/Math/XMLSchema/mathml2/presentation/scripts.xsd
Now, imsqti_v2p1.xsd has many xmlns' - the one responsible for the error is
<xs:import namespace="http://www.w3.org/1998/Math/MathML"
schemaLocation="http://www.w3.org/Math/XMLSchema/mathml2/mathml2.xsd"/>
This xsd is SHORT and has many local references, one of which causes the error
I did find this scripts.xsd - the compiler complained about line 132 and Property "MiOrMoOrMn" but scripts.xsd ends at line 130! Plus, when I load scripts.xsd into Eclipse editor it has a dozen errors - if they are caused by missing "neighbor" xsd's referenced by mathml2.xsd I'd probably have to find and download and run locally 27 local xsd's! So I'd hoped I could fix scripts.xsd and refer to it locally in a xmlns in the mathml2.xsd header, but now I'm not sure how to resolve this. Also, If you know of a better way to create these POJO's I'd be hearing about it - someone must know about this mathml xsd issue?!?
==================== imsqti_v2p1.xsd =============================
<xs:schema xmlns:jxb="http://java.sun.com/xml/ns/jaxb" jxb:version="2.1"
xmlns="http://www.imsglobal.org/xsd/imsqti_v2p1"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:m="http://www.w3.org/1998/Math/MathML"
xmlns:apip="http://www.imsglobal.org/xsd/apip/apipv1p0/imsapip_qtiv1p0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:sch="http://purl.oclc.org/dsdl/schematron"
targetNamespace="http://www.imsglobal.org/xsd/imsqti_v2p1" version="IMS
QTI 2.1" elementFormDefault="qualified"
attributeFormDefault="unqualified">
<xs:import namespace="http://www.w3.org/XML/1998/namespace"
schemaLocation="http://www.imsglobal.org/xsd/w3/2001/xml.xsd"/>
<xs:import namespace="http://www.w3.org/2001/XInclude"
schemaLocation="http://www.imsglobal.org/xsd/w3/2001/XInclude.xsd"/>
<xs:import namespace="http://www.w3.org/1998/Math/MathML"
schemaLocation="http://www.w3.org/Math/XMLSchema/mathml2/mathml2.xsd"/>
<xs:import
namespace="http://www.imsglobal.org/xsd/apip/apipv1p0/imsapip_qtiv1p0"
schemaLocation="http://www.imsglobal.org/profile/apip/apipv1p0/
apipv1p0_qtiextv2p1_v1p0.xsd"/>
==================== mathml2.xsd ==================
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.w3.org/1998/Math/MathML"
targetNamespace="http://www.w3.org/1998/Math/MathML"
elementFormDefault="qualified">
<xs:include schemaLocation="common/math.xsd"/>
<xs:include schemaLocation="common/common-attribs.xsd"/>
<!-- Presentation -->
<xs:include schemaLocation="presentation/common-types.xsd"/>
<xs:include schemaLocation="presentation/common-attribs.xsd"/>
<xs:include schemaLocation="presentation/characters.xsd"/>
<xs:include schemaLocation="presentation/tokens.xsd"/>
<xs:include schemaLocation="presentation/scripts.xsd"/>
============= scripts.xsd ========================
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.w3.org/1998/Math/MathML"
targetNamespace="http://www.w3.org/1998/Math/MathML"
elementFormDefault="qualified">
================ compiler error message ==================
parsing a schema...
[ERROR] Property "MiOrMoOrMn" is already defined. Use <jaxb:property>
to resolve this conflict. line 132 of
http://www.w3.org/Math/XMLSchema/mathml2/presentation/scripts.xsd
[ERROR] The following location is relevant to the above error
line 138 of
http://www.w3.org/Math/XMLSchema/mathml2/presentation/scripts.xsd
Failed to parse a schema.
XMLSPY let's you download and try the full edition - I loaded up my .xsd and the product was able to chew through all the reference .xsd's and produce (many, many) java class files successfully ... so FYI ... In the meantime, I have been able to get JAXB to work using much smaller input .xds's. I got these (different part of project) by producing output XML from a tool, then using one of the online XML to XSD web sites to produce the .xsd which JAXB was able to process. I guess this is the only way 'round the MiOrMoOrMn problem.
jboss-service.xml:
<?xml version="1.0" encoding="UTF-8"?>
<server xmlns="urn:jboss:service:7.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:jboss:service:7.0 jboss-service_7_0.xsd">
<mbean name="com.xxx.yyy:service=SomeClass"
code="com.xxx.yyy.SomeClassBean" xmbean-dd="META-INF/config-mbeans.xml" />
</server>
I have jboss-service.xml above and I'm getting this error:
Caused by: java.lang.IllegalStateException: Current state START_ELEMENT is not among the statesCHARACTERS, COMMENT, CDATA, SPACE, ENTITY_REFERENCE, DTD valid for getText()
at com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.getText(Unknown Source)
at org.jboss.staxmapper.XMLExtendedStreamReaderImpl.getText(XMLExtendedStreamReaderImpl.java:275)
at org.jboss.as.service.descriptor.JBossServiceXmlDescriptorParser.unexpectedContent(JBossServiceXmlDescriptorParser.java:638)
at org.jboss.as.service.descriptor.JBossServiceXmlDescriptorParser.parseMBean(JBossServiceXmlDescriptorParser.java:221)
at org.jboss.as.service.descriptor.JBossServiceXmlDescriptorParser.readElement(JBossServiceXmlDescriptorParser.java:192)
at org.jboss.as.service.descriptor.JBossServiceXmlDescriptorParser.readElement(JBossServiceXmlDescriptorParser.java:48)
at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:110)
at org.jboss.staxmapper.XMLMapperImpl.parseDocument(XMLMapperImpl.java:69)
at org.jboss.as.service.ServiceDeploymentParsingProcessor.deploy(ServiceDeploymentParsingProcessor.java:96)
... 6 more
Any idea how to fix this? Tried other suggestions, but nothing seems to work.
According to the section 9.6.2 of the JBossAS docs, you need to define your mbean like this:
<?xml version="1.0" encoding="UTF-8"?>
<server xmlns="urn:jboss:service:7.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:jboss:service:7.0 jboss-service_7_0.xsd">
<mbean code="..." name="...">
</mbean>
</server>
EDIT
After looking at the source code of JBossServiceXmlDescriptorParser.java:221, one understands that the element xmbean-dd is no longer expected on Wildfly 9. Only NAMEand CODE are expected.
Remove that element from your mbean tag and it will work.
When using spring data mongo, how can you do <mongo:jmx /> in java based config?
Spring does not (yet?) support this. You have two options:
Include all beans in Java Config
Beans are found in MongoJmxParser.registerJmxComponents().
#Bean
public MBeanExporter sportsbookMBeanExporter() throws MalformedObjectNameException {
MBeanExporter exporter = new MBeanExporter();
exporter.setAssembler(new SimpleReflectiveMBeanInfoAssembler());
exporter.setNamingStrategy(new MBeanObjectNamingStrategy());
Map<String, Object> beanMap = new HashMap<>();
beanMap.put("AssertMetrics", AssertMetrics.class);
beanMap.put("BackgroundFlushingMetrics", BackgroundFlushingMetrics.class);
beanMap.put("BtreeIndexCounters", BtreeIndexCounters.class);
beanMap.put("ConnectionMetrics", ConnectionMetrics.class);
beanMap.put("GlobalLockMetrics", GlobalLockMetrics.class);
beanMap.put("MemoryMetrics", MemoryMetrics.class);
beanMap.put("OperationCounters", OperationCounters.class);
beanMap.put("ServerInfo", ServerInfo.class);
beanMap.put("MongoAdmin", MongoAdmin.class);
exporter.setBeans(beanMap);
return exporter;
}
Create a minimal xml-config
Recommended since beans might change for new releases.
In JavaConfig:
#ImportResource("classpath:spring.xml")
under src/main/resources add a file spring.xml:
<?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:mongo="http://www.springframework.org/schema/data/mongo"
xsi:schemaLocation="
http://www.springframework.org/schema/data/mongo
http://www.springframework.org/schema/data/mongo/spring-mongo-1.0.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<!--not possible to enable in Java Config-->
<mongo:jmx/>
</beans>
I created a mailstream with following command -------
stream create --name mailstream --definition "mail --host=imap.gmail.com --username=yyyyyyyy12#gmail.com --password=my password | file --dir=/tmp/gmailData" --deploy
Refer -http://docs.spring.io/spring-xd/docs/1.0.0.BUILD-SNAPSHOT/reference/html/#modules
But in the xd-singletone console I get -
Caused by: javax.mail.AuthenticationFailedException: failed to connect, no password specified?
How to resolve this issue.
Also --password=secret - how to keep my password invisible or secret in the XD shell
/shankha
You need to escape "#" with "%40" for both username and password and to specify --port=993 for gmail. Also, it may be possible not to work with the default settings as GMail requires SSL for imap and this needs to be configured as well.
So, I would suggest the following (basically, creating a new source module):
Go to spring-xd-1.0.0.M6\xd\modules\source and make a copy of mail folder and name this copy gmail
Go to spring-xd-1.0.0.M6\xd\modules\source\gmail\config and rename both mail.properties and mail.xml to gmail.properties and gmail.xml respectively
Inside gmail.xml replace everything with:
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/integration"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:file="http://www.springframework.org/schema/integration/file"
xmlns:int-mail="http://www.springframework.org/schema/integration/mail"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/integration/mail http://www.springframework.org/schema/integration/mail/spring-integration-mail.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
<channel id="output" />
<int-mail:mail-to-string-transformer
charset="${charset}" input-channel="transform" output-channel="output" />
<beans:beans profile="use-polling">
<int-mail:inbound-channel-adapter
store-uri="${protocol}://${username:}:${password:}#${host}:${port}/${folder}"
channel="transform" should-mark-messages-as-read="${markAsRead}"
should-delete-messages="${delete}" java-mail-properties="javaMailProperties">
<poller fixed-delay="${fixedDelay}" time-unit="SECONDS">
<advice-chain>
<beans:bean
class="org.springframework.xd.dirt.module.support.ThreadContextClassLoaderSetterAdvice" />
</advice-chain>
</poller>
</int-mail:inbound-channel-adapter>
</beans:beans>
<beans:beans profile="use-idle">
<int-mail:imap-idle-channel-adapter
store-uri="${protocol}://${username:}:${password:}#${host}:${port}/${folder}"
channel="transform" auto-startup="true" mail-filter-expression="${expression}"
should-mark-messages-as-read="${markAsRead}"
should-delete-messages="${delete}" java-mail-properties="javaMailProperties">
</int-mail:imap-idle-channel-adapter>
</beans:beans>
<beans:beans profile="default">
<util:properties id="javaMailProperties">
<beans:prop key="mail.imap.socketFactory.class">javax.net.ssl.SSLSocketFactory</beans:prop>
<beans:prop key="mail.imap.socketFactory.fallback">false</beans:prop>
<beans:prop key="mail.store.protocol">imaps</beans:prop>
<beans:prop key="mail.debug">false</beans:prop>
</util:properties>
</beans:beans>
</beans:beans>
4. In XD shell now you will use something like the following to create your stream:
stream create --name myGmailStream --definition "gmail --host=imap.gmail.com --username=yyyyyyyy12%40gmail.com --password=my_password --port=993 | file --dir=/tmp/gmailData" --deploy
Here, please note the following:
I added --port=993
the username contains "%40" instead of "#"
the definition of the stream starts with "gmail
if your password contains "#" you need to replace that with "%40" as well
What I've done above is to, basically, create a new custom module (a source) which is kind of easy (more details about this you can find in the documentation). The XD single node or the XD Shell doesn't even need to be restarted. Give it a try and let me know how it goes.
Regarding the password that you don't want to appear as part of the stream definition, you can provide it as part of your mail module options, as described here: http://docs.spring.io/spring-xd/docs/1.0.0.BUILD-SNAPSHOT/reference/html/#_module_configuration
ie
<xd_home>/config/modules/source/mail/mail.properties:
password: yourpassword
my first try was to simple proxy a service from one location to another, and it work just fine, right now i need some help in how to change part of the service location, for example, the retrieved WSDL point 4 services to a machine, i need to change 1 of those services for another server, is that even possible? If so, how do i do it?
Mule Version CE 3.4.
my code atm is as follow:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:ssl="http://www.mulesoft.org/schema/mule/ssl" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml" xmlns:https="http://www.mulesoft.org/schema/mule/https"
xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spring="http://www.springframework.org/schema/beans" xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:pattern="http://www.mulesoft.org/schema/mule/pattern"
xmlns:mule-ss="http://www.mulesoft.org/schema/mule/spring-security"
xmlns:ss="http://www.springframework.org/schema/security"
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd
http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd
http://www.mulesoft.org/schema/mule/https http://www.mulesoft.org/schema/mule/https/current/mule-https.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.4/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/3.4/mule-http.xsd
http://www.mulesoft.org/schema/mule/pattern http://www.mulesoft.org/schema/mule/pattern/3.4/mule-pattern.xsd
http://www.mulesoft.org/schema/mule/spring-security http://www.mulesoft.org/schema/mule/spring-security/3.4/mule-spring-security.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd
http://www.mulesoft.org/schema/mule/ssl http://www.mulesoft.org/schema/mule/ssl/current/mule-ssl.xsd" version="EE-3.4.0">
<mule-ss:security-manager>
<mule-ss:delegate-security-provider
name="memory-dao" delegate-ref="authenticationManager" />
</mule-ss:security-manager>
<spring:beans>
<ss:authentication-manager alias="authenticationManager">
<ss:authentication-provider>
<ss:user-service id="userService">
<ss:user name="asd" password="asd" authorities="ROLE_ADMIN" />
</ss:user-service>
</ss:authentication-provider>
</ss:authentication-manager>
</spring:beans>
<https:connector name="httpsConnector">
<https:tls-key-store path="${mule.home}/conf/keystore.jks"
keyPassword="1234567" storePassword="1234567" />
</https:connector>
<pattern:web-service-proxy name="Service"
inboundAddress="https://LocalAdress.com:443/services/Service"
outboundAddress="http://RemoteAddress.com/services/Service.svc"
wsdlLocation="http://RemoteAddress.com/services/Service.svc?singleWSDL"/>
Mule doesn't offer a mechanism to realize this type of WSDL customization. What you have to do is:
download "http://RemoteAddress.com/services/Service.svc?singleWSDL",
customize it by hand,
embed the customized version in your project (say in "src/main/resources"),
serve it with wsdlFile="yourCustom.wsdl"