I am working on implementing a small test case for power automate for which in part I am getting data from a website in the xml format. Am getting 0 results though. Worked through a lot of documentation and guessing its something with the namespaces. Cant find any problem with the xPath command though,basically just copied from https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#xpath Example 9
XML File (Content deducted for privacy):
<?xml version=""?>
<message:GenericData
xmlns:message=""
xmlns:common=""
xmlns:xsi=""
xmlns:generic="">
<message:Header>
<message:ID>830b24b2-4a0a-4514-98f5-1cf6c8ac30f5</message:ID>
<message:Test>false</message:Test>
<message:Prepared>2023-01-19T08:39:56.121+01:00</message:Prepared>
<message:Sender id=""/>
<message:Structure structureID="">
<common:Structure>
<URN>urn:sdmx:org.sdmx.infomodel.datastructure.DataStructure=ECB:ECB_EST1(1.0)</URN>
</common:Structure>
</message:Structure>
</message:Header>
<message:DataSet action="">
<generic:Series>
<generic:SeriesKey>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:SeriesKey>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
</generic:Series>
<generic:Series>
<generic:SeriesKey>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:SeriesKey>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
</generic:Series>
<generic:Series>
<generic:SeriesKey>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:SeriesKey>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
</generic:Series>
<generic:Series>
<generic:SeriesKey>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:SeriesKey>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
</generic:Series>
<generic:Series>
<generic:SeriesKey>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:SeriesKey>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
</generic:Series>
<generic:Series>
<generic:SeriesKey>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:SeriesKey>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
</generic:Series>
<generic:Series>
<generic:SeriesKey>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:SeriesKey>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
</generic:Series>
<generic:Series>
<generic:SeriesKey>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:SeriesKey>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
</generic:Series>
<generic:Series>
<generic:SeriesKey>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:SeriesKey>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
<generic:Obs>
<generic:ObsDimension value=""/>
<generic:ObsValue value=""/>
<generic:Attributes>
<generic:Value id=""/>
<generic:Value id=""/>
</generic:Attributes>
</generic:Obs>
</generic:Series>
</message:DataSet>
</message:GenericData>
xPath Command
/*[local-name()="GenericData" and namespace-uri()="message"]/*[local-name()="DataSet" and namespace-uri()="message"]/*[local-name()="Series" and namespace-uri()="generic"]/*[local-name()="Obs" and namespace-uri()="generic"]
Any help is appreciated
With your namespace URIs being all empty, it doesn't make sense to try using namespace-uri().
Using name() might be a better option:
/*[name()="message:GenericData"]/*[name()="message:DataSet"]/*[name()="generic:Series"]/*[name()="generic:Obs"]
Related
I am trying to inject EntityManager in a OSGi bundle but I am getting an error-
[EL Severe]: 2016-07-29 08:34:19.029--ServerSession(1711371450)--java.lang.NoClassDefFoundError: org/eclipse/persistence/internal/jpa/rs/metadata/model/Link
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getDeclaredMethods(Unknown Source)
at org.eclipse.persistence.internal.security.PrivilegedAccessHelper.getDeclaredMethods(PrivilegedAccessHelper.java:339)
at org.eclipse.persistence.internal.jpa.metadata.listeners.EntityListenerMetadata.getDeclaredMethods(EntityListenerMetadata.java:249)
at org.eclipse.persistence.internal.jpa.metadata.listeners.EntityClassListenerMetadata.process(EntityClassListenerMetadata.java:89)
at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor.processListeners(EntityAccessor.java:1226)
at org.eclipse.persistence.internal.jpa.metadata.MetadataProcessor.addEntityListeners(MetadataProcessor.java:140)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:634)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getAbstractSession(EntityManagerFactoryDelegate.java:205)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:305)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:337)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:310)
at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.aries.jpa.container.impl.QuiesceEMFHandler.invoke(QuiesceEMFHandler.java:55)
at com.sun.proxy.$Proxy37.createEntityManager(Unknown Source)
at org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManagerHandler.getPersistenceContext(JTAEntityManagerHandler.java:125)
at org.apache.aries.jpa.container.context.transaction.impl.JTAEntityManagerHandler.invoke(JTAEntityManagerHandler.java:187)
at com.sun.proxy.$Proxy38.contains(Unknown Source)
at icom.leader.application.entitymanager.EventDao.insert(EventDao.java:33)
at icom.leader.application.entitymanager.EventDao.doExecute(EventDao.java:28)
at org.apache.karaf.shell.console.AbstractAction.execute(AbstractAction.java:34)
at org.apache.karaf.shell.console.OsgiCommandSupport.execute(OsgiCommandSupport.java:41)
at org.apache.karaf.shell.commands.basic.AbstractCommand.execute(AbstractCommand.java:34)
at org.apache.karaf.shell.compat.CommandTracker$1.execute(CommandTracker.java:109)
at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:67)
at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:87)
at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:480)
at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:406)
at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)
at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:182)
at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:119)
at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:94)
at org.apache.karaf.shell.impl.console.ConsoleSessionImpl.run(ConsoleSessionImpl.java:268)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.eclipse.persistence.internal.jpa.rs.metadata.model.Link not found by com.knorrbremse.icom.leader.application [313]
at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1558)
at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:79)
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1998)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 37 more
what could be the problem ?
below are my files -
pom.xml :
<dependency>
<groupId>com.knorrbremse.icom</groupId>
<version>2.0.0-SNAPSHOT</version>
<artifactId>icom.leader.platfrom</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.eclipse.persistence/eclipselink -->
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.6.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.core</artifactId>
<version>2.6.0</version>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.4-1200-jdbc41</version>
</dependency>
<dependency>
<groupId>org.apache.karaf.shell</groupId>
<artifactId>org.apache.karaf.shell.console</artifactId>
<version>4.0.5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.transaction/jta -->
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>javax.transaction-api</artifactId>
</dependency>
blueprint.xml :
<blueprint xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.0.0" xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.2.0"
xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"
default-activation="eager">
<bean id="icomOffboardDataSource" class="org.apache.commons.dbcp2.BasicDataSource"
destroy-method="close">
<property name="url"
value="jdbc:postgresql://localhost:5432/enetity_manager" />
<property name="username" value="postgres" />
<property name="password" value="kbroot" />
<property name="driverClassName" value="org.postgresql.Driver" />
<property name="initialSize" value="10" />
<property name="maxTotal" value="50" />
<property name="maxIdle" value="20" />
</bean>
<bean id="icomOffboardXADataSource" class="org.apache.commons.dbcp2.managed.BasicManagedDataSource"
destroy-method="close">
<property name="url"
value="jdbc:postgresql://localhost:5432/enetity_manager" />
<property name="username" value="postgres" />
<property name="password" value="kbroot" />
<property name="driverClassName" value="org.postgresql.Driver" />
<property name="initialSize" value="10" />
<property name="maxTotal" value="50" />
<property name="maxIdle" value="20" />
<property name="transactionManager" ref="transactionManager" />
</bean>
<service ref="icomOffboardXADataSource" interface="javax.sql.DataSource">
<service-properties>
<entry key="osgi.jndi.service.name" value="jdbc/icomOffboardXADataSource" />
<entry key="icom.isXa" value="true" />
</service-properties>
</service>
<service ref="icomOffboardDataSource" interface="javax.sql.DataSource">
<service-properties>
<entry key="osgi.jndi.service.name" value="jdbc/icomOffboardDataSource" />
<entry key="icom.isXa" value="false" />
</service-properties>
</service>
<bean id="eventDao" class="icom.leader.application.entitymanager.EventDao">
</bean>
<service ref="eventDao" interface="icom.leader.application.entityif.EventDaoIF" />
<bean id="entityManagerService" class="icom.leader.application.entitymanager.EntityManagerService">
<jpa:context unitname="icomentitymanager" property="entityManager" />
<tx:transaction method="*" value="Required" />
</bean>
<service ref="entityManagerService" interface="icom.leader.entitymanager.EntityManagerIf" />
<reference id="entityManager" activation="eager" availability="mandatory"
interface="icom.leader.entitymanager.EntityManagerIf">
<reference-listener bind-method="bindDBManagerService"
unbind-method="unbindDBManagerService">
<ref component-id="eventDao" />
</reference-listener>
</reference>
<command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.0.0">
<command name="leader-test/create-sample-data1">
<action class="icom.leader.application.entitymanager.EventDao">
</action>
</command>
</command-bundle>
<reference id="transactionManager" interface="javax.transaction.TransactionManager" />
persistance.xml :
<persistence-unit name="icomentitymanager" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/icomOffboardXADataSource)
</jta-data-source>
<non-jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=jdbc/icomOffboardDataSource)
</non-jta-data-source>
<class>icom.leader.application.entitymanager.Event</class>
<class>icom.leader.platform.entities.VehicleType</class>
<class>icom.leader.platform.entities.Vehicle</class>
<!-- <mapping-file>META-INF/leader_orm.xml</mapping-file> -->
<properties>
<property name="eclipselink.ddl-generation" value="create-tables" />
<property name="eclipselink.weaving" value="true"/>
<property name="eclipselink.target-database" value="PostgreSQL"/>
<property name="eclipselink.target-server"
value="org.apache.aries.jpa.eclipselink.adapter.platform.OSGiTSServer"/>
<!--<property name="eclipselink.ddl-generation" value="none"/>-->
<!--<property name="eclipselink.ddl-generation.output-mode" value="database"/>-->
<!-- for file creation -->
<property name="eclipselink.ddl-generation" value="create-tables"/>
<property name="eclipselink.ddl-generation.output-mode" value="sql-script"/>
<property name="eclipselink.application-location" value="data/tmp/"/>
<property name="eclipselink.create-ddl-jdbc-file-name" value="application_schema.sql"/>
</properties>
</persistence-unit>
Implementation file :
public class EventDao extends OsgiCommandSupport implements EventDaoIF {
private static EntityManager entityManager;
#Override
protected Object doExecute() throws Exception {
insert();
return ".. done";
}
void insert(){
if (entityManager.contains(Event.class)){
System.out.println("true");
} else {
System.out.println("false");
}
}
public void bindDBManagerService(EntityManagerIf entityManager, Map props) {
EventDao.entityManager=entityManager.getEntityManager();
}
public void unbindDBManagerService(EntityManagerIf entityManager, Map props){
EventDao.entityManager=entityManager.getEntityManager();
}
when I am trying to use any method of entityManager then it gives the above error.
I guess it happens from conflict jars, you should be using one or the other not both, if not try versions above 2.6.0. I would guess these two libraries are likely the same used in different contexts
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.6.0</version>
</dependency>
or
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.core</artifactId>
<version>2.6.0</version>
</dependency>
I am trying to use remember me, that seems to be very simple but I get a 404 when I launch the application (404 not found).
My jsp looks like that :
<form class="login" name='loginForm' action="<c:url value='/j_spring_security_check' />" method='POST'>
<input id="j_username" name="j_username" type="text" placeholder="Username" />
<input id="j_password" name="j_password" type="password" placeholder="Password" />
<input name="submit" type="submit" value="Sign In" class="btn btn-success btn-sm" />
<div class="remember-forgot">
<div class="row">
<div class="col-md-6">
<div class="checkbox">
<label>
<input type="checkbox" name="_spring_security_remember_me" />
Remember Me
</label>
</div>
</div>
<div class="col-md-6 forgot-pass-content">
Forgot Password
</div>
</div>
</div>
</form>
and My spring security xml :
<http auto-config="true" use-expressions="true">
<intercept-url pattern="/login" access="permitAll" />
<intercept-url pattern="/j_spring_security_check" access="permitAll" />
<intercept-url pattern="/*" access="hasRole('ROLE_USER')" />
<form-login
login-page="/login"
login-processing-url="/j_spring_security_check"
default-target-url="/admin"
username-parameter="j_username"
password-parameter="j_password"
authentication-failure-url="/login?error" ></form-login>
<logout logout-success-url="/login?logout" />
<csrf disabled="true"/>
<remember-me key="myAppKey" />
</http>
<beans:bean id="CustomAuthenticationProvider" class="com.meltum.springconfiguration.CustomAuthenticationProvider" />
<authentication-manager>
<authentication-provider ref="CustomAuthenticationProvider" />
</authentication-manager>
Does anybody know how to solve it ?
Try to name remember me checkbox same as in the spring security configuration -"remember_me". Or you can use default value "_spring_security_remember_me" with just "key" property in configuration.
I am trying to integrate Spring 3 and Tiles 3, I am viewing the page fine and application is working fine but its giving me following error.
javax.servlet.ServletException: File "/WEB-INF/template/WEB-INF/template/layout.jsp" not found
Here are my configuration files.
<bean class="org.springframework.web.servlet.view.tiles3.TilesViewResolver">
<property name="viewClass"
value="org.springframework.web.servlet.view.tiles3.TilesView"></property>
<property name="order" value="0"></property>
</bean>
<bean class="org.springframework.web.servlet.view.tiles3.TilesConfigurer"
id="tilesConfigurer">
<property name="definitions" value="/WEB-INF/tiles.xml"></property>
</bean>
<bean id="messageSource"
class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basename" value="classpath:I18N/messages" />
<property name="defaultEncoding" value="UTF-8" />
</bean>
<bean id="localeResolver"
class="org.springframework.web.servlet.i18n.CookieLocaleResolver">
<property name="defaultLocale" value="en" />
</bean>
<mvc:interceptors>
<mvc:interceptor>
<mvc:mapping path="/" />
<bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
<property name="paramName" value="lang"></property>
</bean>
</mvc:interceptor>
</mvc:interceptors>
this is my tiles.xml
<tiles-definitions>
<definition name="base.definition"
template='WEB-INF/template/layout.jsp'>
<put-attribute name="title" value="" />
<put-attribute name="header" value="/WEB-INF/tile/header.jsp" />
<put-attribute name="body" value="" />
<put-attribute name="footer" value="/WEB-INF/tile/footer.jsp" />
</definition>
<definition name="login" extends="base.definition">
<put-attribute name="title" value="login" />
<put-attribute name="body" value="/WEB-INF/tile/login.jsp" />
</definition>
here is my layout.jsp
<body bgcolor="">
<table border="1" cellpadding="2" cellspacing="2" align="center">
<tr>
<td height="20%" colspan="1"><tiles:insertAttribute
name="header" /></td>
</tr>
<tr>
<td width="350"><tiles:insertAttribute name="body" /></td>
</tr>
<tr>
<td height="10%" colspan="1"><tiles:insertAttribute
name="footer" /></td>
</tr>
</table>
What am I doing wrong here?
I spent hours on it, still cant figure it out.
Look at exception:
javax.servlet.ServletException: File "/WEB-INF/template/WEB-INF/template/layout.jsp" not found
Tiles tries to find "layout.js" at /WEB-INF/template/WEB-INF/template.
In
<definition name="base.definition"
template='WEB-INF/template/layout.jsp'>
Try to add "/" before template path:
<definition name="base.definition"
template='/WEB-INF/template/layout.jsp'>
I have an XML document with many comment tags I want to uncomment. For example:
<bean id="metadata" class="org.archive.modules.CrawlMetadata" autowire="byName">
<!-- <property name="robotsPolicyName" value="obey"/> -->
<!-- <property name="operator" value=""/> -->
<!-- <property name="operatorFrom" value=""/> -->
<!-- <property name="organization" value=""/> -->
<!-- <property name="audience" value=""/> -->
</bean>
I'm using Nokogiri. Is there any way to remove the comments on the nodes, or to locate them, even when as comments, delete and re-create?
It looks like you want to replace the comments with their content, so uncommenting the markup?
That is easily done:
require 'nokogiri'
doc = Nokogiri::XML::Document.parse(<<__XML__)
<bean id="metadata" class="org.archive.modules.CrawlMetadata" autowire="byName">
<!-- <property name="robotsPolicyName" value="obey"/> -->
<!-- <property name="operator" value=""/> -->
<!-- <property name="operatorFrom" value=""/> -->
<!-- <property name="organization" value=""/> -->
<!-- <property name="audience" value=""/> -->
</bean>
__XML__
doc.xpath('//comment()').each { |comment| comment.replace(comment.text) }
puts doc.serialize
output
<?xml version="1.0"?>
<bean id="metadata" class="org.archive.modules.CrawlMetadata" autowire="byName">
<property name="robotsPolicyName" value="obey"/>
<property name="operator" value=""/>
<property name="operatorFrom" value=""/>
<property name="organization" value=""/>
<property name="audience" value=""/>
</bean>
I apologize for perhaps naive question but I couldn't find an answer online.
I've got some UI code that was created in NetBeans. Unfortunately I don't know what version was used. My understanding is that IntelliJ IDEA (v11 in my case) doesn't support NetBeans forms.
Can I convert the form to something usable in IDEA's form editor ? Content of form's XML file looks lie this:
<?xml version="1.1" encoding="UTF-8" ?>
<Form version="1.3" maxVersion="1.7" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<NonVisualComponents>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
<Property name="text" type="java.lang.String" value="jLabel3"/>
</Properties>
</Component>
<Menu class="javax.swing.JMenuBar" name="menuBar">
<SubComponents>
<Menu class="javax.swing.JMenu" name="fileMenu">
<Properties>
<Property name="mnemonic" type="int" value="102"/>
<Property name="text" type="java.lang.String" value="File"/>
</Properties>
<SubComponents>
<MenuItem class="javax.swing.JMenuItem" name="openMenuItem">
<Properties>
<Property name="mnemonic" type="int" value="111"/>
<Property name="text" type="java.lang.String" value="Open"/>
</Properties>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="saveMenuItem">
<Properties>
<Property name="mnemonic" type="int" value="115"/>
<Property name="text" type="java.lang.String" value="Save"/>
</Properties>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="saveAsMenuItem">
<Properties>
<Property name="mnemonic" type="int" value="97"/>
<Property name="text" type="java.lang.String" value="Save As ..."/>
<Property name="displayedMnemonicIndex" type="int" value="5"/>
</Properties>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="exitMenuItem">
<Properties>
<Property name="mnemonic" type="int" value="120"/>
<Property name="text" type="java.lang.String" value="Exit"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="exitMenuItemActionPerformed"/>
</Events>
</MenuItem>
</SubComponents>
</Menu>
<Menu class="javax.swing.JMenu" name="editMenu">
<Properties>
<Property name="mnemonic" type="int" value="101"/>
<Property name="text" type="java.lang.String" value="Edit"/>
</Properties>
<SubComponents>
<MenuItem class="javax.swing.JMenuItem" name="cutMenuItem">
<Properties>
<Property name="mnemonic" type="int" value="116"/>
<Property name="text" type="java.lang.String" value="Cut"/>
</Properties>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="copyMenuItem">
<Properties>
<Property name="mnemonic" type="int" value="121"/>
<Property name="text" type="java.lang.String" value="Copy"/>
</Properties>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="pasteMenuItem">
<Properties>
<Property name="mnemonic" type="int" value="112"/>
<Property name="text" type="java.lang.String" value="Paste"/>
</Properties>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="deleteMenuItem">
<Properties>
<Property name="mnemonic" type="int" value="100"/>
<Property name="text" type="java.lang.String" value="Delete"/>
</Properties>
</MenuItem>
</SubComponents>
</Menu>
<Menu class="javax.swing.JMenu" name="helpMenu">
<Properties>
<Property name="mnemonic" type="int" value="104"/>
<Property name="text" type="java.lang.String" value="Help"/>
</Properties>
<SubComponents>
<MenuItem class="javax.swing.JMenuItem" name="contentsMenuItem">
<Properties>
<Property name="mnemonic" type="int" value="99"/>
<Property name="text" type="java.lang.String" value="Contents"/>
</Properties>
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="aboutMenuItem">
<Properties>
<Property name="mnemonic" type="int" value="97"/>
<Property name="text" type="java.lang.String" value="About"/>
</Properties>
</MenuItem>
</SubComponents>
</Menu>
</SubComponents>
</Menu>
</NonVisualComponents>
<Properties>
<Property name="defaultCloseOperation" type="int" value="3"/>
<Property name="title" type="java.lang.String" value="My Reporting"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="menuBar" type="java.lang.String" value="menuBar"/>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<Component id="dataRequestButton" min="-2" max="-2" attributes="0"/>
<EmptySpace min="99" pref="99" max="99" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="downloadButton" min="-2" max="-2" attributes="0"/>
<Component id="answersLoaded" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="answersToLoad" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="28" max="-2" attributes="0"/>
</Group>
<Component id="statusLabel" alignment="0" pref="574" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="32" max="-2" attributes="0"/>
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="493" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane1" pref="534" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="answersLoaded" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="answersToLoad" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel2" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="dataRequestButton" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="downloadButton" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jLabel4" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jScrollPane1" pref="316" max="32767" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="statusLabel" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" value="Answer data loaded until"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="answersLoaded">
<Properties>
<Property name="text" type="java.lang.String" value="<nothing loaded>"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" value="Unloaded answers at the server"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="answersToLoad">
<Properties>
<Property name="text" type="java.lang.String" value="<nothing available>"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="downloadButton">
<Properties>
<Property name="text" type="java.lang.String" value="Download ready data"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="downloadButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="statusLabel">
<Properties>
<Property name="text" type="java.lang.String" value="Ready"/>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
<EtchetBorder/>
</Border>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="dataRequestButton">
<Properties>
<Property name="text" type="java.lang.String" value="Request data"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="dataRequestButtonActionPerformed"/>
</Events>
</Component>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTable" name="engineTable">
<Properties>
<Property name="model" type="javax.swing.table.TableModel" editor="org.netbeans.modules.form.editors2.TableModelEditor">
<Table columnCount="4" rowCount="4">
<Column editable="true" title="Title 1" type="java.lang.Object"/>
<Column editable="true" title="Title 2" type="java.lang.Object"/>
<Column editable="true" title="Title 3" type="java.lang.Object"/>
<Column editable="true" title="Title 4" type="java.lang.Object"/>
</Table>
</Property>
<Property name="columnModel" type="javax.swing.table.TableColumnModel" editor="org.netbeans.modules.form.editors2.TableColumnModelEditor">
<TableColumnModel selectionModel="0">
<Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true">
<Title/>
<Editor/>
<Renderer/>
</Column>
<Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true">
<Title/>
<Editor/>
<Renderer/>
</Column>
<Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true">
<Title/>
<Editor/>
<Renderer/>
</Column>
<Column maxWidth="-1" minWidth="-1" prefWidth="-1" resizable="true">
<Title/>
<Editor/>
<Renderer/>
</Column>
</TableColumnModel>
</Property>
<Property name="tableHeader" type="javax.swing.table.JTableHeader" editor="org.netbeans.modules.form.editors2.JTableHeaderEditor">
<TableHeader reorderingAllowed="true" resizingAllowed="true"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JLabel" name="jLabel4">
<Properties>
<Property name="text" type="java.lang.String" value="Engines"/>
</Properties>
</Component>
</SubComponents>
</Form>
Thanks a lot.
IntelliJ IDEA doesn't support NetBeans forms, you can try to use the create snapshot feature that can save IDEA form file from a dialog of the running application.
However, much more convenient solution would be to use JFormDesigner which has IntelliJ IDEA plug-in and can convert NetBeans form files. Note that this tool is commercial and will cost you money, but it's free to try.
I have had perfect success by simply opening up the Source tab in the NetBeans Form editor where I created the form and copying the entirety of the code into a new Class in IntelilJ, then simply adding the code for a new JFrame and its code and passing (this) to the Panel parameter at the bottom of the initComponentsGui method.
Such as:
public class ConvertedGui extends Panel { // my new class
private void initComponents()... // copied code
// >>> the copied code here >>>
JFrame frame = new JFrame("Title For JFrame");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(1440, 900);// or your preferred size
frame.add(this);
frame.setVisible(true);`
}
// >>> More copied code for all the actionListeners etc.>>>