quinta-feira, 29 de agosto de 2013
Maximum number of items that can be serialized or deserialized in an object graph is '65536'. Change the object graph or increase the MaxItemsInObjectGraph quota.
OK, that's the problem.
The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://tempuri.org/:ObterSituacaoClienteGrupoResult. The InnerException message was 'Maximum number of items that can be serialized or deserialized in an object graph is '65536'. Change the object graph or increase the MaxItemsInObjectGraph quota. '. Please see InnerException for more details.
First of all, this message was received by the client of the service. So, the issue has two sides: client and server.
The server side
On the server side you're gonna have to add a new property to your behaviour.
Example
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="MyBehaviour">
<serviceMetadata httpGetEnabled="False" httpsGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="False"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
</behavior>
<services>
<service behaviorConfiguration="MyBehaviour" name="Netdaniels.Services.Rating">
<endpoint address="" binding="netTcpBinding" bindingConfiguration="MyBehaviour" bindingNamespace="http://www.netdaniels.com.br/product/risk/v1" contract="Netdaniels.Contract.IRisk" />
<host>
<baseAddresses>
<add baseAddress="/Risk.svc" />
</baseAddresses>
</host>
</service>
Unfortunately you have to change the client site too.
The client side
Example
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="MyBehaviour">
<dataContractSerializer maxItemsInObjectGraph="2147483646" />
</behavior>
</endpointBehaviors>
</behaviors>
<endpoint address="net.tcp://serverofclient:10261/Netdaniels.MyClient/shaba/"
binding="netTcpBinding" behaviorConfiguration="MyBehaviour" bindingConfiguration="NetTcpBinding_IShaba"
contract="ServicesNetdaniels.IShaba" name="NetTcpBinding_IShaba">
<identity>
<servicePrincipalName value="host/serverofclient" />
</identity>
</endpoint>
This is one of the most annoying problems I ever had.
I don't know if you noticed but there's a ripple effect related to this problem.
SERVER1 <- CLIENT 1 <- CLIENT 2 <- CLIENT 3
The scheme above means that, if you change configuration of server 1 you'll have to change configuration of client 1. If client 1 has a client, the configuration of this one must be changed too ans so on.
That's all folks!
terça-feira, 27 de agosto de 2013
ITILV3 - Day 37
IT Operations Management
IT Operations Management performs and monitors daily operational activities and events.
Example: IT Operations Management comprises the staff in a NOC (Network Operations Center).
Operations Management objectives:
1 - Diagnose IT Operations failures quickly.
2 - Improve service and reduce costs.
3 - Maintain stable processes and activities.
When it comes to Brasil Operations Management and Área de Infraestrutura are the same thing.
IT Operations Management performs and monitors daily operational activities and events.
Example: IT Operations Management comprises the staff in a NOC (Network Operations Center).
Operations Management objectives:
1 - Diagnose IT Operations failures quickly.
2 - Improve service and reduce costs.
3 - Maintain stable processes and activities.
When it comes to Brasil Operations Management and Área de Infraestrutura are the same thing.
sexta-feira, 23 de agosto de 2013
Reading directories
import java.io.File;
public class DirList {
public static void main(String args[]) {
String dirname = "/tmp";
File f1 = new File(dirname);
if (f1.isDirectory()) {
System.out.println( "Directory of " + dirname);
String s[] = f1.list();
for (int i=0; i < s.length; i++) {
File f = new File(dirname + "/" + s[i]);
if (f.isDirectory()) {
System.out.println(s[i] + " is a directory");
} else {
System.out.println(s[i] + " is a file");
}
}
} else {
System.out.println(dirname + " is not a directory");
}
}
}
public class DirList {
public static void main(String args[]) {
String dirname = "/tmp";
File f1 = new File(dirname);
if (f1.isDirectory()) {
System.out.println( "Directory of " + dirname);
String s[] = f1.list();
for (int i=0; i < s.length; i++) {
File f = new File(dirname + "/" + s[i]);
if (f.isDirectory()) {
System.out.println(s[i] + " is a directory");
} else {
System.out.println(s[i] + " is a file");
}
}
} else {
System.out.println(dirname + " is not a directory");
}
}
}
Read and Write file using Java
import java.io.*;
public class fileStreamTest{
public static void main(String args[]){
try{
byte bWrite [] = {11,21,3,40,5};
OutputStream os = new FileOutputStream("test.txt");
for(int x=0; x < bWrite.length ; x++){
os.write( bWrite[x] ); // writes the bytes
}
os.close();
InputStream is = new FileInputStream("test.txt");
int size = is.available();
for(int i=0; i< size; i++){
System.out.print((char)is.read() + " ");
}
is.close();
}catch(IOException e){
System.out.print("Exception");
}
}
}
public class fileStreamTest{
public static void main(String args[]){
try{
byte bWrite [] = {11,21,3,40,5};
OutputStream os = new FileOutputStream("test.txt");
for(int x=0; x < bWrite.length ; x++){
os.write( bWrite[x] ); // writes the bytes
}
os.close();
InputStream is = new FileInputStream("test.txt");
int size = is.available();
for(int i=0; i< size; i++){
System.out.print((char)is.read() + " ");
}
is.close();
}catch(IOException e){
System.out.print("Exception");
}
}
}
quinta-feira, 22 de agosto de 2013
Could not find or load the default class
Hey!
How are you doing?
If you are like me, trying to remember how to configure youre machine to start programmin in JAVA, that's how your enviromental variables must look like bellow:
CLASSPATH = .;C:\Program Files\Java\jdk1.7.0_21\bin
JAVA_HOME=C:\Program Files\Java\jdk1.7.0_21
Path= %JAVA_HOME%\bin
Attention:
Avoid redundance of javas
For instance, my windows has JDK 1.7, JRE 1.6 and JRE 1.7.
If your machine was set for programming, use only jdk. Otherwise your gonna receive messages that are variations of that one
"Could not find or load the default class" - very irritating message.
And to be sure you are using the right version go DOS command line and type
java -version
The result in my case is
Java(TM) SE Runtime Environment (build 1.7.0_21-b11)
Java HotSpot(TM) Client VM (build 23.21-b01, mixed mode, sharing)
Java HotSpot(TM) Client VM (build 23.21-b01, mixed mode, sharing)
You must be absolutely right about the javac and java. Both must be from the same version or, when you try to run you .class file, you're gonna receive an error message.
And that's all folks!
quarta-feira, 14 de agosto de 2013
terça-feira, 13 de agosto de 2013
NANT - ftpUpload - [ftpUpload] ProtocolError - The remote server returned an error: (550) File unavailable (eg, file not found, no access).
[ftpUpload] ProtocolError - The remote server returned an error: (550) File unavailable (eg, file not found, no access).
Be the build file bellow the one I'm currently using to upload the files and directories of C:\ServicePublish
<project name="buildSolution" default="upload">
<target name="upload" description="Upload files">
<ftpUpload host="server001" username="user001" password="password001" todir="/MyService" >
<fileset basedir="C:\ServicePublish\">
<include name="**/*" />
</fileset>
</ftpUpload>
</target>
</project>
Something you should understand
On server001, in /MyService, you are obliged to have the same tree of C:\ServicePublish
In other words
If the structure of your local machine is
C:\ServicePublish\Db
C:\ServicePublish\XML
C:\ServicePublish\Bin
The structure of /MyService must be
/MyService/Db
/MyService/XML
/MyService/Bin
Otherwise, you're gonna receive the message:
[ftpUpload] ProtocolError - The remote server returned an error: (550) File unavailable (eg, file not found, no access).
Conclusion:
ftpLoad doesn't create directories!
Assinar:
Postagens (Atom)