I have a little problem when I try to upload XML file to BaseLinker.
The problem is that the properties in XML are mixed, for example one time property name of price is 4th, next time is 6th or 8th. Because of it BaseLinker didn't upload it correctly.
Some of my XML :
<property name="grubość">1</property>
<property name="grubość ścianki">1</property>
<property name="średnica">400</property>
<property name="wysokość">400</property>
<property name="Pojemność (l)">50</property>
<property name="opis">400</property>
<property name="wymiary zewnętrzne">400</property>
<property name="waga">50</property>
<property name="wymiary">1</property>
<property name="moc">1</property>
<property name="napięcie">400x/400h</property>
<property name="categoryId">194</property>
<property name="productCode">832806</property>
<property name="largeSize">0</property>
<property name="tillStockLasts">0</property>
<property name="basePrice">749.00</property>
<property name="productId">950</property>
other line :
<property name="wysokość">450</property>
<property name="wymiary zewnętrzne">śr. 450x(H) 450 </property>
<property name="Pojemność (l)">70</property>
<property name="wymiary">śr.450x(H)450</property>
<property name="categoryId">194</property>
<property name="productCode">832929</property>
<property name="largeSize">0</property>
<property name="tillStockLasts">0</property>
<property name="basePrice">849.00</property>
<property name="productId">950</property>
Is it possible to parse it or use java program that can sort it in correct order?
For example I wanna have XML of properties like :
property name="wysokość" property name="szerokosc" property name="productCode" property name="productID"
and so on...
Related
we try to connect to active directory as secondary store, we retrieved the data from AD successfully, but when we try to update user Info from user profile we get the following Message :
when we look to log we found the follwing problem :
javax.naming.directory.NoSuchAttributeException: [LDAP: error code 16 - 00000057: LdapErr: DSID-0C090EC7, comment: Error in attribute conversion operation, data 0, v3839 ]; remaining name 'CN=mhejazi'
the secondry store config is :
<?xml version="1.0" encoding="UTF-8"?><UserStoreManager class="org.wso2.carbon.user.core.ldap.ActiveDirectoryUserStoreManager">
<Property name="ConnectionURL">ldap://10.3.5.33:389</Property>
<Property name="ConnectionName">CN=mhejazi,CN=Users,DC=devdc,DC=sure,DC=Com,DC=sa</Property>
<Property encrypted="true" name="ConnectionPassword">kuv2MubUUveMyv6GeHrXr9il59ajJIqUI4eoYHcgGKf/BBFOWn96NTjJQI+wYbWjKW6r79S7L7ZzgYeWx7DlGbff5X3pBN2Gh9yV0BHP1E93QtFqR7uTWi141Tr7V7ZwScwNqJbiNoV+vyLbsqKJE7T3nP8Ih9Y6omygbcLcHzg=</Property>
<Property name="UserSearchBase">CN=Users,DC=devdc,DC=sure,DC=com,DC=sa</Property>
<Property name="UserEntryObjectClass">user</Property>
<Property name="UserNameAttribute">sAMAccountName</Property>
<Property name="UserNameSearchFilter">(&(objectClass=user)(sAMAccountName=?))</Property>
<Property name="UserNameListFilter">(objectClass=person)</Property>
<Property name="UserDNPattern"/>
<Property name="DisplayNameAttribute"/>
<Property name="Disabled">false</Property>
<Property name="ReadGroups">true</Property>
<Property name="WriteGroups">true</Property>
<Property name="GroupSearchBase">CN=Users,DC=devdc,DC=sure,DC=com,DC=sa</Property>
<Property name="GroupEntryObjectClass">group</Property>
<Property name="GroupNameAttribute">cn</Property>
<Property name="GroupNameSearchFilter">(&(objectClass=group)(cn=?))</Property>
<Property name="GroupNameListFilter">(objectcategory=group)</Property>
<Property name="RoleDNPattern"/>
<Property name="MembershipAttribute">member</Property>
<Property name="MemberOfAttribute">memberOf</Property>
<Property name="BackLinksEnabled">true</Property>
<Property name="Referral">follow</Property>
<Property name="UserNameJavaRegEx">[a-zA-Z0-9._-|//]{3,30}$</Property>
<Property name="UserNameJavaScriptRegEx">^[\S]{3,30}$</Property>
<Property name="UsernameJavaRegExViolationErrorMsg">Username pattern policy violated.</Property>
<Property name="PasswordJavaRegEx">^[\S]{5,30}$</Property>
<Property name="PasswordJavaScriptRegEx">^[\S]{5,30}$</Property>
<Property name="PasswordJavaRegExViolationErrorMsg">Password pattern policy violated.</Property>
<Property name="RoleNameJavaRegEx">[a-zA-Z0-9._-|//]{3,30}$</Property>
<Property name="RoleNameJavaScriptRegEx">^[\S]{3,30}$</Property>
<Property name="SCIMEnabled">false</Property>
<Property name="BulkImportSupported">true</Property>
<Property name="EmptyRolesAllowed">true</Property>
<Property name="PasswordHashMethod">PLAIN_TEXT</Property>
<Property name="MultiAttributeSeparator">,</Property>
<Property name="isADLDSRole">false</Property>
<Property name="userAccountControl">512</Property>
<Property name="MaxUserNameListLength">100</Property>
<Property name="MaxRoleNameListLength">100</Property>
<Property name="kdcEnabled">false</Property>
<Property name="defaultRealmName">WSO2.ORG</Property>
<Property name="UserRolesCacheEnabled">true</Property>
<Property name="ConnectionPoolingEnabled">false</Property>
<Property name="LDAPConnectionTimeout">5000</Property>
<Property name="ReadTimeout">5000</Property>
<Property name="RetryAttempts">0</Property>
<Property name="CountRetrieverClass"/>
<Property name="java.naming.ldap.attributes.binary"/>
<Property name="DomainName">devdc.sure.com.sa</Property>
<Property name="Description">Sue Dev
</Property>
javax.naming.directory.NoSuchAttributeException: [LDAP: error code 16 - 00000057: LdapErr: DSID-0C090D50, comment: Error in attribute conversion operation, data 0, v3839
This error occurs when the claim mapping is not properly configured against the AD attributes via Claim Management UI.
You need to make sure that all the attributes mapped are valid and existing in Active Directory. Different user stores uses different attributes. In [2] you can find a reference to the set of attributes supported by active directory. The default WSO2 claims are mapped to some generic attributes, the Firstname is mapped to the nickname attribute but active directory does not have a nickname attribute. The Full Name is mapped to the cn attribute, in active directory cn has other semantic meanings.
Similarly in your claim configuration you need to make sure that all the attributes defined there are supported by Active Directory. If it is not supported you can add an additional mapped attribute in claim configuration for the local claim that is supported by AD. Sample configuration is as follows.
Refer [3] for more information regarding this.
[ 1] https://wiki.servicenow.com/index.php?title=LDAP_Error_Codes
[2] http://www.kouti.com/tables/userattributes.htm
[3] https://docs.wso2.com/display/IS540/Managing+User+Attributes
I have a working web application built using the following technologies:
Spring MVC, Java, Hibernate, Oracle Database.
It works fine when I use http://localhost:8080/WebAppName. However, when I use http://:8080/WebAppName, it cannot pull any data. Logs show that there no attempt at all to access the database server.
I tried changing the config of the server.xml in tomcat (as I have found in several questions similar to my problem), such as adding useIPVHosts="true", resolveHosts="true", address="0.0.0.0". All didn't work.
Perhaps there are other configuration files that I need to check/change. Any suggestions will be greatly appreciated. Thanks in advance.
Below is my hibernate configuration:
<bean id="dataSourceDEV1" class="org.apache.commons.dbcp2.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
<property name="url" value="jdbc:oracle:thin:#//rac-hr-qa:20001/WBD1" />
<property name="username" value="workbrain" />
<property name="password" value="xxxxxxxxxx" />
</bean>
<bean id="sessionFactoryDEV1"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSourceDEV1" />
<property name="configLocation"
value="classpath:/com/safeway/web/resources/dev1-hibernate.cfg.xml" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop>
<prop key="hibernate.id.new_generator_mappings">false</prop>
</props>
</property>
<property name="packagesToScan">
<list>
<value>com.safeway.web.dao</value>
</list>
</property>
</bean>
<bean id="transactionManagerDEV1"
class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactoryDEV1" />
</bean>
<hibernate-configuration>
<session-factory>
<property name="hbm2ddl.auto">validate</property>
<property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>
<property name="show_sql">true</property>
<property name="connection.pool_size">5</property>
<property name="temp.use_jdbc_metadata_defaults">false</property>
<property name="hibernate.jdbc.use_get_generated_keys">true</property>
<mapping class="com.safeway.model.CalculationGroup"></mapping>
<mapping class="com.safeway.model.CalcGroupVesrion"></mapping>
<mapping class="com.safeway.model.CalcGroupHistory"></mapping>
</session-factory>
</hibernate-configuration>
You need to use an ip address with the port.
http://:8080/WebAppName
should be
http://127.0.0.1:8080/WebAppName
for the IP address of localhost.
I work on web java application using hibernate, and i always get memory low errors for tons of java inactive sessions on my oracle db. i tried to closing this unused sessions with c3p0 timeout config but it's not working at all.
this is my hibernate config and my open sessions after several minutes:
(the commented code below is for when i tried using common dbcp refer to one of answers for similar questions and timeout times set to 30 seconds for test.)
<property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property>
<property name="hibernate.connection.driver_class">oracle.jdbc.OracleDriver</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:#localhost:test</property>
<property name="hibernate.connection.username">tams_test</property>
<property name="hibernate.connection.password">test1234</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.current_session_context_class">thread</property>
<property name="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</property>
<property name="hibernate.connection.isolation">2</property>
<property name="org.hibernate.flushMode">COMMIT</property>
<property name="hibernate.cache.use_query_cache">false</property>
<property name="hibernate.transaction.auto_close_session">true</property>
<property name="hibernate.order_updates">true</property>
<property name="hibernate.order_inserts">true</property>
<!-- <property name="hibernate.dbcp.initialSize">3</property>
<property name="hibernate.dbcp.maxIdle">50</property>
<property name="hibernate.dbcp.minIdle">0</property>
<property name="hibernate.dbcp.maxWait">180000</property>
<property name="hibernate.dbcp.maxConnLifetimeMillis">30000</property>
<property name="hibernate.dbcp.defaultQueryTimeout">1</property>-->
<property name="hibernate.c3p0.min_size">1</property>
<property name="hibernate.c3p0.max_size">150</property>
<property name="hibernate.c3p0.max_statements">50</property>
<property name="hibernate.c3p0.timeout">30</property>
<property name="hibernate.c3p0.idle_test_period">30</property>
<property name="hibernate.c3p0.idleConnectionTestPeriod">30</property>
<property name="c3p0.testConnectionOnCheckout">true</property>
<property name="testConnectionOnCheckin">true</property>
<property name="c3p0.maxConnectionAge">30</property>
<property name="maxIdleTimeExcessConnections">30</property>
<property name="connection.provider_class">
org.hibernate.connection.C3P0ConnectionProvider
</property>
open sessions on oracle db after several minutes
I faced your problem too, and hibernate didn't want to apply my parameters of c3p0, so I changed my datasource and it completly solved my problem of inactive sessions.
Try to setup your dataSource bean like this:
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<property name="driverClass" value="oracle.jdbc.driver.OracleDriver"/>
<property name="jdbcUrl" value="jdbc:oracle:thin:#xxxx:1521:xxx"/>
<property name="user" value="xx"/>
<property name="password" value="xxxx"/>
<property name="maxStatements" value="1000"/>
<property name="maxIdleTime" value="30"/>
<property name="maxPoolSize" value="100"/>
<property name="minPoolSize" value="10"/>
<property name="initialPoolSize" value="10"/>
<property name="idleConnectionTestPeriod" value="20"/>
</bean>
I've never used LDAP. I have to write a JAVA class which check if the password given by the user is correct. Users/password are stored in the LDAP server of WSO2IS. This is the configuration:
<UserManager>
<Realm>
<Configuration>
<AddAdmin>true</AddAdmin>
<AdminRole>admin</AdminRole>
<AdminUser>
<UserName>admin</UserName>
<Password>admin</Password>
</AdminUser>
<EveryOneRoleName>everyone</EveryOneRoleName> <!-- By default users in this role sees the registry root -->
<Property name="dataSource">jdbc/WSO2CarbonDB</Property>
<Property name="MultiTenantRealmConfigBuilder">org.wso2.carbon.user.core.config.multitenancy.CommonLDAPRealmConfigBuilder</Property>
</Configuration>
<UserStoreManager class="org.wso2.carbon.user.core.ldap.ReadWriteLDAPUserStoreManager">
<Property name="TenantManager">org.wso2.carbon.user.core.tenant.CommonHybridLDAPTenantManager</Property>
<Property name="ConnectionURL">ldap://localhost:10389</Property>
<Property name="Disabled">false</Property>
<Property name="ConnectionName">uid=admin,ou=system</Property>
<Property name="ConnectionPassword">admin</Property>
<Property name="passwordHashMethod">SHA</Property>
<Property name="UserNameListFilter">(objectClass=person)</Property>
<Property name="UserEntryObjectClass">identityPerson</Property>
<Property name="UserSearchBase">ou=Users,dc=wso2,dc=org</Property>
<Property name="UserNameSearchFilter">(&(objectClass=person)(uid=?))</Property>
<Property name="UserNameAttribute">uid</Property>
<Property name="UsernameJavaRegEx">[a-zA-Z0-9._-|//]{3,30}$</Property>
<Property name="UsernameJavaScriptRegEx">^[\S]{3,30}$</Property>
<Property name="RolenameJavaScriptRegEx">^[\S]{3,30}$</Property>
<Property name="RolenameJavaRegEx">[a-zA-Z0-9._-|//]{3,30}$</Property>
<Property name="PasswordJavaScriptRegEx">^[\S]{5,30}$</Property>
<Property name="ReadGroups">true</Property>
<Property name="WriteGroups">true</Property>
<Property name="EmptyRolesAllowed">false</Property>
<Property name="GroupSearchBase">ou=Groups,dc=wso2,dc=org</Property>
<Property name="GroupNameListFilter">(objectClass=groupOfNames)</Property>
<Property name="GroupEntryObjectClass">groupOfNames</Property>
<Property name="GroupNameSearchFilter">(&(objectClass=groupOfNames)(cn=?))</Property>
<Property name="GroupNameAttribute">cn</Property>
<Property name="SharedGroupNameAttribute">cn</Property>
<Property name="SharedGroupSearchBase">ou=SharedGroups,dc=wso2,dc=org</Property>
<Property name="SharedGroupEntryObjectClass">groupOfNames</Property>
<Property name="SharedGroupNameListFilter">(objectClass=groupOfNames)</Property>
<Property name="SharedGroupNameSearchFilter">(&(objectClass=groupOfNames)(cn=?))</Property>
<Property name="SharedTenantNameListFilter">(objectClass=organizationalUnit)</Property>
<Property name="SharedTenantNameAttribute">ou</Property>
<Property name="SharedTenantObjectClass">organizationalUnit</Property>
<Property name="MembershipAttribute">member</Property>
<Property name="UserRolesCacheEnabled">true</Property>
<Property name="ReplaceEscapeCharactersAtUserLogin">true</Property>
<Property name="MaxRoleNameListLength">100</Property>
<Property name="MaxUserNameListLength">100</Property>
<Property name="SCIMEnabled">false</Property>
</UserStoreManager>
<AuthorizationManager
class="org.wso2.carbon.user.core.authorization.JDBCAuthorizationManager">
<Property name="AdminRoleManagementPermissions">/permission</Property>
<Property name="AuthorizationCacheEnabled">true</Property>
</AuthorizationManager>
</Realm>
Can you please help me?. I've no idea where to start. Thank you.
You need to check the user/password of the users using some authentication API. There is Web service service called RemoteUserStoreManagerService that you can use to verify user/password of the user. Also this API can be used to manage the users in the LDAP. You can add/update/delete LDAP users. More details about the API can be found from here with simple java client to invoke this API
Say I have the following bean:
<bean id="some-bean" class="com.icyrock.example.SomeBean">
<property name="pa1" value="va1"/>
<property name="pa2" value="va2"/>
<property name="pa3" value="va3"/>
<property name="pa4" value="va4"/>
<property name="pa5" value="va5"/>
<property name="pa5">
<bean class="com.icyrock.example.SomeOtherBean>
<property name="px1" value="vx1"/>
<property name="px2" value="vx2"/>
<property name="px3" value="vx3"/>
<property name="px4" value="vx4"/>
<property name="px5" value="vx5"/>
</bean>
</property>
</bean>
I'd like to separate this into blocks along the lines:
<block id="b1">
<property name="pa1" value="va1"/>
<property name="pa2" value="va2"/>
<property name="pa3" value="va3"/>
</block>
<block id="b2">
<property name="pa4" value="va4"/>
<property name="pa5" value="va5"/>
</block>
<block id="b3">
<property name="px1" value="vx1"/>
<property name="px2" value="vx2"/>
</block>
<block id="b4">
<property name="px3" value="vx3"/>
<property name="px4" value="vx4"/>
<property name="px5" value="vx5"/>
</block>
<bean id="some-bean" class="com.icyrock.example.SomeBean">
<block-ref id="b1"/>
<block-ref id="b2"/>
<property name="pa5">
<bean class="com.icyrock.example.SomeOtherBean>
<block-ref id="b3"/>
<block-ref id="b4"/>
</bean>
</property>
</bean>
where block and block-ref are imaginary Spring tags just to illustrate the idea.
Is there a way to do this without:
Changing the Java classes (e.g. to accept the map of properties or a subclass)
Using anything not already in Spring itself (i.e. anything along the lines of building some factories/property-setters/whatever else to use in Spring context file(s) or so)
The purpose would be to reuse definitions (i.e. blocks) without making any relationships (e.g. parent-child relationships or things like that). As an example, this is standard JDBC data-source definition:
<bean id="dataSource" destroy-method="close" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="${jdbc.driverClassName}"/>
<property name="url" value="${jdbc.url}"/>
<property name="username" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
</bean>
(example from here). If there are different servers that are accessed, it can be the case that they share the same driver (so driverClassName would be the shared) and it also can be the case they use the same credentials (so username and password would be the shared). I'd like to do something like:
<block id="driver-credentials">
<property name="driverClassName" value="${jdbc.driverClassName}"/>
<property name="username" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
</block>
<bean id="ds1" class="org.apache.commons.dbcp.BasicDataSource">
<property name="url" value="${jdbc.url1}"/>
<block-ref id="driver-credentials"/>
</bean>
<bean id="ds2" class="org.apache.commons.dbcp.BasicDataSource">
<property name="url" value="${jdbc.url2}"/>
<block-ref id="driver-credentials"/>
</bean>
<bean id="ds3" class="org.apache.commons.dbcp.BasicDataSource">
<property name="url" value="${jdbc.url3}"/>
<block-ref id="driver-credentials"/>
</bean>
or something along these lines. Obviously this can be a parent-child for this simple example, I'm just wondering about a mixin-type solution. Pretty much the same thing Spring offers for multiple files, except on the bean level.
Opinions on why doing the above would not be good or alternative ways to do it are welcome.
Parent child with merge = true on child is the one supported by spring. merge does act as mixin (in a way for collections), right?