I'm getting the following error when trying to build my very simple webservice project. I've given the build.xml, my java file and path values
The class file is getting generated, but service is not getting generated.
Please help... It's bugging for a looooong time..
Thanks! :)
CLASSPATH=C:\bea\weblogic81\server\lib\weblogic.jar;C:\bea\weblogic81\server\lib \webservices.jar;C:\bea\weblogic81\server\lib\ojdbc14.jar;C:\j2sdk1.4.2_18\jre\l ib\rt.jar;c:\ant\apache-ant-1.5.4\lib\ant.jar;c:\ant\apache-ant-1.5.4\lib\option al.jar;
Path=C:\Program Files\Reflection;C:\oracle\ora92\bin;C:\Program Files\Oracle\jre \1.3.1\bin;C:\Program Files\Oracle\jre\1.1.8\bin;C:\WINDOWS\system32;C:\WINDOWS; C:\WINDOWS\System32\Wbem;C:\Program Files\Intel\DMIX;C:\Program Files\Windows Im aging\;C:\j2sdk1.4.2_18\bin;c:\j2sdk1.4.2_18\bin;c:\ant\apache-ant-1.5.4\bin; PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
UserModel.java
import java.sql.*;
import java.util.*;
public class UserModel
{
Connection con=null;
Statement st=null;
Statement st1=null;
ResultSet rs=null;
String nm,age,course,address,mob,IdNum1;
int IdNum,id;
int x;
int check=0;
ArrayList list=new ArrayList();
ArrayList eptylist=new ArrayList();
UserModel()
{
}
public int insert(String name,String age,String course,String address,int Mob) throws SQLException, ClassNotFoundException
{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@192.168.142.22:40401:MKTMRM9","mrm2","Marms*123.");
st=con.createStatement();
x= st.executeUpdate("insert into student values(seqno.nextval,'"+name+"','"+age+"','"+course+"','"+address+"','"+Mob+"')");
if(x==1)
{
st1=con.createStatement();
rs=st.executeQuery("select seqno.currval from student");
while(rs.next())
{
IdNum=rs.getInt(1);
}
return IdNum;
}
else
return 0;
}
public ArrayList getDetails(int id1) throws SQLException, ClassNotFoundException
{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con=DriverManager.getConnection("jdbc:oracle:thin:@192.168.142.22:40401:MKTMRM9","mrm2","Marms*123.");
st=con.createStatement();
rs=st.executeQuery("select * from student where StudentId="+id1);
while(rs.next())
{
check++;
id=rs.getInt(1);
nm=rs.getString(2);
age=rs.getString(3);
course=rs.getString(4);
address=rs.getString(5);
mob=rs.getString(6);
}
list.add(new Integer(id));
list.add(nm);
list.add(age);
list.add(course);
list.add(address);
list.add(mob);
if(check!=0)
return list;
else
return eptylist;
}
}
build.xml
<?xml version="1.0"?>
<project name="WebServiceServer" default="create" basedir=".">
<taskdef name="servicegen" classname="weblogic.ant.taskdefs.webservices.servicegen.ServiceGenTask"/>
<property name="src" value=".\src"/>
<property name="build" value=".\build"/>
<property name="namespace" value="http://localhost:7001/UserModel"/>
<target name="create">
<javac srcdir="${src}" destdir="${build}" includes="**/*.java">
</javac>
<servicegen
destEar="myWebServer.ear"
warName="mywebserver.war"
contextURI="WebServiceServer">
<service
javaClassComponents="UserModel"
targetNamespace="${namespace}"
serviceName="UserModel"
serviceURI="/UserModel"
generateTypes="True"
expandMethods="True"
style="rpc">
</service>
<classpath>
<pathelement path="${build}"/>
<pathelement path="${java.class.path}"/>
<pathelement path="{lib}/ojdbc14.jar"/>
</classpath>
</servicegen>
</target>
</project>
error from console - while ant is run
Buildfile: build.xml create: [javac] Compiling 1 source file to C:\Documents and Settings\344756\New\MyWe b\WebServiceServer\build [servicegen] Generating service "UserModel" ... [servicegen] java.lang.SecurityException: Prohibited package name: java.lang [servicegen] at java.lang.ClassLoader.defineClass(ClassLoader.java:524) [servicegen] at java.security.SecureClassLoader.defineClass(SecureClassLoader .java:123) [servicegen] at weblogic.utils.classloaders.GenericClassLoader.findLocalClass (GenericClassLoader.java:476) [servicegen] at weblogic.utils.classloaders.GenericClassLoader.findClass(Gene ricClassLoader.java:181) [servicegen] at java.lang.ClassLoader.loadClass(ClassLoader.java:289) [servicegen] at java.lang.ClassLoader.loadClass(ClassLoader.java:235) [servicegen] at weblogic.utils.classloaders.GenericClassLoader.loadClass(Gene ricClassLoader.java:223) [servicegen] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302) [servicegen] at java.lang.Class.forName0(Native Method) [servicegen] at java.lang.Class.forName(Class.java:219) [servicegen] at weblogic.xml.schema.binding.internal.codegen.Compiler.loadCla ss(Compiler.java:641) [servicegen] at weblogic.xml.schema.binding.internal.codegen.Compiler.addToMa pping(Compiler.java:450) [servicegen] at weblogic.xml.schema.binding.internal.codegen.Compiler.compile (Compiler.java:175) [servicegen] at weblogic.xml.schema.binding.internal.XSDTypeMappingBuilder.ma pClass(XSDTypeMappingBuilder.java:89) [servicegen] at weblogic.xml.schema.binding.internal.XSDTypeMappingBuilder.ma pClass(XSDTypeMappingBuilder.java:102) [servicegen] at weblogic.xml.schema.binding.internal.TypeMappingBuilderBase.a ddMapping(TypeMappingBuilderBase.java:180) [servicegen] at weblogic.ant.taskdefs.webservices.autotype.ComponentAutoTyper .addMapping(ComponentAutoTyper.java:88) [servicegen] at weblogic.ant.taskdefs.webservices.autotype.ComponentAutoTyper .mapComponent(ComponentAutoTyper.java:141) [servicegen] at weblogic.ant.taskdefs.webservices.autotype.JavaAutoTyper.run( JavaAutoTyper.java:81) [servicegen] at weblogic.ant.taskdefs.webservices.servicegen.ServiceGenTask.r unAutoTyper(ServiceGenTask.java:367) [servicegen] at weblogic.ant.taskdefs.webservices.servicegen.ServiceGenTask.g enerateService(ServiceGenTask.java:313) [servicegen] at weblogic.ant.taskdefs.webservices.servicegen.ServiceGenTask.e xecute(ServiceGenTask.java:181) [servicegen] at org.apache.tools.ant.Task.perform(Task.java:341) [servicegen] at org.apache.tools.ant.Target.execute(Target.java:309) [servicegen] at org.apache.tools.ant.Target.performTasks(Target.java:336) [servicegen] at org.apache.tools.ant.Project.executeTarget(Project.java:1339) [servicegen] at org.apache.tools.ant.Project.executeTargets(Project.java:1255 ) [servicegen] at org.apache.tools.ant.Main.runBuild(Main.java:609) [servicegen] at org.apache.tools.ant.Main.start(Main.java:196) [servicegen] at org.apache.tools.ant.Main.main(Main.java:235) BUILD FAILED file:C:/Documents%20and%20Settings/344756/New/MyWeb/WebServiceServer/build.xml:2 0: java.lang.SecurityException: Prohibited package name: java.lang Total time: 1 second