SMS Cat Java two times development problems encountered

Source: Internet
Author: User

The company recently bought a GSM SMS cat pool for texting. Encountered many problems on the way, now summarize the problems encountered.

1. First GSM comes with a software for database development, long and short letter server. According to the corresponding rules, the data is stored in the table, and then the short and long message server will automatically send SMS. According to the customer service to the data set of processes to go down, stumbling is finally able to send text messages. Results put the SMS cat on the server, the long and short letter server to report all kinds of errors, anyway is not work pit dad Ah! Because our server's system is WIN2008R2, and I test the machine is the Win7 system. At this point we decided to use the 2nd method: DLL development.

2.dll development, developed in Java, with a two-time development SMS package.

First of all, put Smslib-3.3.0b2.jar and Comm.jar, put into the project Lib, Javax.comm.properties put under%java_home%/jre/lib,
Win32com.dll put it under the%java_home%/jre/bin. If the path is misplaced, the call will be error-linked.

But my system is 64-bit, check the next Baidu Win32com.dll only adapt to jdk32 bit version. And the 64-bit need to use RXTX, fortunately there is such a package download online.

Http://www.inextera.com/thread-1216-1-1.html, the address has code and can be downloaded to the package. Thank you very much!

Windows
----------------------------------------------------

Choose your binary build-x64 or x86 (based on which version of
The JVM is installing to)

Note:you must match your architecture. You can ' t install the i386
Version on a 64-bit version of the JDK and Vice-versa.

For a JDK installation:

Copy Rxtxcomm.jar---> <java_home>\jre\lib\ext
Copy RxtxSerial.dll---> <java_home>\jre\bin
Copy RxtxParallel.dll---> <java_home>\jre\bin

Follow this to configure the file and prepare the work to complete.

3. Since I was developed with MyEclipse, Smslib.jar manually added to the project Lib to import the jar package, found that the Maven install is always unable to find the Smslib package, so if it is a MAVEN project, or in the Pom.xml configuration more secure.

<!--Https://mvnrepository.com/artifact/org.smslib/smslib--
<dependency>
<groupId>org.smslib</groupId>
<artifactId>smslib</artifactId>
<version>3.5.4</version>
</dependency>

4. When you run the test code, There is always a situation where the version is not correct. Because my myeclipse has 2 Tomcat, the JDK configured by WINDOWS-PERFERENCE-MYECLIPSE-SERVICE-TOMCAT-JDK is not related to the JDK configuration of my project. And my Tomcat ran the JDK version is 1.6, and the project compilation is 1.7.

Really drunk, checked for a long time. What the hell? 2 Tomcat, I'm adding a tomcat in the back, and this tomcat is running JDK version 1.7 of my natively installed JDK. Change all the corresponding JDK version path to this, and finally succeeded.

5. Can send a text message, the 2nd text message on the error, Java.lang.RuntimeException:javax.comm.PortInUseException: said the port is occupied.

The workaround is: Service.removegateway (gateway); Add this line of code. Then can be sent continuously, resulting in only send a text message reason: I checked the next is to say not SMS cat can not stop through the program, do not know is not, hehe

6. Well, it may be a good end, the result of the deployment of the project to the server, found that the text message is not sent out, I went. There was no feeling of madness! Think of the code is the same, then the error is certainly the environment, and is the reason for the system. Tangled!

It took a couple of hours to find out why, and the 4th step was not to send a text message because of the JDK version issue. So will not be the JDK version of the reason, check the next version is 1.7, then it is true. And then looked at the server install Tomcat with the JDK path a look at C:\Program files\java\jre7.

Think of the next is not the file should be configured to Jre7 in the bin and the Lib package, and then tried the next, sure enough is the problem. The heart of the moment is ... , not easy AH!

SMS Cat Java two times development problems encountered

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.