Dynamics AX Business Connector LogonAs failed - dynamics-ax-2009

I have an Enterprise Portal running IIS 7 on windows Server 2008 R2.
We are using Dynamics Ax 2009 Rollup 7.
Our Enterprise portal site stops working or displaying image, and I have to reset IIS to fix the problem.
Here is the error we getting and Event view;
*Dynamics Adapter LogonAs failed.*
Logon error : Connection with the Application Object Server could not be established.
Microsoft.Dynamics.BusinessConnectorNet.LogonFailedException
at Microsoft.Dynamics.BusinessConnectorNet.Axapta.Logon(BC_PROXY_ACCOUNT_INFO* pBCProxyAccountInfo, String company, String language, String objectServer, String configuration)
at Microsoft.Dynamics.BusinessConnectorNet.Axapta.LogonUsingBCProxyAccount(_SEC_WINNT_AUTH_IDENTITY_W* pImpersonatedUserAccount, NetworkCredential bcProxyCredentials, String company, String language, String objectServer, String configuration)
at Microsoft.Dynamics.BusinessConnectorNet.Axapta.LogonAs(String user, String domain, NetworkCredential bcProxyCredentials, String company, String language, String objectServer, String configuration)
at Microsoft.Dynamics.Framework.BusinessConnector.Session.DynamicsAdapter.LogonAs(String user, String domain, NetworkCredential bcProxyCredentials, String company, String language, String objectServer, String configuration)
Log Name: Application
Source: Microsoft.Dynamics.Framework.BusinessConnector
Date: 10/22/2013 11:35:28 AM
Event ID: 1000
Task Category: None
Level: Error
Keywords: Classic
User: N/A
Computer: AAA-Web.Example.NET
Description:
Dynamics Adapter LogonAs failed.
Logon error : Connection with the Application Object Server could not be established.
Microsoft.Dynamics.BusinessConnectorNet.LogonFailedException at Microsoft.Dynamics.BusinessConnectorNet.Axapta.Logon(BC_PROXY_ACCOUNT_INFO* pBCProxyAccountInfo, String company, String language, String objectServer, String configuration)
at Microsoft.Dynamics.BusinessConnectorNet.Axapta.LogonUsingBCProxyAccount(_SEC_WINNT_AUTH_IDENTITY_W* pImpersonatedUserAccount, NetworkCredential bcProxyCredentials, String company, String language, String objectServer, String configuration)
at Microsoft.Dynamics.BusinessConnectorNet.Axapta.LogonAs(String user, String domain, NetworkCredential bcProxyCredentials, String company, String language, String objectServer, String configuration)
at Microsoft.Dynamics.Framework.BusinessConnector.Session.DynamicsAdapter.LogonAs(String user, String domain, NetworkCredential bcProxyCredentials, String company, String language, String objectServer, String configuration)
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="Microsoft.Dynamics.Framework.BusinessConnector" />
<EventID Qualifiers="0">1000</EventID>
<Level>2</Level>
<Task>0</Task>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2013-10-22T15:35:28.000Z" />
<EventRecordID>311623</EventRecordID>
<Channel>Application</Channel>
<Computer>AAA.-Web.EXEMPLE.NET</Computer>
<Security />
</System>
<EventData>
<Data>Dynamics Adapter LogonAs failed.
Logon error : Connection with the Application Object Server could not be established.
Microsoft.Dynamics.BusinessConnectorNet.LogonFailedException
at Microsoft.Dynamics.BusinessConnectorNet.Axapta.Logon(BC_PROXY_ACCOUNT_INFO* pBCProxyAccountInfo, String company, String language, String objectServer, String configuration)
at Microsoft.Dynamics.BusinessConnectorNet.Axapta.LogonUsingBCProxyAccount(_SEC_WINNT_AUTH_IDENTITY_W* pImpersonatedUserAccount, NetworkCredential bcProxyCredentials, String company, String language, String objectServer, String configuration)
at Microsoft.Dynamics.BusinessConnectorNet.Axapta.LogonAs(String user, String domain, NetworkCredential bcProxyCredentials, String company, String language, String objectServer, String configuration)
at Microsoft.Dynamics.Framework.BusinessConnector.Session.DynamicsAdapter.LogonAs(String user, String domain, NetworkCredential bcProxyCredentials, String company, String language, String objectServer, String configuration)
</Data>
</EventData>
</Event>

Recycle your app pool.May be it will start working.

Related

SpringBoot reject all request if some header parms are not there even if we don't include them in specific requests

An example of that is below. I am not using associateId, firstName, lastName and galleryId but I want this request to be rejected if they are not present (Below code works for this). But is there a common place where we can set it for all request by default and not have to repeat the below code for all request?
#ApiOperation("Delete Project")
#DeleteMapping(value = "{projectId}")
public void deleteProject(
#ApiParam(value = "Project Id to be deleted", required = true) #PathVariable String projectId,
#RequestHeader("associateId") String associateId,
#RequestHeader("associateFirstName") String firstName,
#RequestHeader("associateLastName") String lastName,
#RequestHeader("galleryId") String galleryId) {
pjs.deleteProject(projectId);
}
I have lot of endpoints and only few use all 4 header variables but I want all request to have access to them even if they are not using them.

Creating Unit test for DAO in spring mvc

Hi i want to create DAO unit test in SPRING mvc for example for this type of code
package users;
public interface UserDAO {
public void setDataSource(DataSource ds);
public void create(int id, int personal, String password, String first_name, String last_name, String role,
String email, Date date, int id_team);
public User getUser(Integer user_id);
public List<User> listUsers();
void create1(int id, int personal, String password, String first_name, String last_name, String role, String email,
Date start_date);
}
...what is the best way to do it
For simpler DAO methods, which don't use proprietary sql functions you can use in memory relational database, like HSQLDB.
You configure it as a datasource for your tests.
You can start and populate it during test set up and the data will not be persisted anywhere after the test is done.
Seeing the methods you want to test, I suggest you take a look at Spring Data. All these methods are already implemented for you, all you have to do is configure and set up the interface

Spring LDAP - How to manage encoded (SHA) password

I want to implement a basic user repository using Spring LDAP and it's concept of Object-Directory Mapping (ODM).
My User class is pretty straightforward :
#Entry(objectClasses = { "inetOrgPerson", "organizationalPerson", "person", "shadowAccount", "top" }, base = "ou=people")
public class User {
[...]
#Id
private Name dn;
#Attribute(name = "uid")
#DnAttribute(value = "uid")
private String username;
#Attribute(name = "cn")
private String fullName;
#Attribute(name = "givenName")
private String firstName;
#Attribute(name = "sn")
private String lastName;
#Attribute(name = "o")
private String organization;
#Attribute(name = "userPassword")
private String password;
// Getters & Setters
[...]
}
And basic methods of my repository :
public User findByUid(String uid) {
return ldapTemplate.findOne(query().where("uid").is(uid), User.class);
}
public void update(User user) {
ldapTemplate.update(user);
}
Everything works fine except for the password attribute. For example, if I change only the user first name, the password is also changed.
I want to know how to deal with an encoded password (using the SHA - Secure Hashing Algorithm).
I don't see any annotations allowing to specify the encoding method.
Do we have to deal with it manually?
Short version
#Attribute(name = "userPassword", type = Type.BINARY)
private byte[] password;
is the correct definition of your password attribute. This is because LDAP stores the password as binary too.
To provide a convenient way of interaction, you should modify the setter for password:
public void setPassword(String password) {
this.password = password.getBytes(StandardCharsets.UTF_8);
}
Long version
The problem is your definition of userPassword. It is a java.lang.String. And the Spring LDAP ODM Attribute annotation defaults to Type.STRING.
Your LDAP gets the string as a byte array and checks if it has a proper prefix (in our case {SSHA}). If there is no prefix present it hashes the given string with its configured hash algorithm and stores it in the attribute as binary. Here lays the root cause. Your attribute definition differs. LDAP has a binary, you have a string.
When you read the entry again, to modify the first name, the password attribute gets read too. But, as it should be a string in the object, Spring converts the binary array to a string. This conversion is wrong, as it creates a string.
e.g.
you put test in the password field of your entity object.
Spring takes the string and sends it unmodified to the LDAP server.
the server hashes the string and saves it as {SSHA}H97JD...
you read the entry again
spring gets a byte[] containing the ASCII numbers representing the stored value
[123, 83, 83, 72, 65, 125, 72, 57, 55, 74, 68, ...]
conversion to a string results in the following:
123,83,83,72,65,125,72,57,55,74,68,...
spring sets this string in your entity as password value
you modify the first name
spring takes the password string again and sends it as is to the server
the servers prefix check indicates an unhashed password and applies the hash algorithm again on the string, because 123,83, starts not with {SSHA}
the server changes the password again.

How do I make a service method that invokes another service method transactional?

I'm using Spring 3.1.1.RELEASE, Hibernate 4.1.0.Final, JPA 2.0, and MySQL 5.5 I define transactions within my Spring application context file like so:
<jee:jndi-lookup jndi-name="java:jboss/springboard/sbpersistence" id="entityManagerFactory"
expected-type="javax.persistence.EntityManagerFactory" />
<bean id="entityManager" class="org.springframework.orm.jpa.support.SharedEntityManagerBean">
<property name="entityManagerFactory" ref="entityManagerFactory"/>
</bean>
<tx:jta-transaction-manager />
I have a Spring service class that has the following methods:
#Service
#Transactional
public class UserServiceImpl implements UserService
{
#Override
public User create(String firstName,
String middleName,
String lastName,
String userName,
String password,
String url,
Role role,
Organization org,
final Set<Contract> contracts)
{
…
return userDao.save(user);
}
#Override
public User createSampleUser(String firstName,
String middleName,
String lastName,
String userName,
String password,
String url,
Role role,
State state,
List<Product> products,
Date activationDate,
Date expirationDate)
{
…
return create(firstName,
middleName,
lastName,
userName,
password,
url,
role,
sampleDistrict,
contracts);
}
Notice that the second method invokes the first service method. My question is what is the appropriate annotation, if any, to indicate what I want everything within the second method to be treated as an atomic unit of work? I was confused since my first method is automatically #Transactional.
Thanks, - Dave
Updates based on comment
You can annotate the create() method with a propagation of REQUIRED:
#Override
#Transactional(propagation = Propagation.REQUIRED)
public User create(String firstName,
String middleName,
String lastName,
String userName,
String password,
String url,
Role role,
Organization org,
final Set<Contract> contracts)
{
…
return userDao.save(user);
}
REQUIRED means that if there is a current transaction, it will use that same transaction. Otherwise, it will create a new transaction for the method to execute in. The javadoc for REQUIRED :
Support a current transaction, create a new one if none exists. Analogous to EJB transaction attribute of the same name. This is the default setting of a transaction annotation.
Based on the last comment of the javadoc, this is the default transaction propagation setting, so technically you shouldn't need the annotation, but I nearly always put it in so that it's clear (incase the default changes as well!).

iBatis : Insert into two different tables

Let's take examples: I have a registration form for a student which has following fields:
Name
Address
Email
Password
I want to insert some student details (name, add, email) in student table, and email, password in login table.
I am using iBatis.
How to achive this....?
Assuming you have a user class like follow
class User{
private String name;
private String add;
private String email;
private String password;
//getter setter
}
your mybatis mapper file should have something like this
<insert id="insertInUser" parameterType="User">
insert into user(name,add,email) values(#{name},#{add},#{email})
</insert>
<insert id="insertInLogin" parameterType="User">
insert into login(email,password) values(#{email},#{password})
</insert>

Resources